2014-08-04 Ed Schonberg <schonberg@adacore.com>
[official-gcc.git] / gcc / testsuite / gcc.dg / pr30957-1.c
blob65b98fa533d58747a9411b354cf11c3157a1be5e
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" } */
11 extern void abort (void);
12 extern void exit (int);
14 float __attribute__((noinline))
15 foo (float d, int n)
17 unsigned i;
18 float accum = d;
20 for (i = 0; i < n; i++)
21 accum += d;
23 return accum;
26 int
27 main ()
29 if (__builtin_copysignf (1.0, foo (0.0 / -5.0, 10)) != -1.0)
30 abort ();
31 exit (0);
34 /* { dg-final { scan-rtl-dump "Expanding Accumulator" "loop2_unroll" } } */
35 /* { dg-final { cleanup-rtl-dump "loop*" } } */