gcc/libgomp/testsuite/libgomp.oacc-fortran/nested-function-2.f90
Thomas Schwinge 27d6ba889b [PR middle-end/71373] Handle more OMP_CLAUSE_* in nested function decomposition
gcc/
	* gimplify.c (gimplify_adjust_omp_clauses): Discard
	OMP_CLAUSE_TILE.
	* omp-low.c (scan_sharing_clauses): Don't expect OMP_CLAUSE_TILE.
	gcc/testsuite/
	* c-c++-common/goacc/combined-directives.c: XFAIL tree scanning
	for OpenACC tile clauses.
	* gfortran.dg/goacc/combined-directives.f90: Likewise.

	gcc/
	PR middle-end/71373
	* tree-nested.c (convert_nonlocal_omp_clauses)
	(convert_local_omp_clauses): Handle OMP_CLAUSE_ASYNC,
	OMP_CLAUSE_WAIT, OMP_CLAUSE_INDEPENDENT, OMP_CLAUSE_AUTO,
	OMP_CLAUSE__CACHE_, OMP_CLAUSE_TILE.
	gcc/testsuite/
	PR middle-end/71373
	* gcc.dg/goacc/nested-function-1.c: New file.
	* gcc.dg/goacc/nested-function-2.c: Likewise.
	* gcc.dg/goacc/pr71373.c: Likewise.
	* gfortran.dg/goacc/cray-2.f95: Likewise.
	* gfortran.dg/goacc/loop-1-2.f95: Likewise.
	* gfortran.dg/goacc/loop-3-2.f95: Likewise.
	* gfortran.dg/goacc/cray.f95: Update.
	* gfortran.dg/goacc/loop-1.f95: Likewise.
	* gfortran.dg/goacc/loop-3.f95: Likewise.
	* gfortran.dg/goacc/subroutines.f90: Update, and rename to...
	* gfortran.dg/goacc/nested-function-1.f90: ... this new file.
	libgomp/testsuite/
	PR middle-end/71373
	* libgomp.oacc-c/nested-function-1.c: New file.
	* libgomp.oacc-c/nested-function-2.c: Likewise.
	* libgomp.oacc-fortran/nested-function-1.f90: Likewise.
	* libgomp.oacc-fortran/nested-function-2.f90: Likewise.
	* libgomp.oacc-fortran/nested-function-3.f90: Likewise.

Co-Authored-By: Cesar Philippidis <cesar@codesourcery.com>

From-SVN: r237291
2016-06-10 11:22:51 +02:00

174 lines
4.2 KiB
Fortran

