]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gcc.dg/tree-ssa/predcom-4.c
af9ae0e0f3d1256575bf4c72b9dc344bffe8503b
[thirdparty/gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / predcom-4.c
1 /* { dg-do run } */
2 /* { dg-options "-O2 -funroll-loops --param max-unroll-times=8 -fpredictive-commoning -fdump-tree-pcom-details-blocks" } */
3
4 /* Test for predictive commoning of expressions, without reassociation. */
5
6 void abort (void);
7
8 int a[1000], b[1000], c[1000];
9
10 int main(void)
11 {
12 int i;
13
14 for (i = 0; i < 1000; i++)
15 a[i] = b[i] = i;
16
17 for (i = 1; i < 998; i++)
18 c[i] = a[i + 2] * b[i + 1] - b[i - 1] * a[i];
19
20 for (i = 1; i < 998; i++)
21 if (c[i] != 4 * i + 2)
22 abort ();
23
24 return 0;
25 }
26
27 /* { dg-final { scan-tree-dump-times "Combination" 1 "pcom"} } */
28 /* { dg-final { scan-tree-dump-times "Unrolling 3 times." 1 "pcom"} } */
29 /* { dg-final { scan-tree-dump-not "Invalid sum" "pcom" } } */