OSDN Git Service

2010-03-15 Richard Guenther <rguenther@suse.de>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / pr30957-1.c
1 /* { dg-do run { xfail *-*-* } } */
2 /* We don't (and don't want to) perform this optimisation on soft-float
3    targets, where each addition is a library call.  This test requires
4    -fassociative-math for enabling the variable-expansion as well as
5    -fsigned-zeros for honoring the sign of zero; but
6    they can not co-exist; also under -funsafe-math-optimizations, so we
7    expect it to fail.  */
8 /* { dg-require-effective-target hard_float } */
9 /* { dg-options "-O2 -funroll-loops -funsafe-math-optimizations -fvariable-expansion-in-unroller -fdump-rtl-loop2_unroll" } */
10
11 extern void abort (void);
12 extern void exit (int);
13
14 float __attribute__((noinline))
15 foo (float d, int n)
16 {
17   unsigned i;
18   float accum = d;
19
20   for (i = 0; i < n; i++)
21     accum += d;
22
23   return accum;
24 }
25
26 int
27 main ()
28 {
29   if (__builtin_copysignf (1.0, foo (0.0 / -5.0, 10)) != -1.0)
30     abort ();
31   exit (0);
32 }
33
34 /* { dg-final { scan-rtl-dump "Expanding Accumulator" "loop2_unroll" } } */
35 /* { dg-final { cleanup-rtl-dump "loop*" } } */
36
37