OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [cdce1.c] - Blame information for rev 298

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* { dg-do  run  } */
2
/* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details  -lm" } */
3
/* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details" { target *-*-netware* } } */
4
/* { dg-final { scan-tree-dump  "cdce1.c:17: note: function call is shrink-wrapped into error conditions\."  "cdce" } } */
5
/* { dg-final { cleanup-tree-dump "cdce" } } */
6
/* { dg-require-effective-target large_double } */
7
 
8
#include <stdlib.h>
9
#include <math.h>
10
#include <errno.h>
11
int total_err_count = 0;
12
double foo_opt (int x, double y) __attribute__((noinline));
13
double foo_opt (int x, double y)
14
{
15
  double yy = 0;
16
  errno = 0;
17
  yy = pow (x, y * y);
18
  return 0;
19
}
20
 
21
double foo (int x, double y) __attribute__((noinline));
22
double foo (int x, double y)
23
{
24
  double yy = 0;
25
  errno = 0;
26
  yy = pow (x, y * y);
27
  return yy;
28
}
29
 
30
int test (double (*fp)(int x, double y))
31
{
32
  int i,x;
33
 
34
  x = 127;
35
  for (i = 30; i < 300; i++)
36
    {
37
      fp (x, i);
38
      if (errno)
39
        total_err_count ++;
40
    }
41
 
42
  x = -300;
43
  for (i = 100; i < 300; i++)
44
    {
45
      fp (x, i);
46
      if (errno)
47
        total_err_count ++;
48
    }
49
 
50
   x = 65577;
51
   for (i = 60; i < 200; i++)
52
     {
53
       fp (x, i);
54
       if (errno)
55
         total_err_count ++;
56
     }
57
 
58
   x = 65577 * 127;
59
   for (i = 1; i < 100; i++)
60
     {
61
       fp (x, i);
62
       if (errno)
63
         total_err_count ++;
64
     }
65
 
66
   return total_err_count;
67
}
68
 
69
int main ()
70
{
71
  int en1, en2;
72
  total_err_count = 0;
73
  en1 = test (foo_opt);
74
  total_err_count = 0;
75
  en2 = test (foo);
76
 
77
  if (en1 != en2)
78
    abort ();
79
 
80
  return 0;
81
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.