Support -std=f2018
[official-gcc.git] / libgomp / testsuite / libgomp.graphite / force-parallel-6.c
blob61ebc3a4873fa92ee8d44a79d0648f321a9befb8
1 void abort (void);
3 #define N 500
4 #define M 50
6 int X[2*N], Y[2*N], B[2*N];
7 int A[2*N][2*N], C[2*N][2*N];
9 static void __attribute__((noinline,noclone))
10 init (void)
12 volatile int i, j;
14 for (i = 0; i < 2 * N; ++i)
16 B[i] = 1;
17 X[i] = 1;
18 Y[i] = 1;
19 for (j = 0; j < 2 * N; ++j)
21 A[i][j] = 1;
22 C[i][j] = 1;
27 static void __attribute__((noinline,noclone))
28 foo (void)
30 int i, j, k;
32 for (i = 0; i < M; i++)
34 X[i] = Y[i] + 10;
35 for (j = 0; j < M; j++)
37 B[j] = A[j][N];
38 for (k = 0; k < N; k++)
40 A[j+1][k] = B[j] + C[j][k];
42 Y[i+j] = A[j+1][N];
47 static void __attribute__((noinline,noclone))
48 check (void)
50 volatile int i, j;
52 for (i = 0; i < 2 * N; ++i)
54 int expect_x = i < M ? 11 : 1;
56 if (B[i] != 1
57 || X[i] != expect_x
58 || Y[i] != 1)
59 abort ();
61 for (j = 0; j < 2 * N; ++j)
63 int expect_a = (0 < i && i <= M && j < N) ? 2 : 1;
65 if (A[i][j] != expect_a
66 || C[i][j] != 1)
67 abort ();
72 int main(void)
74 init ();
75 foo ();
76 check ();
78 return 0;
81 /* Check that parallel code generation part make the right answer. */
82 /* { dg-final { scan-tree-dump-times "1 loops carried no dependency" 1 "graphite" } } */
83 /* { dg-final { scan-tree-dump-times "loopfn.0" 4 "optimized" } } */