Debian Codegraph @

gcc/testsuite/gcc.dg/tree-ssa/loop-interchange-2.c

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