* gcc.dg/torture/stackalign/builtin-apply-2.c: Fix skip-if syntax.
[official-gcc.git] / gcc / testsuite / gcc.dg / graphite / interchange-8.c
blobd7059107038a4af43c50157e89475a593561d909
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 /* Loops (L, J) are interchanged, and then loops (J and K) are
15 interchanged. The result is a nest starting with (K, J, L). */
16 for (l = 0; l < 4; l++)
18 for (k = 0; k < 4; k++)
20 for (j = 0; j < 4; j++)
22 for (i = 0; i < 2; i++)
24 B[i] = A[i][k][j][l] + A[3 - i][k][j][l];
25 B[3 - i] = A[i][k][j][l] - A[3 - i][k][j][l];
27 A[0][k][j][l] = B[0] + B[1];
28 A[2][k][j][l] = B[0] - B[1];
29 A[1][k][j][l] = B[3] + B[2];
30 A[3][k][j][l] = B[3] - B[2];
33 for (i = 0; i < 4; i++)
35 for (j = 0; j < 2; j++)
37 B[j] = A[i][k][j][l] + A[i][k][3 - j][l];
38 B[3 - j] = A[i][k][j][l] - A[i][k][3 - j][l];
40 A[i][k][0][l] = B[0] + B[1];
41 A[i][k][2][l] = B[0] - B[1];
42 A[i][k][1][l] = B[3] + B[2];
43 A[i][k][3][l] = B[3] - B[2];
48 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];
51 extern void abort ();
53 int
54 main (void)
56 int i, j, k, l, res;
58 for (i = 0; i < 4; i++)
59 B[i] = 2;
61 for (i = 0; i < 4; i++)
62 for (j = 0; j < 4; j++)
63 for (k = 0; k < 4; k++)
64 for (l = 0; l < 4; l++)
65 A[i][j][k][l] = i + j + k + l;
67 res = foo ();
69 #if DEBUG
70 for (i = 0; i < 4; i++)
71 for (j = 0; j < 4; j++)
72 for (k = 0; k < 4; k++)
73 for (l = 0; l < 4; l++)
74 fprintf (stderr, "A[%d][%d][%d][%d] = %d \n", i, j, k, l, A[i][j][k][l]);
76 fprintf (stderr, "res = %d \n", res);
77 #endif
79 if (res != 424)
80 abort ();
82 return 0;
85 /* { dg-final { scan-tree-dump "tiled by" "graphite" } } */