Commit bf751f40 by Tom de Vries Committed by Tom de Vries

Add oacc kernels test-cases in gfortran.dg/goacc

2016-03-09  Tom de Vries  <tom@codesourcery.com>

	* gfortran.dg/goacc/kernels-loop-2.f95: New test.
	* gfortran.dg/goacc/kernels-loop-data-2.f95: New test.
	* gfortran.dg/goacc/kernels-loop-data-enter-exit-2.f95: New test.
	* gfortran.dg/goacc/kernels-loop-data-enter-exit.f95: New test.
	* gfortran.dg/goacc/kernels-loop-data-update.f95: New test.
	* gfortran.dg/goacc/kernels-loop-data.f95: New test.
	* gfortran.dg/goacc/kernels-loop-n.f95: New test.
	* gfortran.dg/goacc/kernels-loop.f95: New test.

From-SVN: r234077
parent b827e3fe
2016-03-09 Tom de Vries <tom@codesourcery.com>
* gfortran.dg/goacc/kernels-loop-2.f95: New test.
* gfortran.dg/goacc/kernels-loop-data-2.f95: New test.
* gfortran.dg/goacc/kernels-loop-data-enter-exit-2.f95: New test.
* gfortran.dg/goacc/kernels-loop-data-enter-exit.f95: New test.
* gfortran.dg/goacc/kernels-loop-data-update.f95: New test.
* gfortran.dg/goacc/kernels-loop-data.f95: New test.
* gfortran.dg/goacc/kernels-loop-n.f95: New test.
* gfortran.dg/goacc/kernels-loop.f95: New test.
2016-03-08 Martin Sebor <msebor@redhat.com>
PR c++/62096
......
! { dg-additional-options "-O2" }
! { dg-additional-options "-fdump-tree-parloops1-all" }
! { dg-additional-options "-fdump-tree-optimized" }
program main
implicit none
integer, parameter :: n = 1024
integer, dimension (0:n-1) :: a, b, c
integer :: i, ii
!$acc kernels copyout (a(0:n-1))
do i = 0, n - 1
a(i) = i * 2
end do
!$acc end kernels
!$acc kernels copyout (b(0:n-1))
do i = 0, n -1
b(i) = i * 4
end do
!$acc end kernels
!$acc kernels copyin (a(0:n-1), b(0:n-1)) copyout (c(0:n-1))
do ii = 0, n - 1
c(ii) = a(ii) + b(ii)
end do
!$acc end kernels
do i = 0, n - 1
if (c(i) .ne. a(i) + b(i)) call abort
end do
end program main
! Check that only three loops are analyzed, and that all can be parallelized.
! { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 3 "parloops1" } }
! { dg-final { scan-tree-dump-not "FAILED:" "parloops1" } }
! Check that the loop has been split off into a function.
! { dg-final { scan-tree-dump-times "(?n);; Function MAIN__._omp_fn.0 " 1 "optimized" } }
! { dg-final { scan-tree-dump-times "(?n);; Function MAIN__._omp_fn.1 " 1 "optimized" } }
! { dg-final { scan-tree-dump-times "(?n);; Function MAIN__._omp_fn.2 " 1 "optimized" } }
! { dg-additional-options "-O2" }
! { dg-additional-options "-fdump-tree-parloops1-all" }
! { dg-additional-options "-fdump-tree-optimized" }
program main
implicit none
integer, parameter :: n = 1024
integer, dimension (0:n-1) :: a, b, c
integer :: i, ii
!$acc data copyout (a(0:n-1))
!$acc kernels present (a(0:n-1))
do i = 0, n - 1
a(i) = i * 2
end do
!$acc end kernels
!$acc end data
!$acc data copyout (b(0:n-1))
!$acc kernels present (b(0:n-1))
do i = 0, n -1
b(i) = i * 4
end do
!$acc end kernels
!$acc end data
!$acc data copyin (a(0:n-1), b(0:n-1)) copyout (c(0:n-1))
!$acc kernels present (a(0:n-1), b(0:n-1), c(0:n-1))
do ii = 0, n - 1
c(ii) = a(ii) + b(ii)
end do
!$acc end kernels
!$acc end data
do i = 0, n - 1
if (c(i) .ne. a(i) + b(i)) call abort
end do
end program main
! Check that only three loops are analyzed, and that all can be parallelized.
! { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 3 "parloops1" } }
! { dg-final { scan-tree-dump-not "FAILED:" "parloops1" } }
! Check that the loop has been split off into a function.
! { dg-final { scan-tree-dump-times "(?n);; Function MAIN__._omp_fn.0 " 1 "optimized" } }
! { dg-final { scan-tree-dump-times "(?n);; Function MAIN__._omp_fn.1 " 1 "optimized" } }
! { dg-final { scan-tree-dump-times "(?n);; Function MAIN__._omp_fn.2 " 1 "optimized" } }
! { dg-additional-options "-O2" }
! { dg-additional-options "-fdump-tree-parloops1-all" }
! { dg-additional-options "-fdump-tree-optimized" }
program main
implicit none
integer, parameter :: n = 1024
integer, dimension (0:n-1) :: a, b, c
integer :: i, ii
!$acc enter data create (a(0:n-1))
!$acc kernels present (a(0:n-1))
do i = 0, n - 1
a(i) = i * 2
end do
!$acc end kernels
!$acc exit data copyout (a(0:n-1))
!$acc enter data create (b(0:n-1))
!$acc kernels present (b(0:n-1))
do i = 0, n -1
b(i) = i * 4
end do
!$acc end kernels
!$acc exit data copyout (b(0:n-1))
!$acc enter data copyin (a(0:n-1), b(0:n-1)) create (c(0:n-1))
!$acc kernels present (a(0:n-1), b(0:n-1), c(0:n-1))
do ii = 0, n - 1
c(ii) = a(ii) + b(ii)
end do
!$acc end kernels
!$acc exit data copyout (c(0:n-1))
do i = 0, n - 1
if (c(i) .ne. a(i) + b(i)) call abort
end do
end program main
! Check that only three loops are analyzed, and that all can be parallelized.
! { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 3 "parloops1" } }
! { dg-final { scan-tree-dump-not "FAILED:" "parloops1" } }
! Check that the loop has been split off into a function.
! { dg-final { scan-tree-dump-times "(?n);; Function MAIN__._omp_fn.0 " 1 "optimized" } }
! { dg-final { scan-tree-dump-times "(?n);; Function MAIN__._omp_fn.1 " 1 "optimized" } }
! { dg-final { scan-tree-dump-times "(?n);; Function MAIN__._omp_fn.2 " 1 "optimized" } }
! { dg-additional-options "-O2" }
! { dg-additional-options "-fdump-tree-parloops1-all" }
! { dg-additional-options "-fdump-tree-optimized" }
program main
implicit none
integer, parameter :: n = 1024
integer, dimension (0:n-1) :: a, b, c
integer :: i, ii
!$acc enter data create (a(0:n-1), b(0:n-1), c(0:n-1))
!$acc kernels present (a(0:n-1))
do i = 0, n - 1
a(i) = i * 2
end do
!$acc end kernels
!$acc kernels present (b(0:n-1))
do i = 0, n -1
b(i) = i * 4
end do
!$acc end kernels
!$acc kernels present (a(0:n-1), b(0:n-1), c(0:n-1))
do ii = 0, n - 1
c(ii) = a(ii) + b(ii)
end do
!$acc end kernels
!$acc exit data copyout (a(0:n-1), b(0:n-1), c(0:n-1))
do i = 0, n - 1
if (c(i) .ne. a(i) + b(i)) call abort
end do
end program main
! Check that only three loops are analyzed, and that all can be parallelized.
! { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 3 "parloops1" } }
! { dg-final { scan-tree-dump-not "FAILED:" "parloops1" } }
! Check that the loop has been split off into a function.
! { dg-final { scan-tree-dump-times "(?n);; Function MAIN__._omp_fn.0 " 1 "optimized" } }
! { dg-final { scan-tree-dump-times "(?n);; Function MAIN__._omp_fn.1 " 1 "optimized" } }
! { dg-final { scan-tree-dump-times "(?n);; Function MAIN__._omp_fn.2 " 1 "optimized" } }
! { dg-additional-options "-O2" }
! { dg-additional-options "-fdump-tree-parloops1-all" }
! { dg-additional-options "-fdump-tree-optimized" }
program main
implicit none
integer, parameter :: n = 1024
integer, dimension (0:n-1) :: a, b, c
integer :: i, ii
!$acc enter data create (a(0:n-1), b(0:n-1), c(0:n-1))
!$acc kernels present (a(0:n-1))
do i = 0, n - 1
a(i) = i * 2
end do
!$acc end kernels
do i = 0, n -1
b(i) = i * 4
end do
!$acc update device (b(0:n-1))
!$acc kernels present (a(0:n-1), b(0:n-1), c(0:n-1))
do ii = 0, n - 1
c(ii) = a(ii) + b(ii)
end do
!$acc end kernels
!$acc exit data copyout (a(0:n-1), c(0:n-1))
do i = 0, n - 1
if (c(i) .ne. a(i) + b(i)) call abort
end do
end program main
! Check that only three loops are analyzed, and that all can be parallelized.
! { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 2 "parloops1" } }
! { dg-final { scan-tree-dump-not "FAILED:" "parloops1" } }
! Check that the loop has been split off into a function.
! { dg-final { scan-tree-dump-times "(?n);; Function MAIN__._omp_fn.0 " 1 "optimized" } }
! { dg-final { scan-tree-dump-times "(?n);; Function MAIN__._omp_fn.1 " 1 "optimized" } }
! { dg-additional-options "-O2" }
! { dg-additional-options "-fdump-tree-parloops1-all" }
! { dg-additional-options "-fdump-tree-optimized" }
program main
implicit none
integer, parameter :: n = 1024
integer, dimension (0:n-1) :: a, b, c
integer :: i, ii
!$acc data copyout (a(0:n-1), b(0:n-1), c(0:n-1))
!$acc kernels present (a(0:n-1))
do i = 0, n - 1
a(i) = i * 2
end do
!$acc end kernels
!$acc kernels present (b(0:n-1))
do i = 0, n -1
b(i) = i * 4
end do
!$acc end kernels
!$acc kernels present (a(0:n-1), b(0:n-1), c(0:n-1))
do ii = 0, n - 1
c(ii) = a(ii) + b(ii)
end do
!$acc end kernels
!$acc end data
do i = 0, n - 1
if (c(i) .ne. a(i) + b(i)) call abort
end do
end program main
! Check that only three loops are analyzed, and that all can be parallelized.
! { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 3 "parloops1" } }
! { dg-final { scan-tree-dump-not "FAILED:" "parloops1" } }
! Check that the loop has been split off into a function.
! { dg-final { scan-tree-dump-times "(?n);; Function MAIN__._omp_fn.0 " 1 "optimized" } }
! { dg-final { scan-tree-dump-times "(?n);; Function MAIN__._omp_fn.1 " 1 "optimized" } }
! { dg-final { scan-tree-dump-times "(?n);; Function MAIN__._omp_fn.2 " 1 "optimized" } }
! { dg-additional-options "-O2" }
! { dg-additional-options "-fdump-tree-parloops1-all" }
! { dg-additional-options "-fdump-tree-optimized" }
module test
contains
subroutine foo(n)
implicit none
integer :: n
integer, dimension (0:n-1) :: a, b, c
integer :: i, ii
do i = 0, n - 1
a(i) = i * 2
end do
do i = 0, n -1
b(i) = i * 4
end do
!$acc kernels copyin (a(0:n-1), b(0:n-1)) copyout (c(0:n-1))
do ii = 0, n - 1
c(ii) = a(ii) + b(ii)
end do
!$acc end kernels
do i = 0, n - 1
if (c(i) .ne. a(i) + b(i)) call abort
end do
end subroutine foo
end module test
! Check that only one loop is analyzed, and that it can be parallelized.
! { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 1 "parloops1" } }
! { dg-final { scan-tree-dump-not "FAILED:" "parloops1" } }
! Check that the loop has been split off into a function.
! { dg-final { scan-tree-dump-times "(?n);; Function __test_MOD_foo._omp_fn.0 " 1 "optimized" } }
! { dg-additional-options "-O2" }
! { dg-additional-options "-fdump-tree-parloops1-all" }
! { dg-additional-options "-fdump-tree-optimized" }
program main
implicit none
integer, parameter :: n = 1024
integer, dimension (0:n-1) :: a, b, c
integer :: i, ii
do i = 0, n - 1
a(i) = i * 2
end do
do i = 0, n -1
b(i) = i * 4
end do
!$acc kernels copyin (a(0:n-1), b(0:n-1)) copyout (c(0:n-1))
do ii = 0, n - 1
c(ii) = a(ii) + b(ii)
end do
!$acc end kernels
do i = 0, n - 1
if (c(i) .ne. a(i) + b(i)) call abort
end do
end program main
! Check that only one loop is analyzed, and that it can be parallelized.
! { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 1 "parloops1" } }
! { dg-final { scan-tree-dump-not "FAILED:" "parloops1" } }
! Check that the loop has been split off into a function.
! { dg-final { scan-tree-dump-times "(?n);; Function MAIN__._omp_fn.0 " 1 "optimized" } }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment