[AArch64] Fix brackets warning in assert. NFC
[llvm-project.git] / flang / test / Semantics / OpenACC / acc-kernels-loop.f90
blob8653978fb6249db81ea337f28bcb04256849c95c
1 ! RUN: %python %S/../test_errors.py %s %flang -fopenacc
3 ! Check OpenACC clause validity for the following construct and directive:
4 ! 2.11 Kernels Loop
6 program openacc_kernels_loop_validity
8 implicit none
10 type atype
11 real(8), dimension(10) :: arr
12 real(8) :: s
13 end type atype
15 integer :: i, j, b, gang_size, vector_size, worker_size
16 integer, parameter :: N = 256
17 integer, dimension(N) :: c
18 logical, dimension(N) :: d, e
19 integer :: async1
20 integer :: wait1, wait2
21 real :: reduction_r
22 logical :: reduction_l
23 real(8), dimension(N, N) :: aa, bb, cc
24 real(8), dimension(:), allocatable :: dd
25 real(8), pointer :: p
26 logical :: ifCondition = .TRUE.
27 type(atype) :: t
28 type(atype), dimension(10) :: ta
30 real(8), dimension(N) :: a, f, g, h
32 !$acc kernels loop
33 do i = 1, N
34 a(i) = 3.14
35 end do
37 !$acc kernels loop
38 do i = 1, N
39 a(i) = 3.14
40 end do
41 !$acc end kernels loop
43 !$acc kernels loop
44 do i = 1, N
45 a(i) = 3.14
46 end do
47 !$acc end kernels loop
49 !$acc kernels loop num_gangs(8)
50 do i = 1, N
51 a(i) = 3.14
52 end do
54 !$acc kernels loop num_gangs(gang_size)
55 do i = 1, N
56 a(i) = 3.14
57 end do
59 !$acc kernels loop num_gangs(8)
60 do i = 1, N
61 a(i) = 3.14
62 end do
64 !$acc kernels loop num_workers(worker_size)
65 do i = 1, N
66 a(i) = 3.14
67 end do
69 !$acc kernels loop num_workers(8)
70 do i = 1, N
71 a(i) = 3.14
72 end do
74 !$acc kernels loop vector_length(vector_size)
75 do i = 1, N
76 a(i) = 3.14
77 end do
79 !$acc kernels loop vector_length(128)
80 do i = 1, N
81 a(i) = 3.14
82 end do
84 !$acc kernels loop num_gangs(gang_size)
85 do i = 1, N
86 a(i) = 3.14
87 end do
90 !$acc kernels loop if(.TRUE.)
91 do i = 1, N
92 a(i) = 3.14
93 end do
95 !$acc kernels loop if(ifCondition)
96 do i = 1, N
97 a(i) = 3.14
98 end do
100 !$acc kernels loop
101 do i = 1, N
102 a(i) = 3.14
103 end do
104 !ERROR: Unmatched END SERIAL LOOP directive
105 !$acc end serial loop
107 !ERROR: Clause IF is not allowed after clause DEVICE_TYPE on the KERNELS LOOP directive
108 !$acc kernels loop device_type(*) if(.TRUE.)
109 do i = 1, N
110 a(i) = 3.14
111 end do
112 !$acc end kernels loop
114 !$acc kernels loop async
115 do i = 1, N
116 a(i) = 3.14
117 end do
119 !$acc kernels loop async(1)
120 do i = 1, N
121 a(i) = 3.14
122 end do
124 !$acc kernels loop async(async1)
125 do i = 1, N
126 a(i) = 3.14
127 end do
129 !$acc kernels loop wait(wait1)
130 do i = 1, N
131 a(i) = 3.14
132 end do
134 !$acc kernels loop wait(wait1, wait2)
135 do i = 1, N
136 a(i) = 3.14
137 end do
139 !$acc kernels loop wait(wait1) wait(wait2)
140 do i = 1, N
141 a(i) = 3.14
142 end do
144 !$acc kernels loop wait(1, 2) async(3)
145 do i = 1, N
146 a(i) = 3.14
147 end do
149 !$acc kernels loop wait(queues: 1, 2) async(3)
150 do i = 1, N
151 a(i) = 3.14
152 end do
154 !$acc kernels loop wait(devnum: 1: 1, 2) async(3)
155 do i = 1, N
156 a(i) = 3.14
157 end do
159 !$acc kernels loop wait(devnum: 1: queues: 1, 2) async(3)
160 do i = 1, N
161 a(i) = 3.14
162 end do
164 !$acc kernels loop num_gangs(8)
165 do i = 1, N
166 a(i) = 3.14
167 end do
169 !$acc kernels loop num_workers(8)
170 do i = 1, N
171 a(i) = 3.14
172 end do
174 !$acc kernels loop vector_length(128)
175 do i = 1, N
176 a(i) = 3.14
177 end do
179 !$acc kernels loop if(.true.)
180 do i = 1, N
181 a(i) = 3.14
182 end do
184 !$acc kernels loop if(ifCondition)
185 do i = 1, N
186 a(i) = 3.14
187 end do
189 !ERROR: At most one IF clause can appear on the KERNELS LOOP directive
190 !$acc kernels loop if(.true.) if(ifCondition)
191 do i = 1, N
192 a(i) = 3.14
193 end do
195 !$acc kernels loop self
196 do i = 1, N
197 a(i) = 3.14
198 end do
200 !$acc kernels loop self(.true.)
201 do i = 1, N
202 a(i) = 3.14
203 end do
205 !$acc kernels loop self(ifCondition)
206 do i = 1, N
207 a(i) = 3.14
208 end do
210 !$acc kernels loop copy(aa) copyin(bb) copyout(cc)
211 do i = 1, N
212 a(i) = 3.14
213 end do
215 !$acc kernels loop copy(aa, bb) copyout(zero: cc)
216 do i = 1, N
217 a(i) = 3.14
218 end do
220 !$acc kernels loop present(aa, bb) create(cc)
221 do i = 1, N
222 a(i) = 3.14
223 end do
225 !$acc kernels loop copyin(readonly: aa, bb) create(zero: cc)
226 do i = 1, N
227 a(i) = 3.14
228 end do
230 !$acc kernels loop deviceptr(aa, bb) no_create(cc)
231 do i = 1, N
232 a(i) = 3.14
233 end do
235 !ERROR: Argument `aa` on the ATTACH clause must be a variable or array with the POINTER or ALLOCATABLE attribute
236 !$acc kernels loop attach(aa, dd, p)
237 do i = 1, N
238 a(i) = 3.14
239 end do
241 !$acc kernels loop private(aa, bb, cc)
242 do i = 1, N
243 a(i) = 3.14
244 end do
246 !$acc kernels loop default(none)
247 do i = 1, N
248 a(i) = 3.14
249 end do
251 !$acc kernels loop default(present)
252 do i = 1, N
253 a(i) = 3.14
254 end do
256 !ERROR: At most one DEFAULT clause can appear on the KERNELS LOOP directive
257 !$acc kernels loop default(none) default(present)
258 do i = 1, N
259 a(i) = 3.14
260 end do
262 !$acc kernels loop device_type(*)
263 do i = 1, N
264 a(i) = 3.14
265 end do
267 !$acc kernels loop device_type(multicore)
268 do i = 1, N
269 a(i) = 3.14
270 end do
272 !$acc kernels loop device_type(host, multicore)
273 do i = 1, N
274 a(i) = 3.14
275 end do
277 !$acc kernels loop device_type(*) async wait num_gangs(8) num_workers(8) vector_length(128)
278 do i = 1, N
279 a(i) = 3.14
280 end do
282 !$acc kernels loop device_type(*) async
283 do i = 1, N
284 a(i) = 3.14
285 end do
287 !ERROR: Clause IF is not allowed after clause DEVICE_TYPE on the KERNELS LOOP directive
288 !$acc kernels loop device_type(*) if(.TRUE.)
289 do i = 1, N
290 a(i) = 3.14
291 end do
293 !$acc parallel loop
294 do i = 1, N
295 if(i == 10) cycle
296 end do
298 end program openacc_kernels_loop_validity