From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1534) id 4C2FF385734A; Wed, 5 Oct 2022 13:40:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4C2FF385734A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1664977254; bh=FRNzzjZmyd1he6/tXefauaQzKgtjMSjRz03msIM/g5E=; h=From:To:Subject:Date:From; b=L9KPgApkZjjkNFy1HW4PpfhypVjIasxGHzGFuGizvjJE0Qxao/OsA1ABN3dEehlMV lNzphHQMr4LnCFhTVjqXikKH3x5ge6xEFPyqj6xNV7ponhTe072V+G5Gx0aFbFRtOp iNw41Wms2nS2gG9LRgTCTDxVo39EMt5UU39YARkk= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Tobias Burnus To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/omp/gcc-12] OpenMP: Update invoke.texi and fix fortran/parse.cc for -fopenmp-simd X-Act-Checkin: gcc X-Git-Author: Tobias Burnus X-Git-Refname: refs/heads/devel/omp/gcc-12 X-Git-Oldrev: e9c986d63ea700d0ff6f7f7158921414ff8dbafc X-Git-Newrev: 5c341c056b0706d88a03a10061cdaf356b737bb4 Message-Id: <20221005134054.4C2FF385734A@sourceware.org> Date: Wed, 5 Oct 2022 13:40:54 +0000 (GMT) List-Id: https://gcc.gnu.org/g:5c341c056b0706d88a03a10061cdaf356b737bb4 commit 5c341c056b0706d88a03a10061cdaf356b737bb4 Author: Tobias Burnus Date: Wed Oct 5 15:39:03 2022 +0200 OpenMP: Update invoke.texi and fix fortran/parse.cc for -fopenmp-simd Split off from the 'Fortran: Add OpenMP's assume(s) directives' patch. gcc/ * doc/invoke.texi (-fopenmp): Mention C++ attribut syntax. (-fopenmp-simd): Likewise; update permitted directives. gcc/fortran/ * parse.cc (decode_omp_directive): Handle '(end) loop' and 'scan' also with -fopenmp-simd. gcc/testsuite/ * gfortran.dg/gomp/openmp-simd-7.f90: New test. (cherry picked from commit 8792047470073df0da4a5b91997d6058193d7676) Diff: --- gcc/ChangeLog.omp | 8 ++++++++ gcc/doc/invoke.texi | 12 ++++++++---- gcc/fortran/ChangeLog.omp | 8 ++++++++ gcc/fortran/parse.cc | 6 +++--- gcc/testsuite/ChangeLog.omp | 7 +++++++ gcc/testsuite/gfortran.dg/gomp/openmp-simd-7.f90 | 23 +++++++++++++++++++++++ 6 files changed, 57 insertions(+), 7 deletions(-) diff --git a/gcc/ChangeLog.omp b/gcc/ChangeLog.omp index 72151ab2673..52bc562d95e 100644 --- a/gcc/ChangeLog.omp +++ b/gcc/ChangeLog.omp @@ -1,3 +1,11 @@ +2022-10-05 Tobias Burnus + + Backport from mainline: + 2022-10-04 Tobias Burnus + + * doc/invoke.texi (-fopenmp): Mention C++ attribut syntax. + (-fopenmp-simd): Likewise; update permitted directives. + 2022-10-05 Tobias Burnus Backport from mainline: diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 52ba1c84bec..8bd72790056 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -2746,7 +2746,8 @@ permitted. @item -fopenmp @opindex fopenmp @cindex OpenMP parallel -Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and +Enable handling of OpenMP directives @code{#pragma omp} in C/C++, +@code{[[omp::directive(...)]]} and @code{[[omp::sequence(...)]]} in C++ and @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the compiler generates parallel code according to the OpenMP Application Program Interface v4.5 @w{@uref{https://www.openmp.org}}. This option @@ -2758,9 +2759,12 @@ have support for @option{-pthread}. @option{-fopenmp} implies @opindex fopenmp-simd @cindex OpenMP SIMD @cindex SIMD -Enable handling of OpenMP's SIMD directives with @code{#pragma omp} -in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives -are ignored. +Enable handling of OpenMP's @code{simd}, @code{declare simd}, +@code{declare reduction}, @code{assume}, @code{ordered}, @code{scan}, +@code{loop} directives and combined or composite directives with +@code{simd} as constituent with @code{#pragma omp} in C/C++, +@code{[[omp::directive(...)]]} and @code{[[omp::sequence(...)]]} in C++ +and @code{!$omp} in Fortran. Other OpenMP directives are ignored. @item -fopenmp-target-simd-clone @opindex fopenmp-target-simd-clone diff --git a/gcc/fortran/ChangeLog.omp b/gcc/fortran/ChangeLog.omp index 5d056d031c5..e1f67c8c0c3 100644 --- a/gcc/fortran/ChangeLog.omp +++ b/gcc/fortran/ChangeLog.omp @@ -1,3 +1,11 @@ +2022-10-05 Tobias Burnus + + Backport from mainline: + 2022-10-04 Tobias Burnus + + * parse.cc (decode_omp_directive): Handle '(end) loop' and 'scan' + also with -fopenmp-simd. + 2022-09-30 Tobias Burnus Backport from mainline: diff --git a/gcc/fortran/parse.cc b/gcc/fortran/parse.cc index fc88111a7ad..28d9cccdd25 100644 --- a/gcc/fortran/parse.cc +++ b/gcc/fortran/parse.cc @@ -931,7 +931,7 @@ decode_omp_directive (void) matcho ("end distribute", gfc_match_omp_eos_error, ST_OMP_END_DISTRIBUTE); matchs ("end do simd", gfc_match_omp_end_nowait, ST_OMP_END_DO_SIMD); matcho ("end do", gfc_match_omp_end_nowait, ST_OMP_END_DO); - matcho ("end loop", gfc_match_omp_eos_error, ST_OMP_END_LOOP); + matchs ("end loop", gfc_match_omp_eos_error, ST_OMP_END_LOOP); matchs ("end simd", gfc_match_omp_eos_error, ST_OMP_END_SIMD); matcho ("end masked taskloop simd", gfc_match_omp_eos_error, ST_OMP_END_MASKED_TASKLOOP_SIMD); @@ -1034,7 +1034,7 @@ decode_omp_directive (void) matcho ("nothing", gfc_match_omp_nothing, ST_NONE); break; case 'l': - matcho ("loop", gfc_match_omp_loop, ST_OMP_LOOP); + matchs ("loop", gfc_match_omp_loop, ST_OMP_LOOP); break; case 'o': if (gfc_match ("ordered depend (") == MATCH_YES @@ -1081,7 +1081,7 @@ decode_omp_directive (void) matcho ("requires", gfc_match_omp_requires, ST_OMP_REQUIRES); break; case 's': - matcho ("scan", gfc_match_omp_scan, ST_OMP_SCAN); + matchs ("scan", gfc_match_omp_scan, ST_OMP_SCAN); matcho ("scope", gfc_match_omp_scope, ST_OMP_SCOPE); matcho ("sections", gfc_match_omp_sections, ST_OMP_SECTIONS); matcho ("section", gfc_match_omp_eos_error, ST_OMP_SECTION); diff --git a/gcc/testsuite/ChangeLog.omp b/gcc/testsuite/ChangeLog.omp index 9dc42e62822..b26b68f3e3e 100644 --- a/gcc/testsuite/ChangeLog.omp +++ b/gcc/testsuite/ChangeLog.omp @@ -1,3 +1,10 @@ +2022-10-05 Tobias Burnus + + Backport from mainline: + 2022-10-04 Tobias Burnus + + * gfortran.dg/gomp/openmp-simd-7.f90: New test. + 2022-10-04 Tobias Burnus Backport from mainline: diff --git a/gcc/testsuite/gfortran.dg/gomp/openmp-simd-7.f90 b/gcc/testsuite/gfortran.dg/gomp/openmp-simd-7.f90 new file mode 100644 index 00000000000..d7010bb4288 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/openmp-simd-7.f90 @@ -0,0 +1,23 @@ +! { dg-options "-fno-openmp -fopenmp-simd -fdump-tree-original" } + +subroutine foo (a, b) + integer, contiguous :: a(:), b(:) + integer :: i + !$omp simd reduction (inscan, +:r) + do i = 1, 1024 + r = r + a(i) + !$omp scan inclusive(r) + b(i) = r + end do + !$omp end simd + + !$omp loop + do i = 1, 1024 + a(i) = a(i) + i + end do + !$omp end loop +end + +! { dg-final { scan-tree-dump "#pragma omp simd linear\\(i:1\\) reduction\\(inscan,\\+:r\\)" "original" } } +! { dg-final { scan-tree-dump "#pragma omp scan inclusive\\(r\\)" "original" } } +! { dg-final { scan-tree-dump "#pragma omp loop" "original" } }