OSDN Git Service

Add runtime tests for interchange and blocking.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / graphite / block-3.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 24
9 #define M 100
10
11 int A[M][M][M], B[M][M], C[M][M];
12
13 static int __attribute__((noinline))
14 foo (void)
15 {
16   int i, j, k;
17
18   /* These loops contain too few iterations to be blocked by 64.  */
19   for (i = 0; i < 24; i++)
20     for (j = 0; j < 24; j++)
21       for (k = 0; k < 24; k++)
22         A[i][j][k] = B[i][k] * C[k][j];
23
24   /* These loops should still be loop blocked.  */
25   for (i = 0; i < M; i++)
26     for (j = 0; j < M; j++)
27       for (k = 0; k < M; k++)
28         A[i][j][k] = B[i][k] * C[k][j];
29
30   return A[0][0][0] + A[M-1][M-1][M-1];
31 }
32
33 int
34 main (void)
35 {
36   int i, j, res;
37
38   for (i = 0; i < M; i++)
39     for (j = 0; j < M; j++)
40       {
41         B[i][j] = i;
42         C[i][j] = j;
43       }
44
45   res = foo ();
46
47 #if DEBUG
48   fprintf (stderr, "res = %d \n", res);
49 #endif
50
51   return res != 9801;
52 }
53
54 /* { dg-final { scan-tree-dump-times "will be loop blocked" 1 "graphite" } } */
55 /* { dg-final { cleanup-tree-dump "graphite" } } */