diff options
author | Thomas Schwinge <thomas@codesourcery.com> | 2016-07-28 11:04:14 +0200 |
---|---|---|
committer | Thomas Schwinge <thomas@codesourcery.com> | 2016-08-10 17:21:43 +0200 |
commit | b1c3318290a77117cc87cad136fd9618d94ffa52 (patch) | |
tree | d110c0696bd481eff5ab0c8122cd476c78b7c7e1 | |
parent | f7fb5667f7e19a11b4a01385a3c4e1a00af06bdd (diff) | |
download | gcc-b1c3318290a77117cc87cad136fd9618d94ffa52.tar.gz |
Restore libgomp/testsuite/libgomp.oacc-fortran/routine-7.f90 as libgomp/testsuite/libgomp.oacc-fortran/routine-7-2.f90
-rw-r--r-- | libgomp/testsuite/libgomp.oacc-fortran/routine-7-2.f90 | 121 |
1 files changed, 121 insertions, 0 deletions
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/routine-7-2.f90 b/libgomp/testsuite/libgomp.oacc-fortran/routine-7-2.f90 new file mode 100644 index 00000000000..200188ec051 --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-fortran/routine-7-2.f90 @@ -0,0 +1,121 @@ + +! { dg-do run } +! { dg-additional-options "-cpp" } + +#define M 8 +#define N 32 + +program main + integer :: i + integer :: a(N) + integer :: b(M * N) + + do i = 1, N + a(i) = 0 + end do + + !$acc parallel copy (a) + !$acc loop seq + do i = 1, N + call seq (a) + end do + !$acc end parallel + + do i = 1, N + if (a(i) .ne.N) call abort + end do + + !$acc parallel copy (a) + !$acc loop seq + do i = 1, N + call gang (a) + end do + !$acc end parallel + + do i = 1, N + if (a(i) .ne. (N + (N * (-1 * i)))) call abort + end do + + do i = 1, N + b(i) = i + end do + + !$acc parallel copy (b) + !$acc loop seq + do i = 1, N + call worker (b) + end do + !$acc end parallel + + do i = 1, N + if (b(i) .ne. N + i) call abort + end do + + do i = 1, N + a(i) = i + end do + + !$acc parallel copy (a) + !$acc loop seq + do i = 1, N + call vector (a) + end do + !$acc end parallel + + do i = 1, N + if (a(i) .ne. 0) call abort + end do + +contains + +subroutine vector (a) + !$acc routine vector + integer, intent (inout) :: a(N) + integer :: i + + !$acc loop vector + do i = 1, N + a(i) = a(i) - a(i) + end do + +end subroutine vector + +subroutine worker (b) + !$acc routine worker + integer, intent (inout) :: b(M*N) + integer :: i, j + + !$acc loop worker + do i = 1, N + !$acc loop vector + do j = 1, M + b(j + ((i - 1) * M)) = b(j + ((i - 1) * M)) + 1 + end do + end do + +end subroutine worker + +subroutine gang (a) + !$acc routine gang + integer, intent (inout) :: a(N) + integer :: i + + !$acc loop gang + do i = 1, N + a(i) = a(i) - i + end do + +end subroutine gang + +subroutine seq (a) + !$acc routine seq + integer, intent (inout) :: a(M) + integer :: i + + do i = 1, N + a(i) = a(i) + 1 + end do + +end subroutine seq + +end program main |