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