2
2
! RUN: %flang_fc1 -fdebug-dump-parse-tree -fopenmp -fopenmp-version=52 %s | FileCheck --check-prefix="PARSE-TREE" %s
3
3
4
4
subroutine f00
5
+ continue
5
6
! $omp metadirective when(construct={target, parallel}: nothing)
6
7
end
7
8
8
9
! UNPARSE: SUBROUTINE f00
10
+ ! UNPARSE: CONTINUE
9
11
! UNPARSE: !$OMP METADIRECTIVE WHEN(CONSTRUCT={TARGET, PARALLEL}: NOTHING)
10
12
! UNPARSE: END SUBROUTINE
11
13
@@ -22,10 +24,12 @@ subroutine f00
22
24
! PARSE-TREE: | | | OmpClauseList ->
23
25
24
26
subroutine f01
27
+ continue
25
28
! $omp metadirective when(target_device={kind(host), device_num(1)}: nothing)
26
29
end
27
30
28
31
! UNPARSE: SUBROUTINE f01
32
+ ! UNPARSE: CONTINUE
29
33
! UNPARSE: !$OMP METADIRECTIVE WHEN(TARGET_DEVICE={KIND(host), DEVICE_NUM(1_4)}: NOTHING)
30
34
! UNPARSE: END SUBROUTINE
31
35
@@ -47,10 +51,12 @@ subroutine f01
47
51
! PARSE-TREE: | | | OmpClauseList ->
48
52
49
53
subroutine f02
54
+ continue
50
55
! $omp metadirective when(target_device={kind(any), device_num(7)}: nothing)
51
56
end
52
57
53
58
! UNPARSE: SUBROUTINE f02
59
+ ! UNPARSE: CONTINUE
54
60
! UNPARSE: !$OMP METADIRECTIVE WHEN(TARGET_DEVICE={KIND(any), DEVICE_NUM(7_4)}: NOTHING)
55
61
! UNPARSE: END SUBROUTINE
56
62
@@ -72,11 +78,13 @@ subroutine f02
72
78
! PARSE-TREE: | | | OmpClauseList ->
73
79
74
80
subroutine f03
81
+ continue
75
82
! $omp metadirective &
76
83
! $omp & when(implementation={atomic_default_mem_order(acq_rel)}: nothing)
77
84
end
78
85
79
86
! UNPARSE: SUBROUTINE f03
87
+ ! UNPARSE: CONTINUE
80
88
! UNPARSE: !$OMP METADIRECTIVE WHEN(IMPLEMENTATION={ATOMIC_DEFAULT_MEM_ORDER(ACQ_REL)}: &
81
89
! UNPARSE: !$OMP&NOTHING)
82
90
! UNPARSE: END SUBROUTINE
@@ -94,11 +102,13 @@ subroutine f03
94
102
! PARSE-TREE: | | | OmpClauseList ->
95
103
96
104
subroutine f04
105
+ continue
97
106
! $omp metadirective &
98
107
! $omp when(implementation={extension_trait(haha(1), foo(baz, "bar"(1)))}: nothing)
99
108
end
100
109
101
110
! UNPARSE: SUBROUTINE f04
111
+ ! UNPARSE: CONTINUE
102
112
! UNPARSE: !$OMP METADIRECTIVE WHEN(IMPLEMENTATION={extension_trait(haha(1_4), foo(baz,bar(1_4&
103
113
! UNPARSE: !$OMP&)))}: NOTHING)
104
114
! UNPARSE: END SUBROUTINE
@@ -127,6 +137,7 @@ subroutine f04
127
137
128
138
subroutine f05 (x )
129
139
integer :: x
140
+ continue
130
141
! $omp metadirective &
131
142
! $omp & when(user={condition(score(100): .true.)}: &
132
143
! $omp & parallel do reduction(+: x)) &
@@ -137,6 +148,7 @@ subroutine f05(x)
137
148
138
149
! UNPARSE: SUBROUTINE f05 (x)
139
150
! UNPARSE: INTEGER x
151
+ ! UNPARSE: CONTINUE
140
152
! UNPARSE: !$OMP METADIRECTIVE WHEN(USER={CONDITION(SCORE(100_4): .true._4)}: PARALLEL DO REDUCTION(+&
141
153
! UNPARSE: !$OMP&: x)) OTHERWISE(NOTHING)
142
154
! UNPARSE: DO i=1_4,10_4
@@ -165,13 +177,15 @@ subroutine f05(x)
165
177
! PARSE-TREE: | | OmpClauseList ->
166
178
167
179
subroutine f06
180
+ continue
168
181
! Two trait set selectors
169
182
! $omp metadirective &
170
183
! $omp & when(implementation={vendor("amd")}, &
171
184
! $omp & user={condition(.true.)}: nothing)
172
185
end
173
186
174
187
! UNPARSE: SUBROUTINE f06
188
+ ! UNPARSE: CONTINUE
175
189
! UNPARSE: !$OMP METADIRECTIVE WHEN(IMPLEMENTATION={VENDOR(amd)}, USER={CONDITION(.true._4)}: NO&
176
190
! UNPARSE: !$OMP&THING)
177
191
! UNPARSE: END SUBROUTINE
@@ -196,3 +210,42 @@ subroutine f06
196
210
! PARSE-TREE: | | | llvm::omp::Directive = nothing
197
211
! PARSE-TREE: | | | OmpClauseList ->
198
212
213
+ subroutine f07
214
+ ! Declarative metadirective
215
+ ! $omp metadirective &
216
+ ! $omp & when(implementation={vendor("amd")}: declare simd) &
217
+ ! $omp & when(user={condition(.true.)}: declare target) &
218
+ ! $omp & otherwise(nothing)
219
+ end
220
+
221
+ ! UNPARSE: SUBROUTINE f07
222
+ ! UNPARSE: !$OMP METADIRECTIVE WHEN(IMPLEMENTATION={VENDOR(amd)}: DECLARE SIMD) WHEN(USE&
223
+ ! UNPARSE: !$OMP&R={CONDITION(.true._4)}: DECLARE TARGET) OTHERWISE(NOTHING)
224
+ ! UNPARSE: END SUBROUTINE
225
+
226
+ ! PARSE-TREE: OpenMPDeclarativeConstruct -> OmpMetadirectiveDirective
227
+ ! PARSE-TREE: | OmpClauseList -> OmpClause -> When -> OmpWhenClause
228
+ ! PARSE-TREE: | | Modifier -> OmpContextSelectorSpecification -> OmpTraitSetSelector
229
+ ! PARSE-TREE: | | | OmpTraitSetSelectorName -> Value = Implementation
230
+ ! PARSE-TREE: | | | OmpTraitSelector
231
+ ! PARSE-TREE: | | | | OmpTraitSelectorName -> Value = Vendor
232
+ ! PARSE-TREE: | | | | Properties
233
+ ! PARSE-TREE: | | | | | OmpTraitProperty -> OmpTraitPropertyName -> string = 'amd'
234
+ ! PARSE-TREE: | | OmpDirectiveSpecification
235
+ ! PARSE-TREE: | | | llvm::omp::Directive = declare simd
236
+ ! PARSE-TREE: | | | OmpClauseList ->
237
+ ! PARSE-TREE: | OmpClause -> When -> OmpWhenClause
238
+ ! PARSE-TREE: | | Modifier -> OmpContextSelectorSpecification -> OmpTraitSetSelector
239
+ ! PARSE-TREE: | | | OmpTraitSetSelectorName -> Value = User
240
+ ! PARSE-TREE: | | | OmpTraitSelector
241
+ ! PARSE-TREE: | | | | OmpTraitSelectorName -> Value = Condition
242
+ ! PARSE-TREE: | | | | Properties
243
+ ! PARSE-TREE: | | | | | OmpTraitProperty -> Scalar -> Expr = '.true._4'
244
+ ! PARSE-TREE: | | | | | | LiteralConstant -> LogicalLiteralConstant
245
+ ! PARSE-TREE: | | | | | | | bool = 'true'
246
+ ! PARSE-TREE: | | OmpDirectiveSpecification
247
+ ! PARSE-TREE: | | | llvm::omp::Directive = declare target
248
+ ! PARSE-TREE: | | | OmpClauseList ->
249
+ ! PARSE-TREE: | OmpClause -> Otherwise -> OmpOtherwiseClause -> OmpDirectiveSpecification
250
+ ! PARSE-TREE: | | llvm::omp::Directive = nothing
251
+ ! PARSE-TREE: | | OmpClauseList ->
0 commit comments