gcc/libgomp/testsuite/libgomp.oacc-fortran/declare-1.f90
Thomas Schwinge 2620c80db0 Update OpenACC test cases
gcc/testsuite/
	* c-c++-common/goacc/combined-directives.c: Clean up dg-*
	directives.
	* c-c++-common/goacc/loop-clauses.c: Likewise.
	* g++.dg/goacc/template.C: Likewise.
	* gfortran.dg/goacc/combined-directives.f90: Likewise.
	* gfortran.dg/goacc/loop-1.f95: Likewise.
	* gfortran.dg/goacc/loop-5.f95: Likewise.
	* gfortran.dg/goacc/loop-6.f95: Likewise.
	* gfortran.dg/goacc/loop-tree-1.f90: Likewise.
	* c-c++-common/goacc-gomp/nesting-1.c: Update.
	* c-c++-common/goacc-gomp/nesting-fail-1.c: Likewise.
	* c-c++-common/goacc/clauses-fail.c: Likewise.
	* c-c++-common/goacc/parallel-1.c: Likewise.
	* c-c++-common/goacc/reduction-1.c: Likewise.
	* c-c++-common/goacc/reduction-2.c: Likewise.
	* c-c++-common/goacc/reduction-3.c: Likewise.
	* c-c++-common/goacc/reduction-4.c: Likewise.
	* c-c++-common/goacc/routine-3.c: Likewise.
	* c-c++-common/goacc/routine-4.c: Likewise.
	* c-c++-common/goacc/routine-5.c: Likewise.
	* c-c++-common/goacc/tile.c: Likewise.
	* g++.dg/goacc/template.C: Likewise.
	* gfortran.dg/goacc/combined-directives.f90: Likewise.
	* c-c++-common/goacc/nesting-1.c: Move dg-error test cases into...
	* c-c++-common/goacc/nesting-fail-1.c: ... this file.  Update.
	* c-c++-common/goacc/kernels-1.c: Update.  Incorporate...
	* c-c++-common/goacc/kernels-empty.c: ... this file, and...
	* c-c++-common/goacc/kernels-eternal.c: ... this file, and...
	* c-c++-common/goacc/kernels-noreturn.c: ... this file.
	* c-c++-common/goacc/host_data-1.c: New file.  Incorporate...
	* c-c++-common/goacc/use_device-1.c: ... this file.
	* c-c++-common/goacc/host_data-2.c: New file.  Incorporate...
	* c-c++-common/goacc/host_data-5.c: ... this file, and...
	* c-c++-common/goacc/host_data-6.c: ... this file.
	* c-c++-common/goacc/loop-2-kernels.c: New file.
	* c-c++-common/goacc/loop-2-parallel.c: Likewise.
	* c-c++-common/goacc/loop-3.c: Likewise.
	* g++.dg/goacc/reference.C: Likewise.
	* g++.dg/goacc/routine-1.C: Likewise.
	* g++.dg/goacc/routine-2.C: Likewise.
	libgomp/
	* testsuite/libgomp.oacc-c-c++-common/clauses-1.c: Update.
	* testsuite/libgomp.oacc-c-c++-common/deviceptr-1.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/if-1.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/vector-loop.c: Likewise.
	* testsuite/libgomp.oacc-fortran/asyncwait-1.f90: Likewise.
	* testsuite/libgomp.oacc-fortran/asyncwait-2.f90: Likewise.
	* testsuite/libgomp.oacc-fortran/asyncwait-3.f90: Likewise.
	* testsuite/libgomp.oacc-fortran/declare-1.f90: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/asyncwait-1.c: Likewise.
	XFAIL.
	* testsuite/libgomp.oacc-c-c++-common/firstprivate-1.c: Update.
	Incorporate...
	* testsuite/libgomp.oacc-c-c++-common/firstprivate-2.c: ... this
	file.
	* testsuite/libgomp.oacc-c++/template-reduction.C: New file.
	* testsuite/libgomp.oacc-c-c++-common/gang-static-1.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/gang-static-2.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/kernels-loop-clauses.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/private-variables.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/reduction-7.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/routine-1.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/routine-4.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/routine-wv-2.c: Likewise.
	* testsuite/libgomp.oacc-fortran/clauses-1.f90: Likewise.
	* testsuite/libgomp.oacc-fortran/default-1.f90: Likewise.
	* testsuite/libgomp.oacc-fortran/firstprivate-1.f90: Likewise.
	* testsuite/libgomp.oacc-fortran/gang-static-1.f90: Likewise.
	* testsuite/libgomp.oacc-fortran/if-1.f90: Likewise.
	* testsuite/libgomp.oacc-fortran/implicit-firstprivate-ref.f90:
	Likewise.
	* testsuite/libgomp.oacc-fortran/pr68813.f90: Likewise.
	* testsuite/libgomp.oacc-fortran/private-variables.f90: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/kernels-1.c: Merge this
	file...
	* testsuite/libgomp.oacc-c-c++-common/parallel-1.c: ..., and this
	file into...
	* testsuite/libgomp.oacc-c-c++-common/data-clauses.h: ... this new
	file.  Update.
	* testsuite/libgomp.oacc-c-c++-common/data-clauses-kernels.c: New
	file.
	* testsuite/libgomp.oacc-c-c++-common/data-clauses-parallel.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/kernels-2.c: Rename to...
	* testsuite/libgomp.oacc-c-c++-common/data-clauses-kernels-ipa-pta.c:
	... this new file.  Update.
	* testsuite/libgomp.oacc-c-c++-common/parallel-2.c: Rename to...
	* testsuite/libgomp.oacc-c-c++-common/data-clauses-parallel-ipa-pta.c:
	... this new file.  Update.
	* testsuite/libgomp.oacc-c-c++-common/mode-transitions.c: New
	file.  Incorporate...
	* testsuite/libgomp.oacc-c-c++-common/worker-single-1a.c: ... this
	file, and...
	* testsuite/libgomp.oacc-c-c++-common/worker-single-4.c: ... this
	file, and...
	* testsuite/libgomp.oacc-c-c++-common/worker-single-6.c: ... this
	file.
	* testsuite/libgomp.oacc-c-c++-common/update-1-2.c: Remove file.

