Debian Codegraph @

gcc/testsuite/gfortran.dg/gomp/metadirective-2.f90

raw
1 ! { dg-do compile }
2
3 program main
4 integer, parameter :: N = 100
5 integer :: x = 0
6 integer :: y = 0
7 integer :: i
8
9 ! Test implicit default directive
10 !$omp metadirective &
11 !$omp& when (device={arch("nvptx")}: barrier)
12 x = 1
13
14 ! Test implicit default directive combined with a directive that takes a
15 ! do loop.
16 !$omp metadirective &
17 !$omp& when (device={arch("nvptx")}: parallel do)
18 do i = 1, N
19 x = x + i
20 end do
21
22 ! Test with multiple standalone directives.
23 !$omp metadirective &
24 !$omp& when (device={arch("nvptx")}: barrier) &
25 !$omp& default (flush)
26 x = 1
27
28 ! Test combining a standalone directive with one that takes a do loop.
29 !$omp metadirective &
30 !$omp& when (device={arch("nvptx")}: parallel do) &
31 !$omp& default (barrier)
32 do i = 1, N
33 x = x + i
34 end do
35
36 ! Test combining a directive that takes a do loop with one that takes
37 ! a statement body.
38 !$omp begin metadirective &
39 !$omp& when (device={arch("nvptx")}: parallel do) &
40 !$omp& default (parallel)
41 do i = 1, N
42 x = x + i
43 end do
44 !$omp end metadirective
45
46 ! Test labels in the body.
47 !$omp begin metadirective &
48 !$omp& when (device={arch("nvptx")}: parallel do) &
49 !$omp& when (device={arch("gcn")}: parallel)
50 do i = 1, N
51 x = x + i
52 if (x .gt. N/2) goto 10
53 10 x = x + 1
54 goto 20
55 x = x + 2
56 20 continue
57 end do
58 !$omp end metadirective
59
60 ! Test that commas are permitted before each clause.
61 !$omp begin metadirective, &
62 !$omp& when (device={arch("nvptx")}: parallel do) &
63 !$omp& , when (device={arch("gcn")}: parallel) &
64 !$omp& , default (parallel)
65 do i = 1, N
66 x = x + i
67 end do
68 !$omp end metadirective
69
70 ! Test empty metadirective.
71 !$omp metadirective
72 end program