! Exercise nested function decomposition, gcc/tree-nested.c.
! { dg-do run }
program collapse3
integer :: p1, p2, p3, p4, p5, p6, p7, p8, p9
p1 = 2
p2 = 6
p3 = -2
p4 = 4
p5 = 13
p6 = 18
p7 = 1
p8 = 1
p9 = 1
call test1
call test2 (p1, p2, p3, p4, p5, p6)
call test3 (p1, p2, p3, p4, p5, p6, p7, p8, p9)
call test4
contains
subroutine test1
integer :: a(3,3,3), k, kk, kkk, l, ll, lll
!$acc parallel
!$acc loop collapse(3)
do 115 k=1,3
dokk: do kk=1,3
do kkk=1,3
a(k,kk,kkk) = 1
enddo
enddo dokk
115 continue
!$acc end parallel
if (any(a(1:3,1:3,1:3).ne.1)) call abort
!$acc parallel
!$acc loop collapse(3)
dol: do 120 l=1,3
doll: do ll=1,3
do lll=1,3
a(l,ll,lll) = 2
enddo
enddo doll
120 end do dol
!$acc end parallel
if (any(a(1:3,1:3,1:3).ne.2)) call abort
end subroutine test1
subroutine test2(v1, v2, v3, v4, v5, v6)
integer :: i, j, k, a(1:7, -3:5, 12:19), b(1:7, -3:5, 12:19)
integer :: v1, v2, v3, v4, v5, v6
logical :: l, r
l = .false.
r = .false.
a(:, :, :) = 0
b(:, :, :) = 0
!$acc parallel reduction (.or.:l)
!$acc loop reduction (.or.:l) collapse (3)
do i = v1, v2
do j = v3, v4
do k = v5, v6
l = l.or.i.lt.2.or.i.gt.6.or.j.lt.-2.or.j.gt.4
l = l.or.k.lt.13.or.k.gt.18
if (.not.l) a(i, j, k) = a(i, j, k) + 1
end do
end do
end do
!$acc end parallel
do i = v1, v2
do j = v3, v4
do k = v5, v6
r = r.or.i.lt.2.or.i.gt.6.or.j.lt.-2.or.j.gt.4
r = r.or.k.lt.13.or.k.gt.18
if (.not.l) b(i, j, k) = b(i, j, k) + 1
end do
end do
end do
if (l .neqv. r) call abort
do i = v1, v2
do j = v3, v4
do k = v5, v6
if (a(i, j, k) .ne. b(i, j, k)) call abort
end do
end do
end do
end subroutine test2
subroutine test3(v1, v2, v3, v4, v5, v6, v7, v8, v9)
integer :: i, j, k, a(1:7, -3:5, 12:19), b(1:7, -3:5, 12:19)
integer :: v1, v2, v3, v4, v5, v6, v7, v8, v9
logical :: l, r
l = .false.
r = .false.
a(:, :, :) = 0
b(:, :, :) = 0
!$acc parallel reduction (.or.:l)
!$acc loop reduction (.or.:l) collapse (3)
do i = v1, v2, v7
do j = v3, v4, v8
do k = v5, v6, v9
l = l.or.i.lt.2.or.i.gt.6.or.j.lt.-2.or.j.gt.4
l = l.or.k.lt.13.or.k.gt.18
if (.not.l) a(i, j, k) = a(i, j, k) + 1
end do
end do
end do
!$acc end parallel
do i = v1, v2, v7
do j = v3, v4, v8
do k = v5, v6, v9
r = r.or.i.lt.2.or.i.gt.6.or.j.lt.-2.or.j.gt.4
r = r.or.k.lt.13.or.k.gt.18
if (.not.l) b(i, j, k) = b(i, j, k) + 1
end do
end do
end do
if (l .neqv. r) call abort
do i = v1, v2, v7
do j = v3, v4, v8
do k = v5, v6, v9
if (a(i, j, k) .ne. b(i, j, k)) call abort
end do
end do
end do
end subroutine test3
subroutine test4
integer :: i, j, k, a(1:7, -3:5, 12:19), b(1:7, -3:5, 12:19)
integer :: v1, v2, v3, v4, v5, v6, v7, v8, v9
logical :: l, r
l = .false.
r = .false.
a(:, :, :) = 0
b(:, :, :) = 0
v1 = p1
v2 = p2
v3 = p3
v4 = p4
v5 = p5
v6 = p6
v7 = p7
v8 = p8
v9 = p9
!$acc parallel reduction (.or.:l)
!$acc loop reduction (.or.:l) collapse (3)
do i = v1, v2, v7
do j = v3, v4, v8
do k = v5, v6, v9
l = l.or.i.lt.2.or.i.gt.6.or.j.lt.-2.or.j.gt.4
l = l.or.k.lt.13.or.k.gt.18
if (.not.l) a(i, j, k) = a(i, j, k) + 1
end do
end do
end do
!$acc end parallel
do i = v1, v2, v7
do j = v3, v4, v8
do k = v5, v6, v9
r = r.or.i.lt.2.or.i.gt.6.or.j.lt.-2.or.j.gt.4
r = r.or.k.lt.13.or.k.gt.18
if (.not.r) b(i, j, k) = b(i, j, k) + 1
end do
end do
end do
if (l .neqv. r) call abort
do i = v1, v2, v7
do j = v3, v4, v8
do k = v5, v6, v9
if (a(i, j, k) .ne. b(i, j, k)) call abort
end do
end do
end do
end subroutine test4
end program collapse3