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" } */
4 
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" } } */
13 
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" } } */
16 
17 #define MAX 100
18 int A[MAX];
19 
20 extern void abort ();
21 
22 int
main(void)23 main (void)
24 {
25   int i;
26 
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;
33 
34   for (i = 0; i < MAX; i++)
35     if (A[i] != (i ^ 12))
36       abort ();
37 
38   return 0;
39 }
40