PR tree-optimization/81303
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / loop-interchange-10.c
blobb9c9fac0c01eaab39fa36482e2d27195867924a8
1 /* { dg-do run } */
2 /* { dg-options "-O2 -floop-interchange -fdump-tree-linterchange-details" } */
4 #define M 256
5 int a[M][M], b[M][M];
6 int __attribute__((noinline))
7 double_reduc (int n)
9 int sum = 0;
10 for (int j = 0; j < n; j++)
12 for (int i = 0; i < n; i++)
13 sum = sum + a[i][j]*b[i][j];
15 return sum;
18 extern void abort ();
20 static void __attribute__((noinline))
21 init (int i)
23 for (int j = 0; j < M; j++)
25 a[i][j] = i;
26 b[i][j] = j;
30 int main (void)
32 for (int i = 0; i < M; ++i)
33 init (i);
35 int sum = double_reduc (M);
37 if (sum != 1065369600)
38 abort ();
40 return 0;
43 /* { dg-final { scan-tree-dump-times "Loop_pair<outer:., inner:.> is interchanged" 1 "linterchange" } } */