aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Burnus <tobias@codesourcery.com>2019-10-08 14:44:53 +0200
committerThomas Schwinge <thomas@codesourcery.com>2020-03-03 12:51:25 +0100
commit4f4c1ea2d278ee5050b32e0a9d429b060c6eaddb (patch)
tree603ec0bb453002eec65fd989e60c566b0efa952e
parent8e86b4a5d0fd9c08fdc6069184cc98f0871317cb (diff)
downloadgcc-4f4c1ea2d278ee5050b32e0a9d429b060c6eaddb.zip
gcc-4f4c1ea2d278ee5050b32e0a9d429b060c6eaddb.tar.gz
gcc-4f4c1ea2d278ee5050b32e0a9d429b060c6eaddb.tar.bz2
Fortran - fix OpenMP 'target simd'
Backported from mainline. gcc/fortran/ * parse.c (parse_executable): Add missing ST_OMP_TARGET_SIMD. libgomp/ * testsuite/libgomp.fortran/target-simd.f90: New. (cherry picked from openacc-gcc-9-branch commit 54fbada7d4d38e420efb5a10d39e03b02533b1e7)
-rw-r--r--gcc/fortran/ChangeLog.omp7
-rw-r--r--gcc/fortran/parse.c1
-rw-r--r--gcc/testsuite/ChangeLog.omp7
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/target-simd.f9026
4 files changed, 41 insertions, 0 deletions
diff --git a/gcc/fortran/ChangeLog.omp b/gcc/fortran/ChangeLog.omp
index fe2cf26..4bcd912 100644
--- a/gcc/fortran/ChangeLog.omp
+++ b/gcc/fortran/ChangeLog.omp
@@ -3,6 +3,13 @@
Backported from mainline
2019-10-08 Tobias Burnus <tobias@codesourcery.com>
+ * parse.c (parse_executable): Add missing ST_OMP_TARGET_SIMD.
+
+2019-10-08 Tobias Burnus <tobias@codesourcery.com>
+
+ Backported from mainline
+ 2019-10-08 Tobias Burnus <tobias@codesourcery.com>
+
* match.h (gfc_match_omp_eos_error): Renamed from gfc_match_omp_eos.
* openmp.c (gfc_match_omp_eos): Make static.
(gfc_match_omp_eos_error): New.
diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c
index 3b50c21..66df384 100644
--- a/gcc/fortran/parse.c
+++ b/gcc/fortran/parse.c
@@ -5447,6 +5447,7 @@ parse_executable (gfc_statement st)
case ST_OMP_SIMD:
case ST_OMP_TARGET_PARALLEL_DO:
case ST_OMP_TARGET_PARALLEL_DO_SIMD:
+ case ST_OMP_TARGET_SIMD:
case ST_OMP_TARGET_TEAMS_DISTRIBUTE:
case ST_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO:
case ST_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD:
diff --git a/gcc/testsuite/ChangeLog.omp b/gcc/testsuite/ChangeLog.omp
index bd26e3d..a208c8f 100644
--- a/gcc/testsuite/ChangeLog.omp
+++ b/gcc/testsuite/ChangeLog.omp
@@ -3,6 +3,13 @@
Backported from mainline
2019-10-08 Tobias Burnus <tobias@codesourcery.com>
+ * testsuite/libgomp.fortran/target-simd.f90: New.
+
+2019-10-08 Tobias Burnus <tobias@codesourcery.com>
+
+ Backported from mainline
+ 2019-10-08 Tobias Burnus <tobias@codesourcery.com>
+
* gfortran.dg/goacc/continuation-free-form.f95: Update dg-error.
2019-10-02 Tobias Burnus <tobias@codesourcery.com>
diff --git a/gcc/testsuite/gfortran.dg/gomp/target-simd.f90 b/gcc/testsuite/gfortran.dg/gomp/target-simd.f90
new file mode 100644
index 0000000..733420f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/target-simd.f90
@@ -0,0 +1,26 @@
+! { dg-do compile }
+
+program test
+ implicit none
+ real, allocatable :: a(:), b(:)
+ integer :: i
+
+ a = [(i, i = 1, 100)]
+ allocate(b, mold=a)
+ b = 0
+
+ !$omp target simd map(to:a) map(from:b)
+ do i = 0, size(a)
+ b(i) = 5.0 * a(i)
+ end do
+
+ if (any (b - 5.0 *a > 10.0*epsilon(a))) call abort()
+
+ !$omp target simd map(to:a) map(from:b)
+ do i = 0, size(a)
+ b(i) = 2.0 * a(i)
+ end do
+ !$omp end target simd
+
+ if (any (b - 2.0 *a > 10.0*epsilon(a))) call abort()
+end program test