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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [cdce2.c] - Blame information for rev 696

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 689 jeremybenn
/* { dg-do  run  } */
2
/* { dg-skip-if "doubles are floats" { "avr-*-*" } { "*" } { "" } } */
3
/* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details  -lm" } */
4
/* { dg-final { scan-tree-dump  "cdce2.c:16: note: function call is shrink-wrapped into error conditions\." "cdce" } }*/
5
/* { dg-final { cleanup-tree-dump "cdce" } } */
6
 
7
#include <stdlib.h>
8
#include <math.h>
9
#include <errno.h>
10
int total_err_count = 0;
11
double foo_opt (double y) __attribute__((noinline));
12
double foo_opt (double y)
13
{
14
  double yy = 0;
15
  errno = 0;
16
  yy = log (y);
17
  return 0;
18
}
19
 
20
double foo (double y) __attribute__((noinline));
21
double foo (double y)
22
{
23
  double yy = 0;
24
  errno = 0;
25
  yy = log (y);
26
  return yy;
27
}
28
 
29
int test (double (*fp) (double y))
30
{
31
  int i,x;
32
  for (i = -100; i < 100; i++)
33
    {
34
      fp (i);
35
      if (errno)
36
        total_err_count ++;
37
    }
38
 
39
  return total_err_count;
40
}
41
 
42
int main ()
43
{
44
  int en1, en2;
45
  double yy;
46
  total_err_count = 0;
47
  en1 = test (foo_opt);
48
  total_err_count = 0;
49
  en2 = test (foo);
50
 
51
  if (en1 != en2)
52
    abort();
53
 
54
  return 0;
55
}

powered by: WebSVN 2.1.0

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