PR c/64856
[official-gcc.git] / gcc / testsuite / gcc.dg / var-expand1.c
blob7de4cfba1aef117ace380ae5f7013e62dd5d10fb
1 /* { dg-do compile } */
2 /* We don't (and don't want to) perform this optimisation on soft-float
3 targets, where each addition is a library call. */
4 /* { dg-require-effective-target hard_float } */
5 /* { dg-options "-O2 -funroll-loops --fast-math -fvariable-expansion-in-unroller -fdump-rtl-loop2_unroll" } */
7 extern void abort (void);
9 float array[30] = { 1,2,3,4,5,6,7,8,9,10 };
11 int foo (int n)
13 unsigned i;
14 float accum = 1.0;
16 for (i = 0; i < n; i++)
17 accum += array[i];
19 return accum;
22 int main (void)
24 return foo (10);
27 /* { dg-final { scan-rtl-dump "Expanding Accumulator" "loop2_unroll" } } */
28 /* { dg-final { cleanup-rtl-dump "loop2_unroll" } } */