Debian Codegraph @

libgomp/testsuite/libgomp.oacc-fortran/if-1.f90

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