RISC-V: testsuite: fix old-style function definition error [NFC]
[official-gcc.git] / libgomp / testsuite / libgomp.c / loop-22.c
blob431e43bb9fad68a8d139114dc29068be03309aaa
1 /* { dg-do run } */
3 extern void abort (void);
5 signed char v[5][7][9][21][4][42][3];
6 volatile int zero = 0, one = 1, two = 2, three = 3;
7 volatile int five = 5, seven = 7, nine = 9, eleven = 11;
9 int
10 main ()
12 for (int i = 0; i < 5; i++)
13 for (int j = 0; j < 7; j++)
14 for (int k = 0; k < 9; k++)
15 for (int l = 2 * j; l < 3 * j; l++)
16 for (int m = 7; m < 11; m++)
17 for (int n = l; n < 2 * l; n++)
18 for (int o = 0; o < 3; o++)
19 v[i][j][k][l][m - 7][n][o] = 1;
21 int niters = 0;
22 #pragma omp teams reduction(+:niters)
23 #pragma omp distribute collapse(7)
24 for (int i = 0; i < 5; i++)
25 for (int j = 0; j < 7; j++)
26 for (int k = 0; k < 9; k++)
27 for (int l = 2 * j; l < 3 * j; l++)
28 for (int m = 7; m < 11; m++)
29 for (int n = l; n < 2 * l; n++)
30 for (int o = 0; o < 3; o++)
32 niters++;
33 if (i < 0 || i >= 5
34 || j < 0 || j >= 7
35 || k < 0 || k >= 9
36 || l < 2 * j || l >= 3 * j
37 || m < 7 || m >= 11
38 || n < l || n >= 2 * l
39 || o < 0 || o >= 3)
40 abort ();
41 if (v[i][j][k][l][m - 7][n][o] != 1)
42 abort ();
43 v[i][j][k][l][m - 7][n][o]++;
46 if (niters != 117180)
47 abort ();
49 int niters2 = 0;
50 #pragma omp teams reduction(+:niters2)
51 #pragma omp distribute collapse(7)
52 for (int i = zero; i < five; i += one)
53 for (int j = seven - one; j >= zero; j -= one)
54 for (int k = nine - one; k >= zero; k += -one)
55 for (int l = two * j + zero; l < three * j; l += one)
56 for (int m = eleven - one; m >= seven; m -= one)
57 for (int n = two * l - one; n > one * l - one; n -= one)
58 for (int o = zero; o < three; o += one)
60 niters2++;
61 if (i < 0 || i >= 5
62 || j < 0 || j >= 7
63 || k < 0 || k >= 9
64 || l < 2 * j || l >= 3 * j
65 || m < 7 || m >= 11
66 || n < l || n >= 2 * l
67 || o < 0 || o >= 3)
68 abort ();
69 if (v[i][j][k][l][m - 7][n][o] != 2)
70 abort ();
71 v[i][j][k][l][m - 7][n][o]++;
74 if (niters2 != 117180)
75 abort ();
77 for (int i = 0; i < 5; i++)
78 for (int j = 0; j < 7; j++)
79 for (int k = 0; k < 9; k++)
80 for (int l = 2 * j; l < 3 * j; l++)
81 for (int m = 7; m < 11; m++)
82 for (int n = l; n < 2 * l; n++)
83 for (int o = 0; o < 3; o++)
84 if (v[i][j][k][l][m - 7][n][o] != 3)
85 abort ();
87 int niters3 = 0;
88 #pragma omp teams reduction(+:niters3)
89 #pragma omp distribute collapse(5)
90 for (int i = 4; i >= 0; i--)
91 for (int j = 6; j >= 0; --j)
92 for (int l = 3 * j - 1; l >= 2 * j; l--)
93 for (int n = 2 * l + -1; n > l - 1; --n)
94 for (int o = 2; o >= 0; o--)
96 niters3++;
97 if (i < 0 || i >= 5
98 || j < 0 || j >= 7
99 || l < 2 * j || l >= 3 * j
100 || n < l || n >= 2 * l
101 || o < 0 || o >= 3)
102 abort ();
103 if (v[i][j][0][l][0][n][o] != 3)
104 abort ();
105 v[i][j][0][l][0][n][o]++;
108 if (niters3 != 3255)
109 abort ();
111 int niters4 = 0;
112 #pragma omp teams reduction(+:niters4)
113 #pragma omp distribute collapse(5)
114 for (int i = zero; i < five; i += one)
115 for (int j = zero; j <= seven - one; j += one)
116 for (int l = j * two; l < three * j + zero; l += one)
117 for (int n = one * l; n <= l * two - one; n += one)
118 for (int o = zero; o < three; o += one)
120 niters4++;
121 if (i < 0 || i >= 5
122 || j < 0 || j >= 7
123 || l < 2 * j || l >= 3 * j
124 || n < l || n >= 2 * l
125 || o < 0 || o >= 3)
126 abort ();
127 if (v[i][j][0][l][0][n][o] != 4)
128 abort ();
129 v[i][j][0][l][0][n][o]++;
132 if (niters4 != 3255)
133 abort ();
135 for (int i = 0; i < 5; i++)
136 for (int j = 0; j < 7; j++)
137 for (int l = 2 * j; l < 3 * j; l++)
138 for (int n = l; n < 2 * l; n++)
139 for (int o = 0; o < 3; o++)
140 if (v[i][j][0][l][0][n][o] != 5)
141 abort ();
143 int niters5 = 0;
144 #pragma omp teams reduction(+:niters5)
145 #pragma omp distribute collapse(3)
146 for (int j = 6; j >= 0; --j)
147 for (int l = 2 * j; l <= 3 * j - 1; l++)
148 for (int n = 2 * l + -1; n > l - 1; --n)
150 niters5++;
151 if (j < 0 || j >= 7
152 || l < 2 * j || l >= 3 * j
153 || n < l || n >= 2 * l)
154 abort ();
155 if (v[0][j][0][l][0][n][0] != 5)
156 abort ();
157 v[0][j][0][l][0][n][0]++;
160 if (niters5 != 217)
161 abort ();
163 int niters6 = 0;
164 #pragma omp teams reduction(+:niters6)
165 #pragma omp distribute collapse(3)
166 for (int j = seven - one; j > - one; j -= one)
167 for (int l = j * three - one; l >= j * two + zero; l += -one)
168 for (int n = two * l - one; n > l - one; n -= one)
170 niters6++;
171 if (j < 0 || j >= 7
172 || l < 2 * j || l >= 3 * j
173 || n < l || n >= 2 * l)
174 abort ();
175 if (v[0][j][0][l][0][n][0] != 6)
176 abort ();
177 v[0][j][0][l][0][n][0]++;
180 if (niters6 != 217)
181 abort ();
183 for (int j = 0; j < 7; j++)
184 for (int l = 2 * j; l < 3 * j; l++)
185 for (int n = l; n < 2 * l; n++)
186 if (v[0][j][0][l][0][n][0] != 7)
187 abort ();
190 static int i, j, x;
191 static volatile int a, b, c, d, e, f, g, h;
192 static int w[13][27];
193 for (i = -4; i < 8; i++)
194 for (j = 3 * i; j > 2 * i; j--)
195 w[i + 5][j + 5] = 1;
196 a = -4; b = 8; c = 1; d = 3; e = 0; f = 2; g = 0; h = -1;
197 niters = 0; i = -100; j = -100; x = -100;
198 #pragma omp teams reduction(+:niters)
199 #pragma omp distribute collapse(2) lastprivate (i, j, x)
200 for (i = -4; i < 8; i++)
201 for (j = 3 * i; j > 2 * i; j--)
203 if (i < -4 || i >= 8 || j > 3 * i || j <= i * 2 || w[i + 5][j + 5] != 1)
204 abort ();
205 w[i + 5][j + 5]++;
206 x = i * 1024 + (j & 1023);
207 niters++;
209 if (i != 8 || j != 14 || x != 7183 || niters != 28)
210 abort ();
211 niters = 0; i = -100; j = -100; x = -100;
212 #pragma omp teams reduction(+:niters)
213 #pragma omp distribute collapse(2) lastprivate (i, j, x)
214 for (i = a; i < b; i += c)
215 for (j = d * i + e; j > g + i * f; j += h)
217 if (i < -4 || i >= 8 || j > 3 * i || j <= i * 2 || w[i + 5][j + 5] != 2)
218 abort ();
219 w[i + 5][j + 5]++;
220 x = i * 1024 + (j & 1023);
221 niters++;
223 if (i != 8 || j != 14 || x != 7183 || niters != 28)
224 abort ();
225 for (int i = -4; i < 8; i++)
226 for (int j = 3 * i; j > 2 * i; j--)
227 if (w[i + 5][j + 5] == 3)
228 w[i + 5][j + 5] = 0;
229 else
230 abort ();
231 for (i = -2; i < 4; i++)
232 for (j = -2 * i + 3; j > -3; j -= 2)
233 w[i + 5][j + 5] = 1;
234 a = -2; b = 4; c = 1; d = -2; e = 3; f = 0; g = -3; h = -2;
235 niters = 0; i = -100; j = -100; x = -100;
236 #pragma omp teams reduction(+:niters)
237 #pragma omp distribute collapse(2) lastprivate (i, j, x)
238 for (i = -2; i < 4; i++)
239 for (j = -2 * i + 3; j > -3; j -= 2)
241 if (i < -2 || i >= 4 || j <= -3 || j > -2 * i + 3 || w[i + 5][j + 5] != 1)
242 abort ();
243 w[i + 5][j + 5]++;
244 x = i * 1024 + (j & 1023);
245 niters++;
247 if (/* i != 4 || j != -3 || */x != 3071 || niters != 15)
248 abort ();
249 niters = 0; i = -100; j = -100; x = -100;
250 #pragma omp teams reduction(+:niters)
251 #pragma omp distribute collapse(2) lastprivate (i, j, x)
252 for (i = a; i < b; i += c)
253 for (j = d * i + e; j > g + i * f; j += h)
255 if (i < -2 || i >= 4 || j <= -3 || j > -2 * i + 3 || w[i + 5][j + 5] != 2)
256 abort ();
257 w[i + 5][j + 5]++;
258 x = i * 1024 + (j & 1023);
259 niters++;
261 if (/*i != 4 || j != -3 || */x != 3071 || niters != 15)
262 abort ();
263 for (i = -2; i < 4; i++)
264 for (j = -2 * i + 3; j > -3; j -= 2)
265 if (w[i + 5][j + 5] == 3)
266 w[i + 5][j + 5] = 0;
267 else
268 abort ();
269 for (i = 3; i > -3; i--)
270 for (j = -2 * i + 7; j > 2 * i + 1; j--)
271 w[i + 5][j + 5] = 1;
272 a = 3; b = -3; c = -1; d = -2; e = 7; f = 2; g = 1; h = -1;
273 niters = 0; i = -100; j = -100; x = -100;
274 #pragma omp teams reduction(+:niters)
275 #pragma omp distribute collapse(2) lastprivate (i, j, x)
276 for (i = 3; i > -3; i--)
277 for (j = -2 * i + 7; j > 2 * i + 1; j--)
279 if (i <= -3 || i > 3 || j <= 2 * i + 1 || j > -2 * i + 7 || w[i + 5][j + 5] != 1)
280 abort ();
281 w[i + 5][j + 5]++;
282 x = i * 1024 + (j & 1023);
283 niters++;
285 if (i != -3 || j != -3 || x != -1026 || niters != 32)
286 abort ();
287 niters = 0; i = -100; j = -100; x = -100;
288 #pragma omp teams reduction(+:niters)
289 #pragma omp distribute collapse(2) lastprivate (i, j, x)
290 for (i = a; i > b; i += c)
291 for (j = d * i + e; j > g + i * f; j += h)
293 if (i <= -3 || i > 3 || j <= 2 * i + 1 || j > -2 * i + 7 || w[i + 5][j + 5] != 2)
294 abort ();
295 w[i + 5][j + 5]++;
296 x = i * 1024 + (j & 1023);
297 niters++;
299 if (i != -3 || j != -3 || x != -1026 || niters != 32)
300 abort ();
301 for (i = 3; i > -3; i--)
302 for (j = -2 * i + 7; j > 2 * i + 1; j--)
303 if (w[i + 5][j + 5] == 3)
304 w[i + 5][j + 5] = 0;
305 else
306 abort ();
307 for (i = 3; i > -3; i--)
308 for (j = 2 * i + 7; j > -2 * i + 1; j--)
309 w[i + 5][j + 5] = 1;
310 a = 3; b = -3; c = -1; d = 2; e = 7; f = -2; g = 1; h = -1;
311 niters = 0; i = -100; j = -100; x = -100;
312 #pragma omp teams reduction(+:niters)
313 #pragma omp distribute collapse(2) lastprivate (i, j, x)
314 for (i = 3; i > -3; i--)
315 for (j = 2 * i + 7; j > -2 * i + 1; j--)
317 if (i <= -3 || i > 3 || j <= -2 * i + 1 || j > 2 * i + 7 || w[i + 5][j + 5] != 1)
318 abort ();
319 w[i + 5][j + 5]++;
320 x = i * 1024 + (j & 1023);
321 niters++;
323 if (/*i != -3 || j != 3 || */x != -1020 || niters != 50)
324 abort ();
325 niters = 0; i = -100; j = -100; x = -100;
326 #pragma omp teams reduction(+:niters)
327 #pragma omp distribute collapse(2) lastprivate (i, j, x)
328 for (i = a; i > b; i += c)
329 for (j = d * i + e; j > g + i * f; j += h)
331 if (i <= -3 || i > 3 || j <= -2 * i + 1 || j > 2 * i + 7 || w[i + 5][j + 5] != 2)
332 abort ();
333 w[i + 5][j + 5]++;
334 x = i * 1024 + (j & 1023);
335 niters++;
337 if (/*i != -3 || j != 3 || */x != -1020 || niters != 50)
338 abort ();
339 for (i = 3; i > -3; i--)
340 for (j = 2 * i + 7; j > -2 * i + 1; j--)
341 if (w[i + 5][j + 5] == 3)
342 w[i + 5][j + 5] = 0;
343 else
344 abort ();
345 for (i = 6; i > -6; i--)
346 for (j = 2 * i + 7; j <= -2 * i + 1; j++)
347 w[i + 5][j + 5] = 1;
348 a = 6; b = -6; c = -1; d = 2; e = 7; f = -2; g = 2; h = 1;
349 niters = 0; i = -100; j = -100; x = -100;
350 #pragma omp teams reduction(+:niters)
351 #pragma omp distribute collapse(2) lastprivate (i, j, x)
352 for (i = 6; i > -6; i--)
353 for (j = 2 * i + 7; j <= -2 * i + 1; j++)
355 if (i <= -6 || i > 6 || j < 2 * i + 7 || j >= -2 * i + 2 || w[i + 5][j + 5] != 1)
356 abort ();
357 w[i + 5][j + 5]++;
358 x = i * 1024 + (j & 1023);
359 niters++;
361 if (i != -6 || j != 12 || x != -5109 || niters != 36)
362 abort ();
363 niters = 0; i = -100; j = -100; x = -100;
364 #pragma omp teams reduction(+:niters)
365 #pragma omp distribute collapse(2) lastprivate (i, j, x)
366 for (i = a; i > b; i += c)
367 for (j = d * i + e; j < g + i * f; j += h)
369 if (i <= -6 || i > 6 || j < 2 * i + 7 || j >= -2 * i + 2 || w[i + 5][j + 5] != 2)
370 abort ();
371 w[i + 5][j + 5]++;
372 x = i * 1024 + (j & 1023);
373 niters++;
375 if (i != -6 || j != 12 || x != -5109 || niters != 36)
376 abort ();
377 for (i = 6; i > -6; i--)
378 for (j = 2 * i + 7; j <= -2 * i + 1; j++)
379 if (w[i + 5][j + 5] == 3)
380 w[i + 5][j + 5] = 0;
381 else
382 abort ();
383 for (i = 6; i > -6; i -= 2)
384 for (j = -2 * i + 7; j <= 2 * i + 1; j++)
385 w[i + 5][j + 5] = 1;
386 a = 6; b = -6; c = -2; d = -2; e = 7; f = 2; g = 2; h = 1;
387 niters = 0; i = -100; j = -100; x = -100;
388 #pragma omp teams reduction(+:niters)
389 #pragma omp distribute collapse(2) lastprivate (i, j, x)
390 for (i = 6; i > -6; i -= 2)
391 for (j = -2 * i + 7; j <= 2 * i + 1; j++)
393 if (i <= -6 || i > 6 || j < -2 * i + 7 || j >= 2 * i + 2 || w[i + 5][j + 5] != 1)
394 abort ();
395 w[i + 5][j + 5]++;
396 x = i * 1024 + (j & 1023);
397 niters++;
399 if (/*i != -6 || j != 15 || */x != 2053 || niters != 33)
400 abort ();
401 niters = 0; i = -100; j = -100; x = -100;
402 #pragma omp teams reduction(+:niters)
403 #pragma omp distribute collapse(2) lastprivate (i, j, x)
404 for (i = a; i > b; i += c)
405 for (j = d * i + e; j < g + i * f; j += h)
407 if (i <= -6 || i > 6 || j < -2 * i + 7 || j >= 2 * i + 2 || w[i + 5][j + 5] != 2)
408 abort ();
409 w[i + 5][j + 5]++;
410 x = i * 1024 + (j & 1023);
411 niters++;
413 if (/*i != -6 || j != 15 || */x != 2053 || niters != 33)
414 abort ();
415 for (i = 6; i > -6; i -= 2)
416 for (j = -2 * i + 7; j <= 2 * i + 1; j++)
417 if (w[i + 5][j + 5] == 3)
418 w[i + 5][j + 5] = 0;
419 else
420 abort ();
423 return 0;