PR middle-end/77357 - strlen of constant strings not folded
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / loop-interchange-9.c
bloba984e47d85429cbbc5433074e33962b379b12378
1 /* { dg-do run } */
2 /* { dg-options "-O2 -floop-interchange -fdump-tree-linterchange-details" } */
3 /* { dg-skip-if "too big data segment" { avr-*-* visium-*-* } } */
5 #define M 256
6 int a[M][M], b[M][M], c[M], d[M];
7 void __attribute__((noinline))
8 simple_reduc_1 (int n)
10 for (int j = 0; j < n; j++)
12 int sum = c[j];
13 for (int i = 0; i < n; i++)
14 sum = sum + a[i][j]*b[i][j];
16 c[j] = sum;
20 void __attribute__((noinline))
21 simple_reduc_2 (int n)
23 for (int j = 0; j < n; j++)
25 int sum = d[j];
26 for (int i = 0; i < n; i++)
27 sum = sum + a[i][j]*b[i][j];
29 asm volatile ("" ::: "memory");
30 d[j] = sum;
34 extern void abort ();
36 static void __attribute__((noinline))
37 init (int i)
39 c[i] = 0;
40 d[i] = 0;
41 for (int j = 0; j < M; j++)
43 a[i][j] = i;
44 b[i][j] = j;
48 int main (void)
50 for (int i = 0; i < M; ++i)
51 init (i);
53 simple_reduc_1 (M);
54 simple_reduc_2 (M);
56 for (int i = 0; i < M; ++i)
57 if (c[i] != d[i])
58 abort ();
60 return 0;
63 /* { dg-final { scan-tree-dump-times "Loop_pair<outer:., inner:.> is interchanged" 1 "linterchange" } } */