aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorTobias Burnus <tobias@codesourcery.com>2020-08-12 18:09:57 +0200
committerGiuliano Belinassi <giuliano.belinassi@usp.br>2020-08-17 15:08:05 -0300
commit3a839318a240e36629b7128bd9fbf6dd762c8c0f (patch)
treefd4640d65463612f3f54a66980b305e2f04a6125 /gcc/testsuite
parent63f132690227393b000921804c4a3686a98e1dc8 (diff)
Fortran: Add support for OpenMP's nontemporal clause
gcc/fortran/ChangeLog: * gfortran.h: Add OMP_LIST_NONTEMPORAL. * dump-parse-tree.c (show_omp_clauses): Dump it * openmp.c (enum omp_mask1): Add OMP_CLAUSE_NOTEMPORAL. (OMP_SIMD_CLAUSES): Add it. (gfc_match_omp_clauses): Match nontemporal clause. * trans-openmp.c (gfc_trans_omp_clauses): Process nontemporal clause. gcc/testsuite/ChangeLog: * gfortran.dg/gomp/nontemporal-1.f90: New test. * gfortran.dg/gomp/nontemporal-2.f90: New test.
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/nontemporal-1.f9025
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/nontemporal-2.f9026
2 files changed, 51 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/gomp/nontemporal-1.f90 b/gcc/testsuite/gfortran.dg/gomp/nontemporal-1.f90
new file mode 100644
index 00000000000..21a94db0ba8
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/nontemporal-1.f90
@@ -0,0 +1,25 @@
+! { dg-do compile }
+! { dg-additional-options "-O2 -fdump-tree-original" }
+
+module m
+ integer :: a(:), b(1024), c(1024), d(1024)
+ allocatable :: a
+end module m
+
+subroutine foo
+ use m
+ implicit none
+ integer :: i
+ !$omp simd nontemporal (a, b)
+ do i = 1, 1024
+ a(i) = b(i) + c(i)
+ end do
+
+ !$omp simd nontemporal (d)
+ do i = 1, 1024
+ d(i) = 2 * c(i)
+ end do
+end subroutine foo
+
+! { dg-final { scan-tree-dump-times "#pragma omp simd linear\\(i:1\\) nontemporal\\(a\\) nontemporal\\(b\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times "#pragma omp simd linear\\(i:1\\) nontemporal\\(d\\)" 1 "original" } }
diff --git a/gcc/testsuite/gfortran.dg/gomp/nontemporal-2.f90 b/gcc/testsuite/gfortran.dg/gomp/nontemporal-2.f90
new file mode 100644
index 00000000000..c880bedb1e2
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/nontemporal-2.f90
@@ -0,0 +1,26 @@
+! { dg-do compile }
+
+module m
+ integer, allocatable :: a(:), b(:), c(:), d(:)
+end module m
+
+subroutine foo
+ use m
+ implicit none
+ integer :: i
+
+ !$omp simd nontemporal (a, b) aligned (a, b, c)
+ do i = 1, ubound(a, dim=1)
+ a(i) = b(i) + c(i)
+ end do
+
+ !$omp simd nontemporal (d) nontemporal (d) ! { dg-error "'d' present on multiple clauses" }
+ do i = 1, ubound(d, dim=1)
+ d(i) = 2 * c(i)
+ end do
+
+ !$omp simd nontemporal (a, b, b) ! { dg-error "'b' present on multiple clauses" }
+ do i = 1, ubound(a, dim=1)
+ a(i) = a(i) + b(i) + c(i)
+ end do
+end subroutine foo