Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Semantics / OpenMP / combined-constructs.f90
blob35ab6fcac58b99c37a0c9d7babfafddaeafef08a
1 ! RUN: %python %S/../test_errors.py %s %flang -fopenmp
3 program main
4 implicit none
5 integer :: N
6 integer :: i
7 real(8) :: a(256), b(256)
8 N = 256
10 !ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region.
11 !$omp distribute simd
12 do i = 1, N
13 a(i) = 3.14
14 enddo
15 !$omp end distribute simd
17 !$omp target parallel device(0)
18 do i = 1, N
19 a(i) = 3.14
20 enddo
21 !$omp end target parallel
23 !ERROR: At most one DEVICE clause can appear on the TARGET PARALLEL directive
24 !$omp target parallel device(0) device(1)
25 do i = 1, N
26 a(i) = 3.14
27 enddo
28 !$omp end target parallel
30 !$omp target parallel defaultmap(tofrom:scalar)
31 do i = 1, N
32 a(i) = 3.14
33 enddo
34 !$omp end target parallel
36 !ERROR: The argument TOFROM:SCALAR must be specified on the DEFAULTMAP clause
37 !$omp target parallel defaultmap(tofrom)
38 do i = 1, N
39 a(i) = 3.14
40 enddo
41 !$omp end target parallel
43 !ERROR: At most one DEFAULTMAP clause can appear on the TARGET PARALLEL directive
44 !$omp target parallel defaultmap(tofrom:scalar) defaultmap(tofrom:scalar)
45 do i = 1, N
46 a(i) = 3.14
47 enddo
48 !$omp end target parallel
50 !$omp target parallel map(tofrom:a)
51 do i = 1, N
52 a(i) = 3.14
53 enddo
54 !$omp end target parallel
56 !ERROR: COPYIN clause is not allowed on the TARGET PARALLEL directive
57 !ERROR: Non-THREADPRIVATE object 'a' in COPYIN clause
58 !$omp target parallel copyin(a)
59 do i = 1, N
60 a(i) = 3.14
61 enddo
62 !$omp end target parallel
64 !$omp target parallel do device(0)
65 do i = 1, N
66 a(i) = 3.14
67 enddo
68 !$omp end target parallel do
70 !ERROR: At most one DEVICE clause can appear on the TARGET PARALLEL DO directive
71 !$omp target parallel do device(0) device(1)
72 do i = 1, N
73 a(i) = 3.14
74 enddo
75 !$omp end target parallel do
77 !$omp target parallel do defaultmap(tofrom:scalar)
78 do i = 1, N
79 a(i) = 3.14
80 enddo
81 !$omp end target parallel do
83 !ERROR: The argument TOFROM:SCALAR must be specified on the DEFAULTMAP clause
84 !$omp target parallel do defaultmap(tofrom)
85 do i = 1, N
86 a(i) = 3.14
87 enddo
88 !$omp end target parallel do
90 !ERROR: At most one DEFAULTMAP clause can appear on the TARGET PARALLEL DO directive
91 !$omp target parallel do defaultmap(tofrom:scalar) defaultmap(tofrom:scalar)
92 do i = 1, N
93 a(i) = 3.14
94 enddo
95 !$omp end target parallel do
97 !$omp target parallel do map(tofrom:a)
98 do i = 1, N
99 a(i) = 3.14
100 enddo
101 !$omp end target parallel do
103 !ERROR: Non-THREADPRIVATE object 'a' in COPYIN clause
104 !$omp target parallel do copyin(a)
105 do i = 1, N
106 a(i) = 3.14
107 enddo
108 !$omp end target parallel do
110 !$omp target teams map(a)
111 do i = 1, N
112 a(i) = 3.14
113 enddo
114 !$omp end target teams
116 !$omp target teams device(0)
117 do i = 1, N
118 a(i) = 3.14
119 enddo
120 !$omp end target teams
122 !ERROR: At most one DEVICE clause can appear on the TARGET TEAMS directive
123 !$omp target teams device(0) device(1)
124 do i = 1, N
125 a(i) = 3.14
126 enddo
127 !$omp end target teams
129 !ERROR: SCHEDULE clause is not allowed on the TARGET TEAMS directive
130 !$omp target teams schedule(static)
131 do i = 1, N
132 a(i) = 3.14
133 enddo
134 !$omp end target teams
136 !$omp target teams defaultmap(tofrom:scalar)
137 do i = 1, N
138 a(i) = 3.14
139 enddo
140 !$omp end target teams
142 !ERROR: The argument TOFROM:SCALAR must be specified on the DEFAULTMAP clause
143 !$omp target teams defaultmap(tofrom)
144 do i = 1, N
145 a(i) = 3.14
146 enddo
147 !$omp end target teams
149 !ERROR: At most one DEFAULTMAP clause can appear on the TARGET TEAMS directive
150 !$omp target teams defaultmap(tofrom:scalar) defaultmap(tofrom:scalar)
151 do i = 1, N
152 a(i) = 3.14
153 enddo
154 !$omp end target teams
156 !$omp target teams num_teams(3) thread_limit(10) default(shared) private(i) shared(a)
157 do i = 1, N
158 a(i) = 3.14
159 enddo
160 !$omp end target teams
162 !ERROR: At most one NUM_TEAMS clause can appear on the TARGET TEAMS directive
163 !$omp target teams num_teams(2) num_teams(3)
164 do i = 1, N
165 a(i) = 3.14
166 enddo
167 !$omp end target teams
169 !ERROR: The parameter of the NUM_TEAMS clause must be a positive integer expression
170 !$omp target teams num_teams(-1)
171 do i = 1, N
172 a(i) = 3.14
173 enddo
174 !$omp end target teams
176 !ERROR: At most one THREAD_LIMIT clause can appear on the TARGET TEAMS directive
177 !$omp target teams thread_limit(2) thread_limit(3)
178 do i = 1, N
179 a(i) = 3.14
180 enddo
181 !$omp end target teams
183 !ERROR: The parameter of the THREAD_LIMIT clause must be a positive integer expression
184 !$omp target teams thread_limit(-1)
185 do i = 1, N
186 a(i) = 3.14
187 enddo
188 !$omp end target teams
190 !ERROR: At most one DEFAULT clause can appear on the TARGET TEAMS directive
191 !$omp target teams default(shared) default(private)
192 do i = 1, N
193 a(i) = 3.14
194 enddo
195 !$omp end target teams
197 !$omp target teams num_teams(2) defaultmap(tofrom:scalar)
198 do i = 1, N
199 a(i) = 3.14
200 enddo
201 !$omp end target teams
203 !$omp target teams map(tofrom:a)
204 do i = 1, N
205 a(i) = 3.14
206 enddo
207 !$omp end target teams
209 !ERROR: Only the TO, FROM, TOFROM, ALLOC map types are permitted for MAP clauses on the TARGET TEAMS directive
210 !$omp target teams map(delete:a)
211 do i = 1, N
212 a(i) = 3.14
213 enddo
214 !$omp end target teams
217 !$omp target teams distribute map(a)
218 do i = 1, N
219 a(i) = 3.14
220 enddo
221 !$omp end target teams distribute
223 !$omp target teams distribute device(0)
224 do i = 1, N
225 a(i) = 3.14
226 enddo
227 !$omp end target teams distribute
229 !ERROR: At most one DEVICE clause can appear on the TARGET TEAMS DISTRIBUTE directive
230 !$omp target teams distribute device(0) device(1)
231 do i = 1, N
232 a(i) = 3.14
233 enddo
234 !$omp end target teams distribute
236 !$omp target teams distribute defaultmap(tofrom:scalar)
237 do i = 1, N
238 a(i) = 3.14
239 enddo
240 !$omp end target teams distribute
242 !ERROR: The argument TOFROM:SCALAR must be specified on the DEFAULTMAP clause
243 !$omp target teams distribute defaultmap(tofrom)
244 do i = 1, N
245 a(i) = 3.14
246 enddo
247 !$omp end target teams distribute
249 !ERROR: At most one DEFAULTMAP clause can appear on the TARGET TEAMS DISTRIBUTE directive
250 !$omp target teams distribute defaultmap(tofrom:scalar) defaultmap(tofrom:scalar)
251 do i = 1, N
252 a(i) = 3.14
253 enddo
254 !$omp end target teams distribute
256 !$omp target teams distribute num_teams(3) thread_limit(10) default(shared) private(i) shared(a)
257 do i = 1, N
258 a(i) = 3.14
259 enddo
260 !$omp end target teams distribute
262 !ERROR: At most one NUM_TEAMS clause can appear on the TARGET TEAMS DISTRIBUTE directive
263 !$omp target teams distribute num_teams(2) num_teams(3)
264 do i = 1, N
265 a(i) = 3.14
266 enddo
267 !$omp end target teams distribute
269 !ERROR: The parameter of the NUM_TEAMS clause must be a positive integer expression
270 !$omp target teams distribute num_teams(-1)
271 do i = 1, N
272 a(i) = 3.14
273 enddo
274 !$omp end target teams distribute
276 !ERROR: At most one THREAD_LIMIT clause can appear on the TARGET TEAMS DISTRIBUTE directive
277 !$omp target teams distribute thread_limit(2) thread_limit(3)
278 do i = 1, N
279 a(i) = 3.14
280 enddo
281 !$omp end target teams distribute
283 !ERROR: The parameter of the THREAD_LIMIT clause must be a positive integer expression
284 !$omp target teams distribute thread_limit(-1)
285 do i = 1, N
286 a(i) = 3.14
287 enddo
288 !$omp end target teams distribute
290 !ERROR: At most one DEFAULT clause can appear on the TARGET TEAMS DISTRIBUTE directive
291 !$omp target teams distribute default(shared) default(private)
292 do i = 1, N
293 a(i) = 3.14
294 enddo
295 !$omp end target teams distribute
297 !$omp target teams distribute num_teams(2) defaultmap(tofrom:scalar)
298 do i = 1, N
299 a(i) = 3.14
300 enddo
301 !$omp end target teams distribute
303 !$omp target teams distribute map(tofrom:a)
304 do i = 1, N
305 a(i) = 3.14
306 enddo
307 !$omp end target teams distribute
309 !ERROR: Only the TO, FROM, TOFROM, ALLOC map types are permitted for MAP clauses on the TARGET TEAMS DISTRIBUTE directive
310 !$omp target teams distribute map(delete:a)
311 do i = 1, N
312 a(i) = 3.14
313 enddo
314 !$omp end target teams distribute
316 !$omp target teams distribute parallel do device(0)
317 do i = 1, N
318 a(i) = 3.14
319 enddo
320 !$omp end target teams distribute parallel do
322 !ERROR: At most one DEVICE clause can appear on the TARGET TEAMS DISTRIBUTE PARALLEL DO directive
323 !$omp target teams distribute parallel do device(0) device(1)
324 do i = 1, N
325 a(i) = 3.14
326 enddo
327 !$omp end target teams distribute parallel do
329 !$omp target teams distribute parallel do defaultmap(tofrom:scalar)
330 do i = 1, N
331 a(i) = 3.14
332 enddo
333 !$omp end target teams distribute parallel do
335 !ERROR: The argument TOFROM:SCALAR must be specified on the DEFAULTMAP clause
336 !$omp target teams distribute parallel do defaultmap(tofrom)
337 do i = 1, N
338 a(i) = 3.14
339 enddo
340 !$omp end target teams distribute parallel do
342 !ERROR: At most one DEFAULTMAP clause can appear on the TARGET TEAMS DISTRIBUTE PARALLEL DO directive
343 !$omp target teams distribute parallel do defaultmap(tofrom:scalar) defaultmap(tofrom:scalar)
344 do i = 1, N
345 a(i) = 3.14
346 enddo
347 !$omp end target teams distribute parallel do
349 !$omp target teams distribute parallel do num_teams(3) thread_limit(10) default(shared) private(i) shared(a)
350 do i = 1, N
351 a(i) = 3.14
352 enddo
353 !$omp end target teams distribute parallel do
355 !ERROR: At most one NUM_TEAMS clause can appear on the TARGET TEAMS DISTRIBUTE PARALLEL DO directive
356 !$omp target teams distribute parallel do num_teams(2) num_teams(3)
357 do i = 1, N
358 a(i) = 3.14
359 enddo
360 !$omp end target teams distribute parallel do
362 !ERROR: The parameter of the NUM_TEAMS clause must be a positive integer expression
363 !$omp target teams distribute parallel do num_teams(-1)
364 do i = 1, N
365 a(i) = 3.14
366 enddo
367 !$omp end target teams distribute parallel do
369 !ERROR: At most one THREAD_LIMIT clause can appear on the TARGET TEAMS DISTRIBUTE PARALLEL DO directive
370 !$omp target teams distribute parallel do thread_limit(2) thread_limit(3)
371 do i = 1, N
372 a(i) = 3.14
373 enddo
374 !$omp end target teams distribute parallel do
376 !ERROR: The parameter of the THREAD_LIMIT clause must be a positive integer expression
377 !$omp target teams distribute parallel do thread_limit(-1)
378 do i = 1, N
379 a(i) = 3.14
380 enddo
381 !$omp end target teams distribute parallel do
383 !ERROR: At most one DEFAULT clause can appear on the TARGET TEAMS DISTRIBUTE PARALLEL DO directive
384 !$omp target teams distribute parallel do default(shared) default(private)
385 do i = 1, N
386 a(i) = 3.14
387 enddo
388 !$omp end target teams distribute parallel do
390 !$omp target teams distribute parallel do num_teams(2) defaultmap(tofrom:scalar)
391 do i = 1, N
392 a(i) = 3.14
393 enddo
394 !$omp end target teams distribute parallel do
396 !$omp target teams distribute parallel do map(tofrom:a)
397 do i = 1, N
398 a(i) = 3.14
399 enddo
400 !$omp end target teams distribute parallel do
402 !ERROR: Only the TO, FROM, TOFROM, ALLOC map types are permitted for MAP clauses on the TARGET TEAMS DISTRIBUTE PARALLEL DO directive
403 !$omp target teams distribute parallel do map(delete:a)
404 do i = 1, N
405 a(i) = 3.14
406 enddo
407 !$omp end target teams distribute parallel do
410 !$omp target teams distribute parallel do simd map(a)
411 do i = 1, N
412 a(i) = 3.14
413 enddo
414 !$omp end target teams distribute parallel do simd
416 !$omp target teams distribute parallel do simd device(0)
417 do i = 1, N
418 a(i) = 3.14
419 enddo
420 !$omp end target teams distribute parallel do simd
422 !ERROR: At most one DEVICE clause can appear on the TARGET TEAMS DISTRIBUTE PARALLEL DO SIMD directive
423 !$omp target teams distribute parallel do simd device(0) device(1)
424 do i = 1, N
425 a(i) = 3.14
426 enddo
427 !$omp end target teams distribute parallel do simd
429 !$omp target teams distribute parallel do simd defaultmap(tofrom:scalar)
430 do i = 1, N
431 a(i) = 3.14
432 enddo
433 !$omp end target teams distribute parallel do simd
435 !ERROR: The argument TOFROM:SCALAR must be specified on the DEFAULTMAP clause
436 !$omp target teams distribute parallel do simd defaultmap(tofrom)
437 do i = 1, N
438 a(i) = 3.14
439 enddo
440 !$omp end target teams distribute parallel do simd
442 !ERROR: At most one DEFAULTMAP clause can appear on the TARGET TEAMS DISTRIBUTE PARALLEL DO SIMD directive
443 !$omp target teams distribute parallel do simd defaultmap(tofrom:scalar) defaultmap(tofrom:scalar)
444 do i = 1, N
445 a(i) = 3.14
446 enddo
447 !$omp end target teams distribute parallel do simd
449 !$omp target teams distribute parallel do simd num_teams(3) thread_limit(10) default(shared) private(i) shared(a)
450 do i = 1, N
451 a(i) = 3.14
452 enddo
453 !$omp end target teams distribute parallel do simd
455 !ERROR: At most one NUM_TEAMS clause can appear on the TARGET TEAMS DISTRIBUTE PARALLEL DO SIMD directive
456 !$omp target teams distribute parallel do simd num_teams(2) num_teams(3)
457 do i = 1, N
458 a(i) = 3.14
459 enddo
460 !$omp end target teams distribute parallel do simd
462 !ERROR: The parameter of the NUM_TEAMS clause must be a positive integer expression
463 !$omp target teams distribute parallel do simd num_teams(-1)
464 do i = 1, N
465 a(i) = 3.14
466 enddo
467 !$omp end target teams distribute parallel do simd
469 !ERROR: At most one THREAD_LIMIT clause can appear on the TARGET TEAMS DISTRIBUTE PARALLEL DO SIMD directive
470 !$omp target teams distribute parallel do simd thread_limit(2) thread_limit(3)
471 do i = 1, N
472 a(i) = 3.14
473 enddo
474 !$omp end target teams distribute parallel do simd
476 !ERROR: The parameter of the THREAD_LIMIT clause must be a positive integer expression
477 !$omp target teams distribute parallel do simd thread_limit(-1)
478 do i = 1, N
479 a(i) = 3.14
480 enddo
481 !$omp end target teams distribute parallel do simd
483 !ERROR: At most one DEFAULT clause can appear on the TARGET TEAMS DISTRIBUTE PARALLEL DO SIMD directive
484 !$omp target teams distribute parallel do simd default(shared) default(private)
485 do i = 1, N
486 a(i) = 3.14
487 enddo
488 !$omp end target teams distribute parallel do simd
490 !$omp target teams distribute parallel do simd num_teams(2) defaultmap(tofrom:scalar)
491 do i = 1, N
492 a(i) = 3.14
493 enddo
494 !$omp end target teams distribute parallel do simd
496 !$omp target teams distribute parallel do simd map(tofrom:a)
497 do i = 1, N
498 a(i) = 3.14
499 enddo
500 !$omp end target teams distribute parallel do simd
502 !ERROR: Only the TO, FROM, TOFROM, ALLOC map types are permitted for MAP clauses on the TARGET TEAMS DISTRIBUTE PARALLEL DO SIMD directive
503 !$omp target teams distribute parallel do simd map(delete:a)
504 do i = 1, N
505 a(i) = 3.14
506 enddo
507 !$omp end target teams distribute parallel do simd
510 end program main