PR tree-optimization/84740
[official-gcc.git] / gcc / testsuite / gcc.dg / graphite / fuse-1.c
blob204d3b20703e18098e023e537f539bb63db3fd16
1 /* Check that the two loops are fused and that we manage to fold the two xor
2 operations. */
3 /* { dg-options "-O2 -floop-nest-optimize -fdump-tree-forwprop-all -fdump-tree-graphite-all" } */
5 /* Make sure we fuse the loops like this:
6 AST generated by isl:
7 for (int c0 = 0; c0 <= 99; c0 += 1) {
8 S_3(c0);
9 S_6(c0);
10 S_9(c0);
11 } */
12 /* { dg-final { scan-tree-dump-times "AST generated by isl:.*for \\(int c0 = 0; c0 <= 99; c0 \\+= 1\\) \\{.*S_.*\\(c0\\);.*S_.*\\(c0\\);.*S_.*\\(c0\\);.*\\}" 1 "graphite" } } */
14 /* Check that after fusing the loops, the scalar computation is also fused. */
15 /* { dg-final { scan-tree-dump-times "gimple_simplified to\[^\\n\]*\\^ 12" 1 "forwprop4" } } */
17 #define MAX 100
18 int A[MAX];
20 extern void abort ();
22 int
23 main (void)
25 int i;
27 for (i = 0; i < MAX; i++)
28 A[i] = i;
29 for(int i=0; i<MAX; i++)
30 A[i] ^= 4;
31 for(int i=0; i<MAX; i++)
32 A[i] ^= 8;
34 for (i = 0; i < MAX; i++)
35 if (A[i] != (i ^ 12))
36 abort ();
38 return 0;