summaryrefslogtreecommitdiffstats
path: root/gcc/testsuite/gcc.dg/var-expand1.c
blob: 8782d1cf9c78ba2fb2f63d4ad355dbe76b0d6ee5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/* { dg-do compile } */
/* { dg-options "-O2 -funroll-loops --fast-math -fvariable-expansion-in-unroller -dL" } */

extern void abort (void);

float array[10] = { 1,2,3,4,5,6,7,8,9,10 };

int foo (int n)
{
  unsigned i;
  float accum = 1.0;

  for (i = 0; i < n; i++)
    accum += array[i];

  return accum;
}

int main (void)
{
  return foo (10);
}

/* { dg-final { scan-rtl-dump "Expanding Accumulator" "loop2_unroll" } } */
/* { dg-final { cleanup-rtl-dump "loop*" } } */
OpenPOWER on IntegriCloud