Co-Authored-By: Cesar Philippidis <cesar@codesourcery.com>
Co-Authored-By: Chung-Lin Tang <cltang@codesourcery.com>
Co-Authored-By: James Norris <jnorris@codesourcery.com>
Co-Authored-By: Julian Brown <julian@codesourcery.com>
Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com>
Co-Authored-By: Tom de Vries <tom@codesourcery.com>

From-SVN: r234575
2016-03-30 17:08:47 +02:00

232 lines
3.8 KiB
Fortran

! { dg-do run { target openacc_nvidia_accel_selected } }
! Tests to exercise the declare directive along with
! the clauses: copy
! copyin
! copyout
! create
! present
! present_or_copy
! present_or_copyin
! present_or_copyout
! present_or_create
module vars
implicit none
integer z
!$acc declare create (z)
end module vars
subroutine subr5 (a, b, c, d)
implicit none
integer, parameter :: N = 8
integer :: i
integer :: a(N)
!$acc declare present_or_copyin (a)
integer :: b(N)
!$acc declare present_or_create (b)
integer :: c(N)
!$acc declare present_or_copyout (c)
integer :: d(N)
!$acc declare present_or_copy (d)
i = 0
!$acc parallel
do i = 1, N
b(i) = a(i)
c(i) = b(i)
d(i) = d(i) + b(i)
end do
!$acc end parallel
end subroutine
subroutine subr4 (a, b)
implicit none
integer, parameter :: N = 8
integer :: i
integer :: a(N)
!$acc declare present (a)
integer :: b(N)
!$acc declare copyout (b)
i = 0
!$acc parallel
do i = 1, N
b(i) = a(i)
end do
!$acc end parallel
end subroutine
subroutine subr3 (a, c)
implicit none
integer, parameter :: N = 8
integer :: i
integer :: a(N)
!$acc declare present (a)
integer :: c(N)
!$acc declare copyin (c)
i = 0
!$acc parallel
do i = 1, N
a(i) = c(i)
c(i) = 0
end do
!$acc end parallel
end subroutine
subroutine subr2 (a, b, c)
implicit none
integer, parameter :: N = 8
integer :: i
integer :: a(N)
!$acc declare present (a)
integer :: b(N)
!$acc declare create (b)
integer :: c(N)
!$acc declare copy (c)
i = 0
!$acc parallel
do i = 1, N
b(i) = a(i)
c(i) = b(i) + c(i) + 1
end do
!$acc end parallel
end subroutine
subroutine subr1 (a)
implicit none
integer, parameter :: N = 8
integer :: i
integer :: a(N)
!$acc declare present (a)
i = 0
!$acc parallel
do i = 1, N
a(i) = a(i) + 1
end do
!$acc end parallel
end subroutine
subroutine test (a, e)
use openacc
implicit none
logical :: e
integer, parameter :: N = 8
integer :: a(N)
if (acc_is_present (a) .neqv. e) call abort
end subroutine
subroutine subr0 (a, b, c, d)
implicit none
integer, parameter :: N = 8
integer :: a(N)
!$acc declare copy (a)
integer :: b(N)
integer :: c(N)
integer :: d(N)
integer :: i
call test (a, .true.)
call test (b, .false.)
call test (c, .false.)
call subr1 (a)
call test (a, .true.)
call test (b, .false.)
call test (c, .false.)
call subr2 (a, b, c)
call test (a, .true.)
call test (b, .false.)
call test (c, .false.)
do i = 1, N
if (c(i) .ne. 8) call abort
end do
call subr3 (a, c)
call test (a, .true.)
call test (b, .false.)
call test (c, .false.)
do i = 1, N
if (a(i) .ne. 2) call abort
if (c(i) .ne. 8) call abort
end do
call subr4 (a, b)
call test (a, .true.)
call test (b, .false.)
call test (c, .false.)
do i = 1, N
if (b(i) .ne. 8) call abort
end do
call subr5 (a, b, c, d)
call test (a, .true.)
call test (b, .false.)
call test (c, .false.)
call test (d, .false.)
do i = 1, N
if (c(i) .ne. 8) call abort
if (d(i) .ne. 13) call abort
end do
end subroutine
program main
use vars
use openacc
implicit none
integer, parameter :: N = 8
integer :: a(N)
integer :: b(N)
integer :: c(N)
integer :: d(N)
integer :: i
a(:) = 2
b(:) = 3
c(:) = 4
d(:) = 5
if (acc_is_present (z) .neqv. .true.) call abort
call subr0 (a, b, c, d)
call test (a, .false.)
call test (b, .false.)
call test (c, .false.)
call test (d, .false.)
do i = 1, N
if (a(i) .ne. 8) call abort
if (b(i) .ne. 8) call abort
if (c(i) .ne. 8) call abort
if (d(i) .ne. 13) call abort
end do
end program