1 /* { dg-do run } */
2 /* { dg-options "-O2 -floop-interchange -fdump-tree-linterchange-details" } */
3 /* { dg-require-stack-size "8*111*1111" } */
4 /* { dg-skip-if "too big stack" { avr-*-* visium-*-* } } */
5 
6 /* Copied from graphite/interchange-7.c */
7 
8 #define DEBUG 0
9 #if DEBUG
10 #include <stdio.h>
11 #endif
12 
13 #define N 111
14 #define M 1111
15 
16 static int __attribute__((noinline))
foo(double * a)17 foo (double *a)
18 {
19   int i,j;
20   int r = 0;
21 
22   for (i = 0; i < N; ++i)
23     for (j = 0; j < M; ++j)
24       r += a[j * N + i];
25 
26   return r;
27 }
28 
29 extern void abort ();
30 
31 int
main(void)32 main (void)
33 {
34   double A[N*M];
35   int i, res;
36 
37   for (i = 0; i < N*M; i++)
38     A[i] = 2;
39 
40   res = foo (A);
41 
42 #if DEBUG
43   fprintf (stderr, "res = %d \n", res);
44 #endif
45 
46   if (res != 246642)
47     abort ();
48 
49   return 0;
50 }
51 
52 /* { dg-final { scan-tree-dump-times "Loop_pair<outer:., inner:.> is interchanged" 1 "linterchange" { xfail *-*-* } } } */
53