OSDN Git Service

Add runtime tests for interchange and blocking.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / graphite / block-5.c
1 /* { dg-require-effective-target size32plus } */
2
3 #define DEBUG 0
4 #if DEBUG
5 #include <stdio.h>
6 #endif
7
8 #define N 200
9
10 int a[N][N];
11 int b[N][N];
12
13 static int __attribute__((noinline))
14 foo (void)
15 {
16   int i, j;
17   int res = 0;
18
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];
23
24   for (i = 0; i < N; i++)
25     res += a[i][i];
26
27   return res;
28 }
29
30 int
31 main (void)
32 {
33   int i, j, res;
34
35   for (i = 0; i < N; i++)
36     for (j = 0; j < N; j++)
37       {
38         a[i][j] = i + j;
39         b[i][j] = i - j;
40       }
41
42   res = foo ();
43
44 #if DEBUG
45   fprintf (stderr, "res = %d \n", res);
46 #endif
47
48   return res != 1333300;
49 }
50
51 /* { dg-final { scan-tree-dump-times "will be loop blocked" 1 "graphite" } } */
52 /* { dg-final { cleanup-tree-dump "graphite" } } */