Merge from mainline (167278:168000).
[official-gcc/graphite-test-results.git] / gcc / testsuite / gcc.dg / graphite / interchange-8.c
blob8c07b6f7ff1d3cc38bbb23a4a7576838fab6bf62
1 #define DEBUG 0
2 #if DEBUG
3 #include <stdio.h>
4 #endif
6 int B[4];
7 int A[4][4][4][4];
9 static int __attribute__((noinline))
10 foo (void)
12 int i, j, k, l;
14 for (l = 0; l < 4; l++)
16 for (k = 0; k < 4; k++)
18 for (j = 0; j < 4; j++)
20 for (i = 0; i < 2; i++)
22 B[i] = A[i][k][j][l] + A[3 - i][k][j][l];
23 B[3 - i] = A[i][k][j][l] - A[3 - i][k][j][l];
25 A[0][k][j][l] = B[0] + B[1];
26 A[2][k][j][l] = B[0] - B[1];
27 A[1][k][j][l] = B[3] + B[2];
28 A[3][k][j][l] = B[3] - B[2];
31 for (i = 0; i < 4; i++)
33 for (j = 0; j < 2; j++)
35 B[j] = A[i][k][j][l] + A[i][k][3 - j][l];
36 B[3 - j] = A[i][k][j][l] - A[i][k][3 - j][l];
38 A[i][k][0][l] = B[0] + B[1];
39 A[i][k][2][l] = B[0] - B[1];
40 A[i][k][1][l] = B[3] + B[2];
41 A[i][k][3][l] = B[3] - B[2];
46 return A[0][1][0][2] + A[0][3][0][3] + A[0][2][0][2] + A[0][1][0][1] + A[3][3][0][2];
49 extern void abort ();
51 int
52 main (void)
54 int i, j, k, l, res;
56 for (i = 0; i < 4; i++)
57 B[i] = 2;
59 for (i = 0; i < 4; i++)
60 for (j = 0; j < 4; j++)
61 for (k = 0; k < 4; k++)
62 for (l = 0; l < 4; l++)
63 A[i][j][k][l] = i + j + k + l;
65 res = foo ();
67 #if DEBUG
68 for (i = 0; i < 4; i++)
69 for (j = 0; j < 4; j++)
70 for (k = 0; k < 4; k++)
71 for (l = 0; l < 4; l++)
72 fprintf (stderr, "A[%d][%d][%d][%d] = %d \n", i, j, k, l, A[i][j][k][l]);
74 fprintf (stderr, "res = %d \n", res);
75 #endif
77 if (res != 424)
78 abort ();
80 return 0;
83 /* Loops K and L should be interchanged. */
84 /* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" { xfail *-*-* } } } */
85 /* { dg-final { cleanup-tree-dump "graphite" } } */