]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fortran - fix OpenMP 'target simd'
authorTobias Burnus <tobias@codesourcery.com>
Tue, 8 Oct 2019 12:44:53 +0000 (14:44 +0200)
committerThomas Schwinge <thomas@codesourcery.com>
Tue, 3 Mar 2020 11:51:25 +0000 (12:51 +0100)
        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)

gcc/fortran/ChangeLog.omp
gcc/fortran/parse.c
gcc/testsuite/ChangeLog.omp
gcc/testsuite/gfortran.dg/gomp/target-simd.f90 [new file with mode: 0644]

index fe2cf26c11728baff83fdc748c10de9954271709..4bcd912811be3a3deeb761804b59ff12f1604c3d 100644 (file)
@@ -1,3 +1,10 @@
+2019-10-08  Tobias Burnus  <tobias@codesourcery.com>
+
+       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
index 3b50c2174c9d2bd36bd0d54877df3899e58b7cf6..66df3843b9dbf58d4bab88e8985091d083d6d164 100644 (file)
@@ -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:
index bd26e3d91e034d839d8c124ea19d102335be2bc4..a208c8f56fd5df5cb086d90d76db88d700fbfc00 100644 (file)
@@ -1,3 +1,10 @@
+2019-10-08  Tobias Burnus  <tobias@codesourcery.com>
+
+       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
diff --git a/gcc/testsuite/gfortran.dg/gomp/target-simd.f90 b/gcc/testsuite/gfortran.dg/gomp/target-simd.f90
new file mode 100644 (file)
index 0000000..733420f
--- /dev/null
@@ -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