PR tree-optimization/81303
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / loop-interchange-1.c
blob8bd3ba78e73f61c3fbb4802c144fdc62e37f9bd9
1 /* { dg-do run } */
2 /* { dg-options "-O2 -floop-interchange -fassociative-math -fno-signed-zeros -fno-trapping-math -fdump-tree-linterchange-details" } */
4 /* Copied from graphite/interchange-4.c */
6 #define DEBUG 0
7 #if DEBUG
8 #include <stdio.h>
9 #endif
11 double u[1782225];
13 static int __attribute__((noinline))
14 foo (int N, int *res)
16 int i, j;
17 double sum = 0;
18 for (i = 0; i < N; i++)
19 for (j = 0; j < N; j++)
20 sum = sum + u[i + 1335 * j];
22 for (i = 0; i < N; i++)
23 u[1336 * i] *= 2;
25 *res = sum + N + u[1336 * 2] + u[1336];
28 extern void abort ();
30 int
31 main (void)
33 int i, j, res;
35 for (i = 0; i < 1782225; i++)
36 u[i] = 2;
38 foo (1335, &res);
40 #if DEBUG
41 fprintf (stderr, "res = %d \n", res);
42 #endif
44 if (res != 3565793)
45 abort ();
47 return 0;
50 /* { dg-final { scan-tree-dump-times "Loop_pair<outer:., inner:.> is interchanged" 1 "linterchange"} } */