]> git.ipfire.org Git - thirdparty/gcc.git/blame - libgomp/testsuite/libgomp.oacc-fortran/if-1.f90
Merge remote-tracking branch 'origin/master' into devel/c++-contracts
[thirdparty/gcc.git] / libgomp / testsuite / libgomp.oacc-fortran / if-1.f90
CommitLineData
2620c80d
TS
1! { dg-do run }
2! { dg-additional-options "-cpp" }
3
c43cb355
TS
4! { dg-additional-options "--param=openacc-kernels=decompose" }
5
11b8286a 6! { dg-additional-options "-fopt-info-note-omp" }
11b8286a 7! { dg-additional-options "-foffload=-fopt-info-note-omp" }
004fc4f2
TS
8
9! { dg-additional-options "--param=openacc-privatization=noisy" }
11b8286a 10! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
004fc4f2
TS
11! Prune a few: uninteresting, and potentially varying depending on GCC configuration (data types):
12! { dg-prune-output {note: variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} }
11b8286a
TS
13
14! It's only with Tcl 8.5 (released in 2007) that "the variable 'varName'
15! passed to 'incr' may be unset, and in that case, it will be set to [...]",
16! so to maintain compatibility with earlier Tcl releases, we manually
17! initialize counter variables:
18! { dg-line l_dummy[variable c_compute 0] }
19! { dg-message "dummy" "" { target iN-VAl-Id } l_dummy } to avoid
20! "WARNING: dg-line var l_dummy defined, but not used". */
21
2620c80d
TS
22program main
23 use openacc
24 implicit none
25
26 integer, parameter :: N = 8
27 integer, parameter :: one = 1
28 integer, parameter :: zero = 0
29 integer i, nn
30 real, allocatable :: a(:), b(:)
31 real exp, exp2
32
33 i = 0
34
35 allocate (a(N))
36 allocate (b(N))
37
38 a(:) = 4.0
39
11b8286a 40 !$acc parallel copyin (a(1:N)) copyout (b(1:N)) if (1 == 1) ! { dg-line l_compute[incr c_compute] }
2620c80d 41 do i = 1, N
11b8286a
TS
42 ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
43 !TODO Unhandled 'CONST_DECL' instances for constant argument in 'acc_on_device' call.
2620c80d
TS
44 if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
45 b(i) = a(i) + 1
46 else
47 b(i) = a(i)
48 end if
49 end do
50 !$acc end parallel
51
52#if ACC_MEM_SHARED
53 exp = 5.0
54#else
55 exp = 4.0
56#endif
57
58 do i = 1, N
bfc24e32 59 if (b(i) .ne. exp) STOP 1
2620c80d
TS
60 end do
61
62 a(:) = 16.0
63
11b8286a 64 !$acc parallel if (0 == 1) ! { dg-line l_compute[incr c_compute] }
2620c80d 65 do i = 1, N
11b8286a 66 ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
2620c80d
TS
67 if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
68 b(i) = a(i) + 1
69 else
70 b(i) = a(i)
71 end if
72 end do
73 !$acc end parallel
74
75 do i = 1, N
bfc24e32 76 if (b(i) .ne. 17.0) STOP 2
2620c80d
TS
77 end do
78
79 a(:) = 8.0
80
11b8286a 81 !$acc parallel copyin (a(1:N)) copyout (b(1:N)) if (one == 1) ! { dg-line l_compute[incr c_compute] }
2620c80d 82 do i = 1, N
11b8286a 83 ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
2620c80d
TS
84 if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
85 b(i) = a(i) + 1
86 else
87 b(i) = a(i)
88 end if
89 end do
90 !$acc end parallel
91
92#if ACC_MEM_SHARED
93 exp = 9.0
94#else
95 exp = 8.0
96#endif
97
98 do i = 1, N
bfc24e32 99 if (b(i) .ne. exp) STOP 3
2620c80d
TS
100 end do
101
102 a(:) = 22.0
103
11b8286a 104 !$acc parallel if (zero == 1) ! { dg-line l_compute[incr c_compute] }
2620c80d 105 do i = 1, N
11b8286a 106 ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
2620c80d
TS
107 if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
108 b(i) = a(i) + 1
109 else
110 b(i) = a(i)
111 end if
112 end do
113 !$acc end parallel
114
115 do i = 1, N
bfc24e32 116 if (b(i) .ne. 23.0) STOP 4
2620c80d
TS
117 end do
118
119 a(:) = 16.0
120
11b8286a 121 !$acc parallel copyin (a(1:N)) copyout (b(1:N)) if (.TRUE.) ! { dg-line l_compute[incr c_compute] }
2620c80d 122 do i = 1, N
11b8286a 123 ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
2620c80d
TS
124 if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
125 b(i) = a(i) + 1
126 else
127 b(i) = a(i)
128 end if
129 end do
130 !$acc end parallel
131
132#if ACC_MEM_SHARED
133 exp = 17.0;
134#else
135 exp = 16.0;
136#endif
137
138 do i = 1, N
bfc24e32 139 if (b(i) .ne. exp) STOP 5
2620c80d
TS
140 end do
141
142 a(:) = 76.0
143
11b8286a 144 !$acc parallel if (.FALSE.) ! { dg-line l_compute[incr c_compute] }
2620c80d 145 do i = 1, N
11b8286a 146 ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
2620c80d
TS
147 if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
148 b(i) = a(i) + 1
149 else
150 b(i) = a(i)
151 end if
152 end do
153 !$acc end parallel
154
155 do i = 1, N
bfc24e32 156 if (b(i) .ne. 77.0) STOP 6
2620c80d
TS
157 end do
158
159 a(:) = 22.0
160
161 nn = 1
162
11b8286a 163 !$acc parallel copyin (a(1:N)) copyout (b(1:N)) if (nn == 1) ! { dg-line l_compute[incr c_compute] }
2620c80d 164 do i = 1, N
11b8286a 165 ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
2620c80d
TS
166 if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
167 b(i) = a(i) + 1
168 else
169 b(i) = a(i)
170 end if
171 end do
172 !$acc end parallel
173
174#if ACC_MEM_SHARED
175 exp = 23.0;
176#else
177 exp = 22.0;
178#endif
179
180 do i = 1, N
bfc24e32 181 if (b(i) .ne. exp) STOP 7
2620c80d
TS
182 end do
183
184 a(:) = 18.0
185
186 nn = 0
187
11b8286a 188 !$acc parallel if (nn == 1) ! { dg-line l_compute[incr c_compute] }
2620c80d 189 do i = 1, N
11b8286a 190 ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
2620c80d
TS
191 if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
192 b(i) = a(i) + 1
193 else
194 b(i) = a(i)
195 end if
196 end do
197 !$acc end parallel
198
199 do i = 1, N
bfc24e32 200 if (b(i) .ne. 19.0) STOP 8
2620c80d
TS
201 end do
202
203 a(:) = 49.0
204
205 nn = 1
206
11b8286a 207 !$acc parallel copyin (a(1:N)) copyout (b(1:N)) if ((nn + nn) > 0) ! { dg-line l_compute[incr c_compute] }
2620c80d 208 do i = 1, N
11b8286a 209 ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
2620c80d
TS
210 if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
211 b(i) = a(i) + 1
212 else
213 b(i) = a(i)
214 end if
215 end do
216 !$acc end parallel
217
218#if ACC_MEM_SHARED
219 exp = 50.0
220#else
221 exp = 49.0
222#endif
223
224 do i = 1, N
bfc24e32 225 if (b(i) .ne. exp) STOP 9
2620c80d
TS
226 end do
227
228 a(:) = 38.0
229
230 nn = 0;
231
11b8286a 232 !$acc parallel copyin (a(1:N)) copyout (b(1:N)) if ((nn + nn) > 0) ! { dg-line l_compute[incr c_compute] }
2620c80d 233 do i = 1, N
11b8286a 234 ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
2620c80d
TS
235 if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
236 b(i) = a(i) + 1
237 else
238 b(i) = a(i)
239 end if
240 end do
241 !$acc end parallel
242
243 do i = 1, N
bfc24e32 244 if (b(i) .ne. 39.0) STOP 10
2620c80d
TS
245 end do
246
247 a(:) = 91.0
248
11b8286a 249 !$acc parallel copyin (a(1:N)) copyout (b(1:N)) if (-2 > 0) ! { dg-line l_compute[incr c_compute] }
2620c80d 250 do i = 1, N
11b8286a 251 ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
2620c80d
TS
252 if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
253 b(i) = a(i) + 1
254 else
255 b(i) = a(i)
256 end if
257 end do
258 !$acc end parallel
259
260 do i = 1, N
bfc24e32 261 if (b(i) .ne. 92.0) STOP 11
2620c80d
TS
262 end do
263
264 a(:) = 43.0
265
11b8286a 266 !$acc parallel copyin (a(1:N)) copyout (b(1:N)) if (one == 1) ! { dg-line l_compute[incr c_compute] }
2620c80d 267 do i = 1, N
11b8286a 268 ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
2620c80d
TS
269 if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
270 b(i) = a(i) + 1
271 else
272 b(i) = a(i)
273 end if
274 end do
275 !$acc end parallel
276
277#if ACC_MEM_SHARED
278 exp = 44.0
279#else
280 exp = 43.0
281#endif
282
283 do i = 1, N
bfc24e32 284 if (b(i) .ne. exp) STOP 12
2620c80d
TS
285 end do
286
287 a(:) = 87.0
288
11b8286a 289 !$acc parallel if (one == 0) ! { dg-line l_compute[incr c_compute] }
2620c80d 290 do i = 1, N
11b8286a 291 ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
2620c80d
TS
292 if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
293 b(i) = a(i) + 1
294 else
295 b(i) = a(i)
296 end if
297 end do
298 !$acc end parallel
299
300 do i = 1, N
bfc24e32 301 if (b(i) .ne. 88.0) STOP 13
2620c80d
TS
302 end do
303
304 a(:) = 3.0
305 b(:) = 9.0
306
307#if ACC_MEM_SHARED
308 exp = 0.0
309 exp2 = 0.0
310#else
311 call acc_copyin (a, sizeof (a))
312 call acc_copyin (b, sizeof (b))
313 exp = 3.0;
314 exp2 = 9.0;
315#endif
316
317 !$acc update device (a(1:N), b(1:N)) if (1 == 1)
318
319 a(:) = 0.0
320 b(:) = 0.0
321
322 !$acc update host (a(1:N), b(1:N)) if (1 == 1)
323
324 do i = 1, N
bfc24e32
TK
325 if (a(i) .ne. exp) STOP 14
326 if (b(i) .ne. exp2) STOP 15
2620c80d
TS
327 end do
328
329 a(:) = 6.0
330 b(:) = 12.0
331
332 !$acc update device (a(1:N), b(1:N)) if (0 == 1)
333
334 a(:) = 0.0
335 b(:) = 0.0
336
337 !$acc update host (a(1:N), b(1:N)) if (1 == 1)
338
339 do i = 1, N
bfc24e32
TK
340 if (a(i) .ne. exp) STOP 16
341 if (b(i) .ne. exp2) STOP 17
2620c80d
TS
342 end do
343
344 a(:) = 26.0
345 b(:) = 21.0
346
347 !$acc update device (a(1:N), b(1:N)) if (1 == 1)
348
349 a(:) = 0.0
350 b(:) = 0.0
351
352 !$acc update host (a(1:N), b(1:N)) if (0 == 1)
353
354 do i = 1, N
bfc24e32
TK
355 if (a(i) .ne. 0.0) STOP 18
356 if (b(i) .ne. 0.0) STOP 19
2620c80d
TS
357 end do
358
359#if !ACC_MEM_SHARED
360 call acc_copyout (a, sizeof (a))
361 call acc_copyout (b, sizeof (b))
362#endif
363
364 a(:) = 4.0
365 b(:) = 0.0
366
367 !$acc data copyin (a(1:N)) copyout (b(1:N)) if (1 == 1)
004fc4f2 368 ! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
2620c80d 369
004fc4f2 370 !$acc parallel present (a(1:N))
2620c80d
TS
371 do i = 1, N
372 b(i) = a(i)
373 end do
374 !$acc end parallel
375 !$acc end data
376
377 do i = 1, N
bfc24e32 378 if (b(i) .ne. 4.0) STOP 20
2620c80d
TS
379 end do
380
381 a(:) = 8.0
382 b(:) = 1.0
383
384 !$acc data copyin (a(1:N)) copyout (b(1:N)) if (0 == 1)
11e811d8 385 ! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: artificial} "" { target { ! openacc_host_selected } } .-1 }
2620c80d
TS
386
387#if !ACC_MEM_SHARED
bfc24e32
TK
388 if (acc_is_present (a) .eqv. .TRUE.) STOP 21
389 if (acc_is_present (b) .eqv. .TRUE.) STOP 22
2620c80d
TS
390#endif
391
392 !$acc end data
393
394 a(:) = 18.0
395 b(:) = 21.0
396
397 !$acc data copyin (a(1:N)) if (1 == 1)
004fc4f2 398 ! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
11e811d8 399 ! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: artificial} "" { target { ! openacc_host_selected } } .-2 }
2620c80d
TS
400
401#if !ACC_MEM_SHARED
bfc24e32 402 if (acc_is_present (a) .eqv. .FALSE.) STOP 23
2620c80d
TS
403#endif
404
405 !$acc data copyout (b(1:N)) if (0 == 1)
004fc4f2 406 ! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
11e811d8 407 ! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: artificial} "" { target { ! openacc_host_selected } } .-2 }
2620c80d 408#if !ACC_MEM_SHARED
bfc24e32 409 if (acc_is_present (b) .eqv. .TRUE.) STOP 24
2620c80d
TS
410#endif
411 !$acc data copyout (b(1:N)) if (1 == 1)
004fc4f2 412 ! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
2620c80d 413
004fc4f2 414 !$acc parallel present (a(1:N)) present (b(1:N))
2620c80d
TS
415 do i = 1, N
416 b(i) = a(i)
417 end do
418 !$acc end parallel
419
420 !$acc end data
421
422#if !ACC_MEM_SHARED
bfc24e32 423 if (acc_is_present (b) .eqv. .TRUE.) STOP 25
2620c80d
TS
424#endif
425 !$acc end data
426 !$acc end data
427
428 do i = 1, N
bfc24e32 429 if (b(1) .ne. 18.0) STOP 26
2620c80d
TS
430 end do
431
432 !$acc enter data copyin (b(1:N)) if (0 == 1)
433
434#if !ACC_MEM_SHARED
bfc24e32 435 if (acc_is_present (b) .eqv. .TRUE.) STOP 27
2620c80d
TS
436#endif
437
438 !$acc exit data delete (b(1:N)) if (0 == 1)
439
440 !$acc enter data copyin (b(1:N)) if (1 == 1)
441
442#if !ACC_MEM_SHARED
bfc24e32 443 if (acc_is_present (b) .eqv. .FALSE.) STOP 28
2620c80d
TS
444#endif
445
446 !$acc exit data delete (b(1:N)) if (1 == 1)
447
448#if !ACC_MEM_SHARED
bfc24e32 449 if (acc_is_present (b) .eqv. .TRUE.) STOP 29
2620c80d
TS
450#endif
451
452 !$acc enter data copyin (b(1:N)) if (zero == 1)
453
454#if !ACC_MEM_SHARED
bfc24e32 455 if (acc_is_present (b) .eqv. .TRUE.) STOP 30
2620c80d
TS
456#endif
457
458 !$acc exit data delete (b(1:N)) if (zero == 1)
459
460 !$acc enter data copyin (b(1:N)) if (one == 1)
461
462#if !ACC_MEM_SHARED
bfc24e32 463 if (acc_is_present (b) .eqv. .FALSE.) STOP 31
2620c80d
TS
464#endif
465
466 !$acc exit data delete (b(1:N)) if (one == 1)
467
468#if !ACC_MEM_SHARED
bfc24e32 469 if (acc_is_present (b) .eqv. .TRUE.) STOP 32
2620c80d
TS
470#endif
471
472 !$acc enter data copyin (b(1:N)) if (one == 0)
473
474#if !ACC_MEM_SHARED
bfc24e32 475 if (acc_is_present (b) .eqv. .TRUE.) STOP 33
2620c80d
TS
476#endif
477
478 !$acc exit data delete (b(1:N)) if (one == 0)
479
480 !$acc enter data copyin (b(1:N)) if (one == 1)
481
482#if !ACC_MEM_SHARED
bfc24e32 483 if (acc_is_present (b) .eqv. .FALSE.) STOP 34
2620c80d
TS
484#endif
485
486 !$acc exit data delete (b(1:N)) if (one == 1)
487
488#if !ACC_MEM_SHARED
bfc24e32 489 if (acc_is_present (b) .eqv. .TRUE.) STOP 35
2620c80d
TS
490#endif
491
492 a(:) = 4.0
493
11b8286a 494 !$acc kernels copyin (a(1:N)) copyout (b(1:N)) if (1 == 1) ! { dg-line l_compute[incr c_compute] }
c43cb355
TS
495 ! { dg-note {OpenACC 'kernels' decomposition: variable 'i' in 'copy' clause requested to be made addressable} {} { target *-*-* } l_compute$c_compute }
496 ! { dg-note {variable 'i' made addressable} {} { target *-*-* } l_compute$c_compute } */
497 ! { dg-note {beginning 'parloops' part in OpenACC 'kernels' region} "" { target *-*-* } .+1 }
2620c80d 498 do i = 1, N
11b8286a 499 ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
2620c80d
TS
500 if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
501 b(i) = a(i) + 1
502 else
503 b(i) = a(i)
504 end if
505 end do
506 !$acc end kernels
507
508#if ACC_MEM_SHARED
509 exp = 5.0
510#else
511 exp = 4.0
512#endif
513
514 do i = 1, N
bfc24e32 515 if (b(i) .ne. exp) STOP 36
2620c80d
TS
516 end do
517
518 a(:) = 16.0
519
11b8286a 520 !$acc kernels if (0 == 1) ! { dg-line l_compute[incr c_compute] }
c43cb355
TS
521 ! { dg-note {OpenACC 'kernels' decomposition: variable 'i' in 'copy' clause requested to be made addressable} {} { target *-*-* } l_compute$c_compute }
522 ! { dg-note {variable 'i' already made addressable} {} { target *-*-* } l_compute$c_compute } */
523 ! { dg-note {beginning 'parloops' part in OpenACC 'kernels' region} "" { target *-*-* } .+1 }
2620c80d 524 do i = 1, N
11b8286a 525 ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
2620c80d
TS
526 if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
527 b(i) = a(i) + 1
528 else
529 b(i) = a(i)
530 end if
531 end do
532 !$acc end kernels
533
534 do i = 1, N
bfc24e32 535 if (b(i) .ne. 17.0) STOP 37
2620c80d
TS
536 end do
537
538 a(:) = 8.0
539
11b8286a 540 !$acc kernels copyin (a(1:N)) copyout (b(1:N)) if (one == 1) ! { dg-line l_compute[incr c_compute] }
c43cb355
TS
541 ! { dg-note {OpenACC 'kernels' decomposition: variable 'i' in 'copy' clause requested to be made addressable} {} { target *-*-* } l_compute$c_compute }
542 ! { dg-note {variable 'i' already made addressable} {} { target *-*-* } l_compute$c_compute } */
543 ! { dg-note {beginning 'parloops' part in OpenACC 'kernels' region} "" { target *-*-* } .+1 }
2620c80d 544 do i = 1, N
11b8286a 545 ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
2620c80d
TS
546 if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
547 b(i) = a(i) + 1
548 else
549 b(i) = a(i)
550 end if
551 end do
552 !$acc end kernels
553
554#if ACC_MEM_SHARED
555 exp = 9.0
556#else
557 exp = 8.0
558#endif
559
560 do i = 1, N
bfc24e32 561 if (b(i) .ne. exp) STOP 38
2620c80d
TS
562 end do
563
564 a(:) = 22.0
565
11b8286a 566 !$acc kernels if (zero == 1) ! { dg-line l_compute[incr c_compute] }
c43cb355
TS
567 ! { dg-note {OpenACC 'kernels' decomposition: variable 'i' in 'copy' clause requested to be made addressable} {} { target *-*-* } l_compute$c_compute }
568 ! { dg-note {variable 'i' already made addressable} {} { target *-*-* } l_compute$c_compute } */
569 ! { dg-note {beginning 'parloops' part in OpenACC 'kernels' region} "" { target *-*-* } .+1 }
2620c80d 570 do i = 1, N
11b8286a 571 ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
2620c80d
TS
572 if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
573 b(i) = a(i) + 1
574 else
575 b(i) = a(i)
576 end if
577 end do
578 !$acc end kernels
579
580 do i = 1, N
bfc24e32 581 if (b(i) .ne. 23.0) STOP 39
2620c80d
TS
582 end do
583
584 a(:) = 16.0
585
11b8286a 586 !$acc kernels copyin (a(1:N)) copyout (b(1:N)) if (.TRUE.) ! { dg-line l_compute[incr c_compute] }
c43cb355
TS
587 ! { dg-note {OpenACC 'kernels' decomposition: variable 'i' in 'copy' clause requested to be made addressable} {} { target *-*-* } l_compute$c_compute }
588 ! { dg-note {variable 'i' already made addressable} {} { target *-*-* } l_compute$c_compute } */
589 ! { dg-note {beginning 'parloops' part in OpenACC 'kernels' region} "" { target *-*-* } .+1 }
2620c80d 590 do i = 1, N
11b8286a 591 ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
2620c80d
TS
592 if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
593 b(i) = a(i) + 1
594 else
595 b(i) = a(i)
596 end if
597 end do
598 !$acc end kernels
599
600#if ACC_MEM_SHARED
601 exp = 17.0;
602#else
603 exp = 16.0;
604#endif
605
606 do i = 1, N
bfc24e32 607 if (b(i) .ne. exp) STOP 40
2620c80d
TS
608 end do
609
610 a(:) = 76.0
611
11b8286a 612 !$acc kernels if (.FALSE.) ! { dg-line l_compute[incr c_compute] }
c43cb355
TS
613 ! { dg-note {OpenACC 'kernels' decomposition: variable 'i' in 'copy' clause requested to be made addressable} {} { target *-*-* } l_compute$c_compute }
614 ! { dg-note {variable 'i' already made addressable} {} { target *-*-* } l_compute$c_compute } */
615 ! { dg-note {beginning 'parloops' part in OpenACC 'kernels' region} "" { target *-*-* } .+1 }
2620c80d 616 do i = 1, N
11b8286a 617 ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
2620c80d
TS
618 if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
619 b(i) = a(i) + 1
620 else
621 b(i) = a(i)
622 end if
623 end do
624 !$acc end kernels
625
626 do i = 1, N
bfc24e32 627 if (b(i) .ne. 77.0) STOP 41
2620c80d
TS
628 end do
629
630 a(:) = 22.0
631
632 nn = 1
633
11b8286a 634 !$acc kernels copyin (a(1:N)) copyout (b(1:N)) if (nn == 1) ! { dg-line l_compute[incr c_compute] }
c43cb355
TS
635 ! { dg-note {OpenACC 'kernels' decomposition: variable 'i' in 'copy' clause requested to be made addressable} {} { target *-*-* } l_compute$c_compute }
636 ! { dg-note {variable 'i' already made addressable} {} { target *-*-* } l_compute$c_compute } */
637 ! { dg-note {beginning 'parloops' part in OpenACC 'kernels' region} "" { target *-*-* } .+1 }
2620c80d 638 do i = 1, N
11b8286a 639 ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
2620c80d
TS
640 if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
641 b(i) = a(i) + 1
642 else
643 b(i) = a(i)
644 end if
645 end do
646 !$acc end kernels
647
648#if ACC_MEM_SHARED
649 exp = 23.0;
650#else
651 exp = 22.0;
652#endif
653
654 do i = 1, N
bfc24e32 655 if (b(i) .ne. exp) STOP 42
2620c80d
TS
656 end do
657
658 a(:) = 18.0
659
660 nn = 0
661
11b8286a 662 !$acc kernels if (nn == 1) ! { dg-line l_compute[incr c_compute] }
c43cb355
TS
663 ! { dg-note {OpenACC 'kernels' decomposition: variable 'i' in 'copy' clause requested to be made addressable} {} { target *-*-* } l_compute$c_compute }
664 ! { dg-note {variable 'i' already made addressable} {} { target *-*-* } l_compute$c_compute } */
665 ! { dg-note {beginning 'parloops' part in OpenACC 'kernels' region} "" { target *-*-* } .+1 }
2620c80d 666 do i = 1, N
11b8286a 667 ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
2620c80d
TS
668 if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
669 b(i) = a(i) + 1
670 else
671 b(i) = a(i)
672 end if
673 end do
674 !$acc end kernels
675
676 do i = 1, N
bfc24e32 677 if (b(i) .ne. 19.0) STOP 43
2620c80d
TS
678 end do
679
680 a(:) = 49.0
681
682 nn = 1
683
11b8286a 684 !$acc kernels copyin (a(1:N)) copyout (b(1:N)) if ((nn + nn) > 0) ! { dg-line l_compute[incr c_compute] }
c43cb355
TS
685 ! { dg-note {OpenACC 'kernels' decomposition: variable 'i' in 'copy' clause requested to be made addressable} {} { target *-*-* } l_compute$c_compute }
686 ! { dg-note {variable 'i' already made addressable} {} { target *-*-* } l_compute$c_compute } */
687 ! { dg-note {beginning 'parloops' part in OpenACC 'kernels' region} "" { target *-*-* } .+1 }
2620c80d 688 do i = 1, N
11b8286a 689 ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
2620c80d
TS
690 if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
691 b(i) = a(i) + 1
692 else
693 b(i) = a(i)
694 end if
695 end do
696 !$acc end kernels
697
698#if ACC_MEM_SHARED
699 exp = 50.0
700#else
701 exp = 49.0
702#endif
703
704 do i = 1, N
bfc24e32 705 if (b(i) .ne. exp) STOP 44
2620c80d
TS
706 end do
707
708 a(:) = 38.0
709
710 nn = 0;
711
11b8286a 712 !$acc kernels copyin (a(1:N)) copyout (b(1:N)) if ((nn + nn) > 0) ! { dg-line l_compute[incr c_compute] }
c43cb355
TS
713 ! { dg-note {OpenACC 'kernels' decomposition: variable 'i' in 'copy' clause requested to be made addressable} {} { target *-*-* } l_compute$c_compute }
714 ! { dg-note {variable 'i' already made addressable} {} { target *-*-* } l_compute$c_compute } */
715 ! { dg-note {beginning 'parloops' part in OpenACC 'kernels' region} "" { target *-*-* } .+1 }
2620c80d 716 do i = 1, N
11b8286a 717 ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
2620c80d
TS
718 if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
719 b(i) = a(i) + 1
720 else
721 b(i) = a(i)
722 end if
723 end do
724 !$acc end kernels
725
726 do i = 1, N
bfc24e32 727 if (b(i) .ne. 39.0) STOP 45
2620c80d
TS
728 end do
729
730 a(:) = 91.0
731
11b8286a 732 !$acc kernels copyin (a(1:N)) copyout (b(1:N)) if (-2 > 0) ! { dg-line l_compute[incr c_compute] }
c43cb355
TS
733 ! { dg-note {OpenACC 'kernels' decomposition: variable 'i' in 'copy' clause requested to be made addressable} {} { target *-*-* } l_compute$c_compute }
734 ! { dg-note {variable 'i' already made addressable} {} { target *-*-* } l_compute$c_compute } */
735 ! { dg-note {beginning 'parloops' part in OpenACC 'kernels' region} "" { target *-*-* } .+1 }
2620c80d 736 do i = 1, N
11b8286a 737 ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
2620c80d
TS
738 if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
739 b(i) = a(i) + 1
740 else
741 b(i) = a(i)
742 end if
743 end do
744 !$acc end kernels
745
746 do i = 1, N
bfc24e32 747 if (b(i) .ne. 92.0) STOP 46
2620c80d
TS
748 end do
749
750 a(:) = 43.0
751
11b8286a 752 !$acc kernels copyin (a(1:N)) copyout (b(1:N)) if (one == 1) ! { dg-line l_compute[incr c_compute] }
c43cb355
TS
753 ! { dg-note {OpenACC 'kernels' decomposition: variable 'i' in 'copy' clause requested to be made addressable} {} { target *-*-* } l_compute$c_compute }
754 ! { dg-note {variable 'i' already made addressable} {} { target *-*-* } l_compute$c_compute } */
755 ! { dg-note {beginning 'parloops' part in OpenACC 'kernels' region} "" { target *-*-* } .+1 }
2620c80d 756 do i = 1, N
11b8286a 757 ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
2620c80d
TS
758 if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
759 b(i) = a(i) + 1
760 else
761 b(i) = a(i)
762 end if
763 end do
764 !$acc end kernels
765
766#if ACC_MEM_SHARED
767 exp = 44.0
768#else
769 exp = 43.0
770#endif
771
772 do i = 1, N
bfc24e32 773 if (b(i) .ne. exp) STOP 47
2620c80d
TS
774 end do
775
776 a(:) = 87.0
777
11b8286a 778 !$acc kernels if (one == 0) ! { dg-line l_compute[incr c_compute] }
c43cb355
TS
779 ! { dg-note {OpenACC 'kernels' decomposition: variable 'i' in 'copy' clause requested to be made addressable} {} { target *-*-* } l_compute$c_compute }
780 ! { dg-note {variable 'i' already made addressable} {} { target *-*-* } l_compute$c_compute } */
781 ! { dg-note {beginning 'parloops' part in OpenACC 'kernels' region} "" { target *-*-* } .+1 }
2620c80d 782 do i = 1, N
11b8286a 783 ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
2620c80d
TS
784 if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
785 b(i) = a(i) + 1
786 else
787 b(i) = a(i)
788 end if
789 end do
790 !$acc end kernels
791
792 do i = 1, N
bfc24e32 793 if (b(i) .ne. 88.0) STOP 48
2620c80d
TS
794 end do
795
796 a(:) = 3.0
797 b(:) = 9.0
798
799#if ACC_MEM_SHARED
800 exp = 0.0
801 exp2 = 0.0
802#else
803 call acc_copyin (a, sizeof (a))
804 call acc_copyin (b, sizeof (b))
805 exp = 3.0;
806 exp2 = 9.0;
807#endif
808
809 !$acc update device (a(1:N), b(1:N)) if (1 == 1)
810
811 a(:) = 0.0
812 b(:) = 0.0
813
814 !$acc update host (a(1:N), b(1:N)) if (1 == 1)
815
816 do i = 1, N
bfc24e32
TK
817 if (a(i) .ne. exp) STOP 49
818 if (b(i) .ne. exp2) STOP 50
2620c80d
TS
819 end do
820
821 a(:) = 6.0
822 b(:) = 12.0
823
824 !$acc update device (a(1:N), b(1:N)) if (0 == 1)
825
826 a(:) = 0.0
827 b(:) = 0.0
828
829 !$acc update host (a(1:N), b(1:N)) if (1 == 1)
830
831 do i = 1, N
bfc24e32
TK
832 if (a(i) .ne. exp) STOP 51
833 if (b(i) .ne. exp2) STOP 52
2620c80d
TS
834 end do
835
836 a(:) = 26.0
837 b(:) = 21.0
838
839 !$acc update device (a(1:N), b(1:N)) if (1 == 1)
840
841 a(:) = 0.0
842 b(:) = 0.0
843
844 !$acc update host (a(1:N), b(1:N)) if (0 == 1)
845
846 do i = 1, N
bfc24e32
TK
847 if (a(i) .ne. 0.0) STOP 53
848 if (b(i) .ne. 0.0) STOP 54
2620c80d
TS
849 end do
850
851#if !ACC_MEM_SHARED
852 call acc_copyout (a, sizeof (a))
853 call acc_copyout (b, sizeof (b))
854#endif
855
856 a(:) = 4.0
857 b(:) = 0.0
858
859 !$acc data copyin (a(1:N)) copyout (b(1:N)) if (1 == 1)
004fc4f2 860 ! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
2620c80d 861
c43cb355
TS
862 !$acc kernels present (a(1:N)) ! { dg-line l_compute[incr c_compute] }
863 ! { dg-note {OpenACC 'kernels' decomposition: variable 'i' in 'copy' clause requested to be made addressable} {} { target *-*-* } l_compute$c_compute }
864 ! { dg-note {variable 'i' already made addressable} {} { target *-*-* } l_compute$c_compute } */
865 ! { dg-note {beginning 'parloops' part in OpenACC 'kernels' region} "" { target *-*-* } .+1 }
2620c80d
TS
866 do i = 1, N
867 b(i) = a(i)
868 end do
869 !$acc end kernels
870 !$acc end data
871
872 do i = 1, N
bfc24e32 873 if (b(i) .ne. 4.0) STOP 55
2620c80d
TS
874 end do
875
876 a(:) = 8.0
877 b(:) = 1.0
878
879 !$acc data copyin (a(1:N)) copyout (b(1:N)) if (0 == 1)
11e811d8 880 ! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: artificial} "" { target { ! openacc_host_selected } } .-1 }
2620c80d
TS
881
882#if !ACC_MEM_SHARED
bfc24e32
TK
883 if (acc_is_present (a) .eqv. .TRUE.) STOP 56
884 if (acc_is_present (b) .eqv. .TRUE.) STOP 57
2620c80d
TS
885#endif
886
887 !$acc end data
888
889 a(:) = 18.0
890 b(:) = 21.0
891
892 !$acc data copyin (a(1:N)) if (1 == 1)
004fc4f2 893 ! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
11e811d8 894 ! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: artificial} "" { target { ! openacc_host_selected } } .-2 }
2620c80d
TS
895
896#if !ACC_MEM_SHARED
bfc24e32 897 if (acc_is_present (a) .eqv. .FALSE.) STOP 58
2620c80d
TS
898#endif
899
900 !$acc data copyout (b(1:N)) if (0 == 1)
004fc4f2 901 ! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
11e811d8 902 ! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: artificial} "" { target { ! openacc_host_selected } } .-2 }
2620c80d 903#if !ACC_MEM_SHARED
bfc24e32 904 if (acc_is_present (b) .eqv. .TRUE.) STOP 59
2620c80d
TS
905#endif
906 !$acc data copyout (b(1:N)) if (1 == 1)
004fc4f2 907 ! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
2620c80d 908
c43cb355
TS
909 !$acc kernels present (a(1:N)) present (b(1:N)) ! { dg-line l_compute[incr c_compute] }
910 ! { dg-note {OpenACC 'kernels' decomposition: variable 'i' in 'copy' clause requested to be made addressable} {} { target *-*-* } l_compute$c_compute }
911 ! { dg-note {variable 'i' already made addressable} {} { target *-*-* } l_compute$c_compute } */
912 ! { dg-note {beginning 'parloops' part in OpenACC 'kernels' region} "" { target *-*-* } .+1 }
2620c80d
TS
913 do i = 1, N
914 b(i) = a(i)
915 end do
916 !$acc end kernels
917
918 !$acc end data
919
920#if !ACC_MEM_SHARED
bfc24e32 921 if (acc_is_present (b) .eqv. .TRUE.) STOP 60
2620c80d
TS
922#endif
923 !$acc end data
924 !$acc end data
925
926 do i = 1, N
bfc24e32 927 if (b(1) .ne. 18.0) STOP 61
2620c80d
TS
928 end do
929
930 !$acc enter data copyin (b(1:N)) if (0 == 1)
931
932#if !ACC_MEM_SHARED
bfc24e32 933 if (acc_is_present (b) .eqv. .TRUE.) STOP 62
2620c80d
TS
934#endif
935
936 !$acc exit data delete (b(1:N)) if (0 == 1)
937
938 !$acc enter data copyin (b(1:N)) if (1 == 1)
939
940#if !ACC_MEM_SHARED
bfc24e32 941 if (acc_is_present (b) .eqv. .FALSE.) STOP 63
2620c80d
TS
942#endif
943
944 !$acc exit data delete (b(1:N)) if (1 == 1)
945
946#if !ACC_MEM_SHARED
bfc24e32 947 if (acc_is_present (b) .eqv. .TRUE.) STOP 64
2620c80d
TS
948#endif
949
950 !$acc enter data copyin (b(1:N)) if (zero == 1)
951
952#if !ACC_MEM_SHARED
bfc24e32 953 if (acc_is_present (b) .eqv. .TRUE.) STOP 65
2620c80d
TS
954#endif
955
956 !$acc exit data delete (b(1:N)) if (zero == 1)
957
958 !$acc enter data copyin (b(1:N)) if (one == 1)
959
960#if !ACC_MEM_SHARED
bfc24e32 961 if (acc_is_present (b) .eqv. .FALSE.) STOP 66
2620c80d
TS
962#endif
963
964 !$acc exit data delete (b(1:N)) if (one == 1)
965
966#if !ACC_MEM_SHARED
bfc24e32 967 if (acc_is_present (b) .eqv. .TRUE.) STOP 67
2620c80d
TS
968#endif
969
970 !$acc enter data copyin (b(1:N)) if (one == 0)
971
972#if !ACC_MEM_SHARED
bfc24e32 973 if (acc_is_present (b) .eqv. .TRUE.) STOP 68
2620c80d
TS
974#endif
975
976 !$acc exit data delete (b(1:N)) if (one == 0)
977
978 !$acc enter data copyin (b(1:N)) if (one == 1)
979
980#if !ACC_MEM_SHARED
bfc24e32 981 if (acc_is_present (b) .eqv. .FALSE.) STOP 69
2620c80d
TS
982#endif
983
984 !$acc exit data delete (b(1:N)) if (one == 1)
985
986#if !ACC_MEM_SHARED
bfc24e32 987 if (acc_is_present (b) .eqv. .TRUE.) STOP 70
2620c80d
TS
988#endif
989
990end program main