| 1 |
! { dg-do link } |
| 2 |
|
| 3 |
! Check whether 'acc_on_device()' is properly compile-time optimized. */ |
| 4 |
|
| 5 |
! { dg-additional-options "-fdump-tree-gimple -fdump-tree-optimized" } |
| 6 |
! { dg-additional-options -foffload-options=-fdump-tree-optimized { target { offload_target_nvptx || offload_target_amdgcn } } } |
| 7 |
|
| 8 |
! { dg-final { scan-tree-dump-times "acc_on_device" 1 "gimple" } } |
| 9 |
|
| 10 |
! { dg-final { scan-tree-dump-not "acc_on_device" "optimized" } } |
| 11 |
|
| 12 |
! { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-tree-dump-not "acc_on_device" "optimized" { target offload_target_amdgcn } } } |
| 13 |
! { dg-final { only_for_offload_target nvptx-none scan-offload-tree-dump-not "acc_on_device" "optimized" { target offload_target_nvptx } } } |
| 14 |
|
| 15 |
|
| 16 |
module m |
| 17 |
integer :: xxxx |
| 18 |
!$acc declare device_resident(xxxx) |
| 19 |
contains |
| 20 |
subroutine set_var |
| 21 |
!$acc routine |
| 22 |
use openacc |
| 23 |
implicit none (type, external) |
| 24 |
if (acc_on_device(acc_device_host)) then |
| 25 |
xxxx = 1234 |
| 26 |
else |
| 27 |
xxxx = 4242 |
| 28 |
end if |
| 29 |
end |
| 30 |
end module m |
| 31 |
|
| 32 |
|
| 33 |
program main |
| 34 |
use m |
| 35 |
call set_var |
| 36 |
!$acc serial |
| 37 |
! { dg-warning "using 'vector_length \\(32\\)', ignoring 1" "" { target openacc_nvidia_accel_selected } .-1 } |
| 38 |
call set_var |
| 39 |
!$acc end serial |
| 40 |
end |