RISC-V: testsuite: fix old-style function definition error [NFC]
[official-gcc.git] / libgomp / testsuite / libgomp.c / doacross-6.c
blobde5dee6f60727c6d2fc410222321b1b7374b4830
1 extern void abort (void);
3 #define N 256
4 int a[N], b[N / 16][8][4], c[N / 32][8][8], g[N / 16][8][6];
5 volatile int d, e;
6 volatile unsigned long long f;
8 int
9 main ()
11 unsigned long long i;
12 int j, k, l, m;
13 #pragma omp parallel private (l)
15 #pragma omp for schedule(static, 1) ordered (1) nowait
16 for (i = 1; i < N + f; i++)
18 #pragma omp atomic write
19 a[i] = 1;
20 #pragma omp ordered doacross(sink: omp_cur_iteration - 1)
21 if (i > 1)
23 #pragma omp atomic read
24 l = a[i - 1];
25 if (l < 2)
26 abort ();
28 #pragma omp atomic write
29 a[i] = 2;
30 if (i < N - 1)
32 #pragma omp atomic read
33 l = a[i + 1];
34 if (l == 3)
35 abort ();
37 #pragma omp ordered doacross(source : omp_cur_iteration)
38 #pragma omp atomic write
39 a[i] = 3;
41 #pragma omp for schedule(static) ordered (3) nowait
42 for (i = 3; i < N / 16 - 1 + f; i++)
43 for (j = 0; j < 8; j += 2)
44 for (k = 1; k <= 3; k++)
46 #pragma omp atomic write
47 b[i][j][k] = 1;
48 #pragma omp ordered doacross(sink: i, j - 2, k - 1) \
49 doacross(sink: i - 2, j - 2, k + 1)
50 #pragma omp ordered doacross(sink: omp_cur_iteration - 1)
51 if (j >= 2 && k > 1)
53 #pragma omp atomic read
54 l = b[i][j - 2][k - 1];
55 if (l < 2)
56 abort ();
58 #pragma omp atomic write
59 b[i][j][k] = 2;
60 if (i >= 5 && j >= 2 && k < 3)
62 #pragma omp atomic read
63 l = b[i - 2][j - 2][k + 1];
64 if (l < 2)
65 abort ();
67 if (i != 3 || j || k != 1)
69 if (k != 1)
70 #pragma omp atomic read
71 l = b[i][j][k - 1];
72 else if (j)
73 #pragma omp atomic read
74 l = b[i][j - 2][3];
75 else
76 #pragma omp atomic read
77 l = b[i - 1][6][3];
78 if (l < 2)
79 abort ();
81 #pragma omp ordered doacross(source:)
82 #pragma omp atomic write
83 b[i][j][k] = 3;
85 #define A(n) int n;
86 #define B(n) A(n##0) A(n##1) A(n##2) A(n##3)
87 #define C(n) B(n##0) B(n##1) B(n##2) B(n##3)
88 #define D(n) C(n##0) C(n##1) C(n##2) C(n##3)
89 D(m)
90 #undef A
91 #pragma omp for collapse (2) ordered(61) schedule(dynamic, 15)
92 for (i = 2; i < N / 32 + f; i++)
93 for (j = 7; j > 1; j--)
94 for (k = 6; k >= 0; k -= 2)
95 #define A(n) for (n = 4; n < 5; n++)
96 D(m)
97 #undef A
99 #pragma omp atomic write
100 c[i][j][k] = 1;
101 #pragma omp ordered doacross (sink: omp_cur_iteration - 1)
102 if (i != 2 || j != 7 || k != 6)
104 if (k != 6)
105 #pragma omp atomic read
106 l = c[i][j][k + 2];
107 else if (j != 7)
108 #pragma omp atomic read
109 l = c[i][j + 1][0];
110 else
111 #pragma omp atomic read
112 l = c[i - 1][2][0];
113 if (l < 2)
114 abort ();
116 #pragma omp atomic write
117 c[i][j][k] = 2;
118 #pragma omp ordered doacross (source:)
119 #pragma omp atomic write
120 c[i][j][k] = 3;
122 #pragma omp for schedule(static) ordered (3) nowait
123 for (j = 0; j < N / 16 - 1; j++)
124 for (k = 0; k < 8; k += 2)
125 for (i = 3; i <= 5 + f; i++)
127 #pragma omp atomic write
128 g[j][k][i] = 1;
129 #pragma omp ordered doacross(sink: j, k - 2, i - 1) \
130 doacross(sink: omp_cur_iteration - 1)
131 #pragma omp ordered doacross(sink: j - 3, k + 2, i - 2)
132 if (k >= 2 && i > 3)
134 #pragma omp atomic read
135 l = g[j][k - 2][i - 1];
136 if (l < 2)
137 abort ();
139 #pragma omp atomic write
140 g[j][k][i] = 2;
141 if (j || k || i != 3)
143 if (i != 3)
144 #pragma omp atomic read
145 l = g[j][k][i - 1];
146 else if (k)
147 #pragma omp atomic read
148 l = g[j][k - 2][5 + f];
149 else
150 #pragma omp atomic read
151 l = g[j - 1][6][5 + f];
152 if (l < 2)
153 abort ();
155 if (j >= 3 && k < N / 16 - 3 && i == 5)
157 #pragma omp atomic read
158 l = g[j - 3][k + 2][i - 2];
159 if (l < 2)
160 abort ();
162 #pragma omp ordered doacross(source : omp_cur_iteration)
163 #pragma omp atomic write
164 g[j][k][i] = 3;
166 #pragma omp for collapse(2) ordered(4) lastprivate (i, j, k)
167 for (i = 2; i < f + 3; i++)
168 for (j = d + 1; j >= 0; j--)
169 for (k = 0; k < d; k++)
170 for (l = 0; l < d + 2; l++)
172 #pragma omp ordered doacross (source : omp_cur_iteration)
173 #pragma omp ordered doacross (sink:omp_cur_iteration - 1)
174 if (!e)
175 abort ();
177 #pragma omp single
179 if (i != 3 || j != -1 || k != 0)
180 abort ();
181 i = 8; j = 9; k = 10;
183 #pragma omp for collapse(2) ordered(4) lastprivate (i, j, k, m)
184 for (i = 2; i < f + 3; i++)
185 for (j = d + 1; j >= 0; j--)
186 for (k = 0; k < d + 2; k++)
187 for (m = 0; m < d; m++)
189 #pragma omp ordered doacross (source : omp_cur_iteration)
190 #pragma omp ordered doacross (sink:omp_cur_iteration - 1)
191 abort ();
193 #pragma omp single
194 if (i != 3 || j != -1 || k != 2 || m != 0)
195 abort ();
196 #pragma omp for collapse(2) ordered(4) nowait
197 for (i = 2; i < f + 3; i++)
198 for (j = d; j > 0; j--)
199 for (k = 0; k < d + 2; k++)
200 for (l = 0; l < d + 4; l++)
202 #pragma omp ordered doacross (source:)
203 #pragma omp ordered doacross (sink:omp_cur_iteration-1)
204 if (!e)
205 abort ();
207 #pragma omp for nowait
208 for (i = 0; i < N; i++)
209 if (a[i] != 3 * (i >= 1))
210 abort ();
211 #pragma omp for collapse(2) private(k) nowait
212 for (i = 0; i < N / 16; i++)
213 for (j = 0; j < 8; j++)
214 for (k = 0; k < 4; k++)
215 if (b[i][j][k] != 3 * (i >= 3 && i < N / 16 - 1 && (j & 1) == 0 && k >= 1))
216 abort ();
217 #pragma omp for collapse(3) nowait
218 for (i = 0; i < N / 32; i++)
219 for (j = 0; j < 8; j++)
220 for (k = 0; k < 8; k++)
221 if (c[i][j][k] != 3 * (i >= 2 && j >= 2 && (k & 1) == 0))
222 abort ();
223 #pragma omp for collapse(2) private(k) nowait
224 for (i = 0; i < N / 16; i++)
225 for (j = 0; j < 8; j++)
226 for (k = 0; k < 6; k++)
227 if (g[i][j][k] != 3 * (i < N / 16 - 1 && (j & 1) == 0 && k >= 3))
228 abort ();
230 return 0;