File: if-clause.f90

package info (click to toggle)
llvm-toolchain-20 1%3A20.1.8-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,111,388 kB
  • sloc: cpp: 7,438,767; ansic: 1,393,871; asm: 1,012,926; python: 241,728; f90: 86,635; objc: 75,411; lisp: 42,144; pascal: 17,286; sh: 10,027; ml: 5,082; perl: 4,730; awk: 3,523; makefile: 3,349; javascript: 2,251; xml: 892; fortran: 672
file content (624 lines) | stat: -rw-r--r-- 20,107 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
! RUN: %python %S/../test_errors.py %s %flang -fopenmp -fopenmp-version=52
! Check OpenMP 'if' clause validity for all directives that can have it

program main
  integer :: i

  ! ----------------------------------------------------------------------------
  ! DISTRIBUTE PARALLEL DO
  ! ----------------------------------------------------------------------------
  !$omp teams
  !$omp distribute parallel do if(.true.)
  do i = 1, 10
  end do
  !$omp end distribute parallel do

  !$omp distribute parallel do if(parallel: .true.)
  do i = 1, 10
  end do
  !$omp end distribute parallel do

  !ERROR: TARGET is not a constituent of the DISTRIBUTE PARALLEL DO directive
  !$omp distribute parallel do if(target: .true.)
  do i = 1, 10
  end do
  !$omp end distribute parallel do

  !ERROR: At most one IF clause can appear on the DISTRIBUTE PARALLEL DO directive
  !$omp distribute parallel do if(.true.) if(parallel: .false.)
  do i = 1, 10
  end do
  !$omp end distribute parallel do
  !$omp end teams

  ! ----------------------------------------------------------------------------
  ! DISTRIBUTE PARALLEL DO SIMD
  ! ----------------------------------------------------------------------------
  !$omp teams
  !$omp distribute parallel do simd if(.true.)
  do i = 1, 10
  end do
  !$omp end distribute parallel do simd

  !$omp distribute parallel do simd if(parallel: .true.) if(simd: .false.)
  do i = 1, 10
  end do
  !$omp end distribute parallel do simd

  !ERROR: TARGET is not a constituent of the DISTRIBUTE PARALLEL DO SIMD directive
  !$omp distribute parallel do simd if(target: .true.)
  do i = 1, 10
  end do
  !$omp end distribute parallel do simd
  !$omp end teams

  ! ----------------------------------------------------------------------------
  ! DISTRIBUTE SIMD
  ! ----------------------------------------------------------------------------
  !$omp teams
  !$omp distribute simd if(.true.)
  do i = 1, 10
  end do
  !$omp end distribute simd

  !$omp distribute simd if(simd: .true.)
  do i = 1, 10
  end do
  !$omp end distribute simd

  !ERROR: TARGET is not a constituent of the DISTRIBUTE SIMD directive
  !$omp distribute simd if(target: .true.)
  do i = 1, 10
  end do
  !$omp end distribute simd

  !ERROR: At most one IF clause can appear on the DISTRIBUTE SIMD directive
  !$omp distribute simd if(.true.) if(simd: .false.)
  do i = 1, 10
  end do
  !$omp end distribute simd
  !$omp end teams

  ! ----------------------------------------------------------------------------
  ! DO SIMD
  ! ----------------------------------------------------------------------------
  !$omp do simd if(.true.)
  do i = 1, 10
  end do
  !$omp end do simd

  !$omp do simd if(simd: .true.)
  do i = 1, 10
  end do
  !$omp end do simd

  !ERROR: TARGET is not a constituent of the DO SIMD directive
  !$omp do simd if(target: .true.)
  do i = 1, 10
  end do
  !$omp end do simd

  !ERROR: At most one IF clause can appear on the DO SIMD directive
  !$omp do simd if(.true.) if(simd: .false.)
  do i = 1, 10
  end do
  !$omp end do simd

  ! ----------------------------------------------------------------------------
  ! PARALLEL
  ! ----------------------------------------------------------------------------
  !$omp parallel if(.true.)
  !$omp end parallel

  !$omp parallel if(parallel: .true.)
  !$omp end parallel

  !ERROR: TARGET is not a constituent of the PARALLEL directive
  !$omp parallel if(target: .true.)
  !$omp end parallel

  !ERROR: At most one IF clause can appear on the PARALLEL directive
  !$omp parallel if(.true.) if(parallel: .false.)
  !$omp end parallel

  ! ----------------------------------------------------------------------------
  ! PARALLEL DO
  ! ----------------------------------------------------------------------------
  !$omp parallel do if(.true.)
  do i = 1, 10
  end do
  !$omp end parallel do

  !$omp parallel do if(parallel: .true.)
  do i = 1, 10
  end do
  !$omp end parallel do

  !ERROR: TARGET is not a constituent of the PARALLEL DO directive
  !$omp parallel do if(target: .true.)
  do i = 1, 10
  end do
  !$omp end parallel do

  !ERROR: At most one IF clause can appear on the PARALLEL DO directive
  !$omp parallel do if(.true.) if(parallel: .false.)
  do i = 1, 10
  end do
  !$omp end parallel do

  ! ----------------------------------------------------------------------------
  ! PARALLEL DO SIMD
  ! ----------------------------------------------------------------------------
  !$omp parallel do simd if(.true.)
  do i = 1, 10
  end do
  !$omp end parallel do simd

  !$omp parallel do simd if(parallel: .true.) if(simd: .false.)
  do i = 1, 10
  end do
  !$omp end parallel do simd

  !ERROR: TARGET is not a constituent of the PARALLEL DO SIMD directive
  !$omp parallel do simd if(target: .true.)
  do i = 1, 10
  end do
  !$omp end parallel do simd

  ! ----------------------------------------------------------------------------
  ! PARALLEL SECTIONS
  ! ----------------------------------------------------------------------------
  !$omp parallel sections if(.true.)
  !$omp end parallel sections

  !$omp parallel sections if(parallel: .true.)
  !$omp end parallel sections

  !ERROR: TARGET is not a constituent of the PARALLEL SECTIONS directive
  !$omp parallel sections if(target: .true.)
  !$omp end parallel sections

  !ERROR: At most one IF clause can appear on the PARALLEL SECTIONS directive
  !$omp parallel sections if(.true.) if(parallel: .false.)
  !$omp end parallel sections

  ! ----------------------------------------------------------------------------
  ! PARALLEL WORKSHARE
  ! ----------------------------------------------------------------------------
  !$omp parallel workshare if(.true.)
  !$omp end parallel workshare

  !$omp parallel workshare if(parallel: .true.)
  !$omp end parallel workshare

  !ERROR: TARGET is not a constituent of the PARALLEL WORKSHARE directive
  !$omp parallel workshare if(target: .true.)
  !$omp end parallel workshare

  !ERROR: At most one IF clause can appear on the PARALLEL WORKSHARE directive
  !$omp parallel workshare if(.true.) if(parallel: .false.)
  !$omp end parallel workshare

  ! ----------------------------------------------------------------------------
  ! SIMD
  ! ----------------------------------------------------------------------------
  !$omp simd if(.true.)
  do i = 1, 10
  end do
  !$omp end simd

  !$omp simd if(simd: .true.)
  do i = 1, 10
  end do
  !$omp end simd

  !ERROR: TARGET is not a constituent of the SIMD directive
  !$omp simd if(target: .true.)
  do i = 1, 10
  end do
  !$omp end simd

  !ERROR: At most one IF clause can appear on the SIMD directive
  !$omp simd if(.true.) if(simd: .false.)
  do i = 1, 10
  end do
  !$omp end simd

  ! ----------------------------------------------------------------------------
  ! TARGET
  ! ----------------------------------------------------------------------------
  !$omp target if(.true.)
  !$omp end target

  !$omp target if(target: .true.)
  !$omp end target

  !ERROR: PARALLEL is not a constituent of the TARGET directive
  !$omp target if(parallel: .true.)
  !$omp end target

  !ERROR: At most one IF clause can appear on the TARGET directive
  !$omp target if(.true.) if(target: .false.)
  !$omp end target

  ! ----------------------------------------------------------------------------
  ! TARGET DATA
  ! ----------------------------------------------------------------------------
  !$omp target data map(tofrom: i) if(.true.)
  !$omp end target data

  !$omp target data map(tofrom: i) if(target data: .true.)
  !$omp end target data

  !ERROR: TARGET is not a constituent of the TARGET DATA directive
  !$omp target data map(tofrom: i) if(target: .true.)
  !$omp end target data

  !ERROR: At most one IF clause can appear on the TARGET DATA directive
  !$omp target data map(tofrom: i) if(.true.) if(target data: .false.)
  !$omp end target data

  ! ----------------------------------------------------------------------------
  ! TARGET ENTER DATA
  ! ----------------------------------------------------------------------------
  !$omp target enter data map(to: i) if(.true.)

  !$omp target enter data map(to: i) if(target enter data: .true.)

  !ERROR: TARGET is not a constituent of the TARGET ENTER DATA directive
  !$omp target enter data map(to: i) if(target: .true.)

  !ERROR: At most one IF clause can appear on the TARGET ENTER DATA directive
  !$omp target enter data map(to: i) if(.true.) if(target enter data: .false.)

  ! ----------------------------------------------------------------------------
  ! TARGET EXIT DATA
  ! ----------------------------------------------------------------------------
  !$omp target exit data map(from: i) if(.true.)

  !$omp target exit data map(from: i) if(target exit data: .true.)

  !ERROR: TARGET is not a constituent of the TARGET EXIT DATA directive
  !$omp target exit data map(from: i) if(target: .true.)
  
  !ERROR: At most one IF clause can appear on the TARGET EXIT DATA directive
  !$omp target exit data map(from: i) if(.true.) if(target exit data: .false.)

  ! ----------------------------------------------------------------------------
  ! TARGET PARALLEL
  ! ----------------------------------------------------------------------------
  !$omp target parallel if(.true.)
  !$omp end target parallel

  !$omp target parallel if(target: .true.) if(parallel: .false.)
  !$omp end target parallel

  !ERROR: SIMD is not a constituent of the TARGET PARALLEL directive
  !$omp target parallel if(simd: .true.)
  !$omp end target parallel

  ! ----------------------------------------------------------------------------
  ! TARGET PARALLEL DO
  ! ----------------------------------------------------------------------------
  !$omp target parallel do if(.true.)
  do i = 1, 10
  end do
  !$omp end target parallel do

  !$omp target parallel do if(target: .true.) if(parallel: .false.)
  do i = 1, 10
  end do
  !$omp end target parallel do

  !ERROR: SIMD is not a constituent of the TARGET PARALLEL DO directive
  !$omp target parallel do if(simd: .true.)
  do i = 1, 10
  end do
  !$omp end target parallel do

  ! ----------------------------------------------------------------------------
  ! TARGET PARALLEL DO SIMD
  ! ----------------------------------------------------------------------------
  !$omp target parallel do simd if(.true.)
  do i = 1, 10
  end do
  !$omp end target parallel do simd

  !$omp target parallel do simd if(target: .true.) if(parallel: .false.) &
  !$omp&                        if(simd: .true.)
  do i = 1, 10
  end do
  !$omp end target parallel do simd

  !ERROR: TEAMS is not a constituent of the TARGET PARALLEL DO SIMD directive
  !$omp target parallel do simd if(teams: .true.)
  do i = 1, 10
  end do
  !$omp end target parallel do simd

  ! ----------------------------------------------------------------------------
  ! TARGET SIMD
  ! ----------------------------------------------------------------------------
  !$omp target simd if(.true.)
  do i = 1, 10
  end do
  !$omp end target simd

  !$omp target simd if(target: .true.) if(simd: .false.)
  do i = 1, 10
  end do
  !$omp end target simd

  !ERROR: PARALLEL is not a constituent of the TARGET SIMD directive
  !$omp target simd if(parallel: .true.)
  do i = 1, 10
  end do
  !$omp end target simd

  ! ----------------------------------------------------------------------------
  ! TARGET TEAMS
  ! ----------------------------------------------------------------------------
  !$omp target teams if(.true.)
  !$omp end target teams

  !$omp target teams if(target: .true.) if(teams: .false.)
  !$omp end target teams

  !ERROR: PARALLEL is not a constituent of the TARGET TEAMS directive
  !$omp target teams if(parallel: .true.)
  !$omp end target teams

  ! ----------------------------------------------------------------------------
  ! TARGET TEAMS DISTRIBUTE
  ! ----------------------------------------------------------------------------
  !$omp target teams distribute if(.true.)
  do i = 1, 10
  end do
  !$omp end target teams distribute

  !$omp target teams distribute if(target: .true.) if(teams: .false.)
  do i = 1, 10
  end do
  !$omp end target teams distribute

  !ERROR: PARALLEL is not a constituent of the TARGET TEAMS DISTRIBUTE directive
  !$omp target teams distribute if(parallel: .true.)
  do i = 1, 10
  end do
  !$omp end target teams distribute

  ! ----------------------------------------------------------------------------
  ! TARGET TEAMS DISTRIBUTE PARALLEL DO
  ! ----------------------------------------------------------------------------
  !$omp target teams distribute parallel do if(.true.)
  do i = 1, 10
  end do
  !$omp end target teams distribute parallel do

  !$omp target teams distribute parallel do &
  !$omp&   if(target: .true.) if(teams: .false.) if(parallel: .true.)
  do i = 1, 10
  end do
  !$omp end target teams distribute parallel do

  !ERROR: SIMD is not a constituent of the TARGET TEAMS DISTRIBUTE PARALLEL DO directive
  !$omp target teams distribute parallel do if(simd: .true.)
  do i = 1, 10
  end do
  !$omp end target teams distribute parallel do

  ! ----------------------------------------------------------------------------
  ! TARGET TEAMS DISTRIBUTE PARALLEL DO SIMD
  ! ----------------------------------------------------------------------------
  !$omp target teams distribute parallel do simd if(.true.)
  do i = 1, 10
  end do
  !$omp end target teams distribute parallel do simd

  !$omp target teams distribute parallel do simd &
  !$omp&   if(target: .true.) if(teams: .false.) if(parallel: .true.) &
  !$omp&   if(simd: .false.)
  do i = 1, 10
  end do
  !$omp end target teams distribute parallel do simd

  !ERROR: TASK is not a constituent of the TARGET TEAMS DISTRIBUTE PARALLEL DO SIMD directive
  !$omp target teams distribute parallel do simd if(task: .true.)
  do i = 1, 10
  end do
  !$omp end target teams distribute parallel do simd

  ! ----------------------------------------------------------------------------
  ! TARGET TEAMS DISTRIBUTE SIMD
  ! ----------------------------------------------------------------------------
  !$omp target teams distribute simd if(.true.)
  do i = 1, 10
  end do
  !$omp end target teams distribute simd

  !$omp target teams distribute simd &
  !$omp&   if(target: .true.) if(teams: .false.) if(simd: .true.)
  do i = 1, 10
  end do
  !$omp end target teams distribute simd

  !ERROR: PARALLEL is not a constituent of the TARGET TEAMS DISTRIBUTE SIMD directive
  !$omp target teams distribute simd if(parallel: .true.)
  do i = 1, 10
  end do
  !$omp end target teams distribute simd

  ! ----------------------------------------------------------------------------
  ! TARGET UPDATE
  ! ----------------------------------------------------------------------------
  !$omp target update to(i) if(.true.)
  
  !$omp target update to(i) if(target update: .true.)

  !ERROR: TARGET is not a constituent of the TARGET UPDATE directive
  !$omp target update to(i) if(target: .true.)

  !ERROR: At most one IF clause can appear on the TARGET UPDATE directive
  !$omp target update to(i) if(.true.) if(target update: .false.)

  ! ----------------------------------------------------------------------------
  ! TASK
  ! ----------------------------------------------------------------------------
  !$omp task if(.true.)
  !$omp end task

  !$omp task if(task: .true.)
  !$omp end task

  !ERROR: TARGET is not a constituent of the TASK directive
  !$omp task if(target: .true.)
  !$omp end task

  !ERROR: At most one IF clause can appear on the TASK directive
  !$omp task if(.true.) if(task: .false.)
  !$omp end task

  ! ----------------------------------------------------------------------------
  ! TASKLOOP
  ! ----------------------------------------------------------------------------
  !$omp taskloop if(.true.)
  do i = 1, 10
  end do
  !$omp end taskloop

  !$omp taskloop if(taskloop: .true.)
  do i = 1, 10
  end do
  !$omp end taskloop

  !ERROR: TARGET is not a constituent of the TASKLOOP directive
  !$omp taskloop if(target: .true.)
  do i = 1, 10
  end do
  !$omp end taskloop

  !ERROR: At most one IF clause can appear on the TASKLOOP directive
  !$omp taskloop if(.true.) if(taskloop: .false.)
  do i = 1, 10
  end do
  !$omp end taskloop

  ! ----------------------------------------------------------------------------
  ! TASKLOOP SIMD
  ! ----------------------------------------------------------------------------
  !$omp taskloop simd if(.true.)
  do i = 1, 10
  end do
  !$omp end taskloop simd

  !$omp taskloop simd if(taskloop: .true.) if(simd: .false.)
  do i = 1, 10
  end do
  !$omp end taskloop simd

  !ERROR: TARGET is not a constituent of the TASKLOOP SIMD directive
  !$omp taskloop simd if(target: .true.)
  do i = 1, 10
  end do
  !$omp end taskloop simd

  ! ----------------------------------------------------------------------------
  ! TEAMS
  ! ----------------------------------------------------------------------------
  !$omp teams if(.true.)
  !$omp end teams

  !$omp teams if(teams: .true.)
  !$omp end teams

  !ERROR: TARGET is not a constituent of the TEAMS directive
  !$omp teams if(target: .true.)
  !$omp end teams

  !ERROR: At most one IF clause can appear on the TEAMS directive
  !$omp teams if(.true.) if(teams: .false.)
  !$omp end teams

  ! ----------------------------------------------------------------------------
  ! TEAMS DISTRIBUTE
  ! ----------------------------------------------------------------------------
  !$omp teams distribute if(.true.)
  do i = 1, 10
  end do
  !$omp end teams distribute

  !$omp teams distribute if(teams: .true.)
  do i = 1, 10
  end do
  !$omp end teams distribute

  !ERROR: TARGET is not a constituent of the TEAMS DISTRIBUTE directive
  !$omp teams distribute if(target: .true.)
  do i = 1, 10
  end do
  !$omp end teams distribute

  !ERROR: At most one IF clause can appear on the TEAMS DISTRIBUTE directive
  !$omp teams distribute if(.true.) if(teams: .true.)
  do i = 1, 10
  end do
  !$omp end teams distribute

  ! ----------------------------------------------------------------------------
  ! TEAMS DISTRIBUTE PARALLEL DO
  ! ----------------------------------------------------------------------------
  !$omp teams distribute parallel do if(.true.)
  do i = 1, 10
  end do
  !$omp end teams distribute parallel do

  !$omp teams distribute parallel do if(teams: .true.) if(parallel: .false.)
  do i = 1, 10
  end do
  !$omp end teams distribute parallel do

  !ERROR: TARGET is not a constituent of the TEAMS DISTRIBUTE PARALLEL DO directive
  !$omp teams distribute parallel do if(target: .true.)
  do i = 1, 10
  end do
  !$omp end teams distribute parallel do

  ! ----------------------------------------------------------------------------
  ! TEAMS DISTRIBUTE PARALLEL DO SIMD
  ! ----------------------------------------------------------------------------
  !$omp teams distribute parallel do simd if(.true.)
  do i = 1, 10
  end do
  !$omp end teams distribute parallel do simd

  !$omp teams distribute parallel do simd &
  !$omp&   if(teams: .true.) if(parallel: .true.) if(simd: .true.)
  do i = 1, 10
  end do
  !$omp end teams distribute parallel do simd

  !ERROR: TARGET is not a constituent of the TEAMS DISTRIBUTE PARALLEL DO SIMD directive
  !$omp teams distribute parallel do simd if(target: .true.)
  do i = 1, 10
  end do
  !$omp end teams distribute parallel do simd

  ! ----------------------------------------------------------------------------
  ! TEAMS DISTRIBUTE SIMD
  ! ----------------------------------------------------------------------------
  !$omp teams distribute simd if(.true.)
  do i = 1, 10
  end do
  !$omp end teams distribute simd

  !$omp teams distribute simd if(teams: .true.) if(simd: .true.)
  do i = 1, 10
  end do
  !$omp end teams distribute simd

  !ERROR: TARGET is not a constituent of the TEAMS DISTRIBUTE SIMD directive
  !$omp teams distribute simd if(target: .true.)
  do i = 1, 10
  end do
  !$omp end teams distribute simd
end program main