Update concepts branch to revision 131834
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / predcom-4.c
blob6f06b7f8bf6e7095d8203b21dd7f048c5bae275a
1 /* { dg-do compile } */
2 /* { dg-do run } */
3 /* { dg-options "-O2 -fpredictive-commoning -fdump-tree-pcom-details" } */
5 /* Test for predictive commoning of expressions, without reassociation. */
7 void abort (void);
9 int a[1000], b[1000], c[1000];
11 int main(void)
13 int i;
15 for (i = 0; i < 1000; i++)
16 a[i] = b[i] = i;
18 for (i = 1; i < 998; i++)
19 c[i] = a[i + 2] * b[i + 1] - b[i - 1] * a[i];
21 for (i = 1; i < 998; i++)
22 if (c[i] != 4 * i + 2)
23 abort ();
25 return 0;
28 /* { dg-final { scan-tree-dump-times "Combination" 1 "pcom"} } */
29 /* { dg-final { scan-tree-dump-times "Unrolling 3 times." 1 "pcom"} } */
30 /* { dg-final { cleanup-tree-dump "pcom" } } */