gcc/libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-2.f
Thomas Schwinge 97a040e987 Add 'acc_device_radeon' testing to 'libgomp.oacc-*/acc_on_device-*'
libgomp/
	* testsuite/libgomp.oacc-c-c++-common/acc_on_device-1.c: Add
	'acc_device_radeon' testing.
	* testsuite/libgomp.oacc-fortran/acc_on_device-1-1.f90: Likewise.
	* testsuite/libgomp.oacc-fortran/acc_on_device-1-2.f: Likewise.
	* testsuite/libgomp.oacc-fortran/acc_on_device-1-3.f: Likewise.
2021-06-08 11:28:53 +02:00

64 lines
2.2 KiB
Fortran

! { dg-do run }
! { dg-additional-options "-cpp" }
! { dg-additional-options "-fopt-info-all-omp" }
! { dg-additional-options "--param=openacc-privatization=noisy" }
! { dg-additional-options "-foffload=-fopt-info-all-omp" }
! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
! for testing/documenting aspects of that functionality.
! TODO: Have to disable the acc_on_device builtin for we want to test
! the libgomp library function? The command line option
! '-fno-builtin-acc_on_device' is valid for C/C++/ObjC/ObjC++ but not
! for Fortran.
USE OPENACC
IMPLICIT NONE
!Host.
IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_NONE)) STOP 1
IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_HOST)) STOP 2
IF (ACC_ON_DEVICE (ACC_DEVICE_NOT_HOST)) STOP 3
IF (ACC_ON_DEVICE (ACC_DEVICE_NVIDIA)) STOP 4
IF (ACC_ON_DEVICE (ACC_DEVICE_RADEON)) STOP 4
!Host via offloading fallback mode.
!$ACC PARALLEL IF(.FALSE.)
! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } .-1 }
!TODO Unhandled 'CONST_DECL' instances for constant arguments in 'acc_on_device' calls.
IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_NONE)) STOP 5
IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_HOST)) STOP 6
IF (ACC_ON_DEVICE (ACC_DEVICE_NOT_HOST)) STOP 7
IF (ACC_ON_DEVICE (ACC_DEVICE_NVIDIA)) STOP 8
IF (ACC_ON_DEVICE (ACC_DEVICE_RADEON)) STOP 8
!$ACC END PARALLEL
#if !ACC_DEVICE_TYPE_host
! Offloaded.
!$ACC PARALLEL
! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target { ! openacc_host_selected } } .-1 }
IF (ACC_ON_DEVICE (ACC_DEVICE_NONE)) STOP 9
IF (ACC_ON_DEVICE (ACC_DEVICE_HOST)) STOP 10
IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_NOT_HOST)) STOP 11
#if ACC_DEVICE_TYPE_nvidia
IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_NVIDIA)) STOP 12
#else
IF (ACC_ON_DEVICE (ACC_DEVICE_NVIDIA)) STOP 13
#endif
#if ACC_DEVICE_TYPE_radeon
IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_RADEON)) STOP 14
#else
IF (ACC_ON_DEVICE (ACC_DEVICE_RADEON)) STOP 15
#endif
!$ACC END PARALLEL
#endif
END