Add runtime tests for interchange and blocking.
[official-gcc/constexpr.git] / gcc / testsuite / gcc.dg / graphite / block-5.c
blob4b99900c9d4144d37c6eb32f297186574110e554
1 /* { dg-require-effective-target size32plus } */
3 #define DEBUG 0
4 #if DEBUG
5 #include <stdio.h>
6 #endif
8 #define N 200
10 int a[N][N];
11 int b[N][N];
13 static int __attribute__((noinline))
14 foo (void)
16 int i, j;
17 int res = 0;
19 /* This loop nest should be blocked. */
20 for (j = 1; j < N; j++)
21 for (i = 0; i < N; i++)
22 a[i][j] = a[i][j-1] + b[i][j];
24 for (i = 0; i < N; i++)
25 res += a[i][i];
27 return res;
30 int
31 main (void)
33 int i, j, res;
35 for (i = 0; i < N; i++)
36 for (j = 0; j < N; j++)
38 a[i][j] = i + j;
39 b[i][j] = i - j;
42 res = foo ();
44 #if DEBUG
45 fprintf (stderr, "res = %d \n", res);
46 #endif
48 return res != 1333300;
51 /* { dg-final { scan-tree-dump-times "will be loop blocked" 1 "graphite" } } */
52 /* { dg-final { cleanup-tree-dump "graphite" } } */