PR tree-optimization/81303
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / loop-interchange-13.c
blob38b71e005998d80efd8ee078c8f7a7934d13007d
1 /* { dg-do run } */
2 /* { dg-options "-O2 -floop-interchange -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 unsigned u[1024];
13 static void __attribute__((noinline,noclone,noipa))
14 foo (int N, int M, unsigned *res)
16 int i, j;
17 unsigned sum = 0;
18 if (N > 0)
19 for (i = 0; i < M; i++)
20 for (j = 0; j < N; j++)
21 sum = u[i + 3 * j] - sum;
23 *res = sum;
26 extern void abort ();
28 int
29 main (void)
31 int i, j;
32 unsigned res;
34 u[0] = 1;
35 u[1] = 2;
36 u[2] = 4;
37 u[3] = 5;
38 u[4] = 7;
39 u[5] = 8;
41 foo (2, 3, &res);
43 #if DEBUG
44 fprintf (stderr, "res = %d \n", res);
45 #endif
47 if (res != 13)
48 abort ();
50 return 0;
53 /* { dg-final { scan-tree-dump-not "is interchanged" "linterchange"} } */