aboutsummaryrefslogtreecommitdiff
path: root/libgomp
diff options
context:
space:
mode:
authorTobias Burnus <tobias@codesourcery.com>2019-11-29 13:59:21 +0000
committerTobias Burnus <tobias@codesourcery.com>2019-11-29 13:59:21 +0000
commit30ee1db0317d15ea4a95b735c77829579965a8c7 (patch)
treeb45ca62901ed76bb7eeffeae78eb03c416528b0a /libgomp
parent3fb24c7862ea7ea8638dc59c6c243e9053d00c13 (diff)
Fortran] OpenACC – permit common blocks in some clauses
* testsuite/libgomp.oacc-fortran/declare-5.f90: Extend by adding a common-block test case. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@278845 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgomp')
-rw-r--r--libgomp/ChangeLog5
-rw-r--r--libgomp/testsuite/libgomp.oacc-fortran/declare-5.f9090
2 files changed, 89 insertions, 6 deletions
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index abbd47eb517..01da5efb8ae 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,8 @@
+2019-11-29 Tobias Burnus <tobias@codesourcery.com>
+
+ * testsuite/libgomp.oacc-fortran/declare-5.f90: Extend by
+ adding a common-block test case.
+
2019-11-29 Jakub Jelinek <jakub@redhat.com>
PR c++/60228
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/declare-5.f90 b/libgomp/testsuite/libgomp.oacc-fortran/declare-5.f90
index 3ab91147e07..4eb0ecadc76 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/declare-5.f90
+++ b/libgomp/testsuite/libgomp.oacc-fortran/declare-5.f90
@@ -3,27 +3,105 @@
module vars
implicit none
real b
- !$acc declare device_resident (b)
+ !$acc declare device_resident (b)
+
+ integer :: x, y, z
+ common /block/ x, y, z
+ !$acc declare device_resident (/block/)
end module vars
+subroutine set()
+ use openacc
+ implicit none
+ integer :: a(5), b(1), c, vals(7)
+ common /another/ a, b, c
+ !$acc declare device_resident (/another/)
+ if (.not. acc_is_present (a)) stop 10
+ if (.not. acc_is_present (b)) stop 11
+ if (.not. acc_is_present (c)) stop 12
+
+ vals = 99
+ ! NOTE: The current (Nov 2019) implementation requires the 'present'
+ ! as it tries to otherwises map the device_resident variables;
+ ! following OpenMP 4.0 semantic: 'a' + 'b' are 'copy' (map fromto) and
+ ! 'c' is firstprivate.
+ !$acc parallel copyout(vals) present(a, b, c)
+ a = [11,12,13,14,15]
+ b = 16
+ c = 47
+ vals(1:5) = a
+ vals(6:6) = b
+ vals(7) = c
+ !$acc end parallel
+
+ if (.not. acc_is_present (a)) stop 13
+ if (.not. acc_is_present (b)) stop 14
+ if (.not. acc_is_present (c)) stop 15
+
+ if (any (vals /= [11,12,13,14,15,16,47])) stop 16
+end subroutine set
+
+subroutine check()
+ use openacc
+ implicit none
+ integer :: g, h(3), i(3)
+ common /another/ g, h, i
+ integer :: val(7)
+ !$acc declare device_resident (/another/)
+ if (.not. acc_is_present (g)) stop 20
+ if (.not. acc_is_present (h)) stop 21
+ if (.not. acc_is_present (i)) stop 22
+
+ val = 99
+ !$acc parallel copyout(val) present(g, h, i)
+ val(5:7) = i
+ val(1) = g
+ val(2:4) = h
+ !$acc end parallel
+
+ if (.not. acc_is_present (g)) stop 23
+ if (.not. acc_is_present (h)) stop 24
+ if (.not. acc_is_present (i)) stop 25
+
+
+ !print *, val
+ if (any (val /= [11,12,13,14,15,16,47])) stop 26
+end subroutine check
+
+
program test
use vars
use openacc
implicit none
real a
+ integer :: k
- if (acc_is_present (b) .neqv. .true.) STOP 1
+ call set()
+ call check()
+
+ if (.not. acc_is_present (b)) stop 1
+ if (.not. acc_is_present (x)) stop 2
+ if (.not. acc_is_present (y)) stop 3
+ if (.not. acc_is_present (z)) stop 4
a = 2.0
+ k = 42
- !$acc parallel copy (a)
+ !$acc parallel copy (a, k)
b = a
a = 1.0
a = a + b
+ x = k
+ y = 7*k - 2*x
+ z = 3*y
+ k = k - z + y
!$acc end parallel
- if (acc_is_present (b) .neqv. .true.) STOP 2
-
- if (a .ne. 3.0) STOP 3
+ if (.not. acc_is_present (b)) stop 5
+ if (.not. acc_is_present (x)) stop 6
+ if (.not. acc_is_present (y)) stop 7
+ if (.not. acc_is_present (z)) stop 8
+ if (a /= 3.0) stop 3
+ if (k /= -378) stop 3
end program test