OSDN Git Service

PR testsuite/48283
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / graphite / interchange-6.c
1 /* { dg-require-effective-target size32plus } */
2
3 /* Formerly known as ltrans-6.c */
4
5 #define DEBUG 0
6 #if DEBUG
7 #include <stdio.h>
8 #endif
9
10 #define N 100
11 #define M 200
12
13 static int __attribute__((noinline))
14 foo (int A[N][M])
15 {
16   int i, j;
17
18   /* This loop should be interchanged. */
19   for(j = 0; j < M; j++)
20     for(i = 0; i < N; i++)
21       A[i][j] = A[i][j] + A[i][j];
22
23   return A[0][0] + A[N-1][M-1];
24 }
25
26 extern void abort ();
27
28 int
29 main (void)
30 {
31   int A[N][M];
32   int i, j, res;
33
34   for (i = 0; i < N; i++)
35     for (j = 0; j < M; j++)
36       A[i][j] = 2;
37
38   res = foo (A);
39
40 #if DEBUG
41   fprintf (stderr, "res = %d \n", res);
42 #endif
43
44   if (res != 8)
45     abort ();
46
47   return 0;
48 }
49
50 /* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */
51 /* { dg-final { cleanup-tree-dump "graphite" } } */