gcc/libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-2.f90
Thomas Schwinge c3774b2e2d Fortran: Use OpenACC's acc_on_device builtin, fix OpenMP' __builtin_is_initial_device: Fix effective-target keyword in 'libgomp.oacc-fortran/acc_on_device-2.f90'
The test case 'libgomp.oacc-fortran/acc_on_device-2.f90' added in
commit 3269a722b7
"Fortran: Use OpenACC's acc_on_device builtin, fix OpenMP' __builtin_is_initial_device"
had a mismatch between dump file production and its scanning; the former needs
to use 'offload_target_nvptx' (like 'offload_target_amdgcn'), not
'offload_device_nvptx'.

	PR testsuite/82250
	libgomp/
	* testsuite/libgomp.oacc-fortran/acc_on_device-2.f90: Fix
	effective-target keyword.
2024-10-14 10:26:13 +02:00

40 lines
1.2 KiB
Fortran

! { dg-do link }
! Check whether 'acc_on_device()' is properly compile-time optimized. */
! { dg-additional-options "-fdump-tree-gimple -fdump-tree-optimized" }
! { dg-additional-options -foffload-options=-fdump-tree-optimized { target { offload_target_nvptx || offload_target_amdgcn } } }
! { dg-final { scan-tree-dump-times "acc_on_device" 1 "gimple" } }
! { dg-final { scan-tree-dump-not "acc_on_device" "optimized" } }
! { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-tree-dump-not "acc_on_device" "optimized" { target offload_target_amdgcn } } }
! { dg-final { only_for_offload_target nvptx-none scan-offload-tree-dump-not "acc_on_device" "optimized" { target offload_target_nvptx } } }
module m
integer :: xxxx
!$acc declare device_resident(xxxx)
contains
subroutine set_var
!$acc routine
use openacc
implicit none (type, external)
if (acc_on_device(acc_device_host)) then
xxxx = 1234
else
xxxx = 4242
end if
end
end module m
program main
use m
call set_var
!$acc serial
! { dg-warning "using 'vector_length \\(32\\)', ignoring 1" "" { target openacc_nvidia_accel_selected } .-1 }
call set_var
!$acc end serial
end