https://gcc.gnu.org/g:26e33a3c47ab54612f77dbfbd9827d729e8cfa41
commit r17-5029-g26e33a3c47ab54612f77dbfbd9827d729e8cfa41 Author: Tobias Burnus <[email protected]> Date: Fri Oct 9 17:57:21 2026 +0200 OpenMP: Move 'sorry, unimplemented' for simdlen's 'scaled' modifier [PR127723] This is a fixup to commit r17-4947-gfbcafeec06a661. It turned out that the sorry message did not show up on system without targetm.simd_clone.compute_vecsize_and_simdlen; hence, move the check to the FE - for C/C++ to c_omp_declare_simd_clauses_to_numbers - such that it always triggers. (Fortran, 'scaled' modifier support still has to be added.) Note: It would be also fine not to sorry on those, but instead of finding an effective target for this, moving the sorry was simpler. Note additionally that 'simd' is effectively just a hint - such that silently ignoring 'scaled' would also work, but the current solution seems to make more sense until there is some actual support implemented on the vectorizer side. The commit also fixes a not-fully working last-minute line-number change in simdlen-scaled-4.c, which caused it to fail also when the hook was present. PR middle-end/127723 gcc/c-family/ChangeLog: * c-omp.cc (c_omp_declare_simd_clauses_to_numbers): Add sorry diagnostic for simdlen with scaled modifer, moved from omp-simd-clone.cc to ensure it is always active. gcc/ChangeLog: * omp-simd-clone.cc (simd_clone_clauses_extract): Remove sorry diagnostic for simdlen with scaled modifier, moved to c-family/c-omp.cc to ensure it is always active not only when a target hook exists. libgomp/ChangeLog: * libgomp.texi (OpenMP 6.1 Impl. Status): Link to Bugzilla for the pending 'scaled' modifer to the 'simdlen' clause. gcc/testsuite/ChangeLog: * c-c++-common/gomp/simdlen-scaled-1.c: Update dg-message sorry handling. * c-c++-common/gomp/simdlen-scaled-4.c: Ditto. * g++.dg/gomp/simdlen-scaled-1.C: Ditto. * g++.dg/gomp/simdlen-scaled-2.C: Ditto. Diff: --- gcc/c-family/c-omp.cc | 4 ++++ gcc/omp-simd-clone.cc | 4 ---- gcc/testsuite/c-c++-common/gomp/simdlen-scaled-1.c | 9 +++------ gcc/testsuite/c-c++-common/gomp/simdlen-scaled-4.c | 6 ++++-- gcc/testsuite/g++.dg/gomp/simdlen-scaled-1.C | 6 +++--- gcc/testsuite/g++.dg/gomp/simdlen-scaled-2.C | 6 +++--- libgomp/libgomp.texi | 1 + 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/gcc/c-family/c-omp.cc b/gcc/c-family/c-omp.cc index 006e54d1e3d9..e8580ae73e22 100644 --- a/gcc/c-family/c-omp.cc +++ b/gcc/c-family/c-omp.cc @@ -3155,6 +3155,10 @@ c_omp_declare_simd_clauses_to_numbers (tree parms, tree clauses) for (c = clauses; c; c = OMP_CLAUSE_CHAIN (c)) { + if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_SIMDLEN + && OMP_CLAUSE_SIMDLEN_TYPE (c)) + sorry_at (OMP_CLAUSE_LOCATION (c), + "%<simdlen%> clause with %<scaled%> modifier"); if (OMP_CLAUSE_CODE (c) != OMP_CLAUSE_SIMDLEN && OMP_CLAUSE_CODE (c) != OMP_CLAUSE_INBRANCH && OMP_CLAUSE_CODE (c) != OMP_CLAUSE_NOTINBRANCH) diff --git a/gcc/omp-simd-clone.cc b/gcc/omp-simd-clone.cc index 6ff3e583a124..1d670d4f11f3 100644 --- a/gcc/omp-simd-clone.cc +++ b/gcc/omp-simd-clone.cc @@ -346,10 +346,6 @@ simd_clone_clauses_extract (struct cgraph_node *node, tree clauses, case OMP_CLAUSE_SIMDLEN: clone_info->simdlen = TREE_INT_CST_LOW (OMP_CLAUSE_SIMDLEN_EXPR (t)); - if (OMP_CLAUSE_SIMDLEN_TYPE (t)) - sorry_at (DECL_SOURCE_LOCATION (node->decl), - "%<scaled%> modifier specified in %<simdlen%> clause on " - "%<declare simd%> directive for %qD", node->decl); break; case OMP_CLAUSE_LINEAR: { diff --git a/gcc/testsuite/c-c++-common/gomp/simdlen-scaled-1.c b/gcc/testsuite/c-c++-common/gomp/simdlen-scaled-1.c index 32632af23f60..993ece73e0f1 100644 --- a/gcc/testsuite/c-c++-common/gomp/simdlen-scaled-1.c +++ b/gcc/testsuite/c-c++-common/gomp/simdlen-scaled-1.c @@ -5,18 +5,15 @@ #pragma omp declare simd simdlen(scaled(int, 1): 1) void g1(int a) { } -// { dg-message "sorry, unimplemented: 'scaled' modifier specified in 'simdlen' clause on 'declare simd' directive for 'g1'" "" { target c } .-1 } -// { dg-message "sorry, unimplemented: 'scaled' modifier specified in 'simdlen' clause on 'declare simd' directive for 'void g1\\(int\\)'" "" { target c++ } .-2 } +// { dg-message "sorry, unimplemented: 'simdlen' clause with 'scaled' modifier" "" { target *-*-* } .-2 } #pragma omp declare simd simdlen(scaled(float, 2): 2) void g2(int a) { } -// { dg-message "sorry, unimplemented: 'scaled' modifier specified in 'simdlen' clause on 'declare simd' directive for 'g2'" "" { target c } .-1 } -// { dg-message "sorry, unimplemented: 'scaled' modifier specified in 'simdlen' clause on 'declare simd' directive for 'void g2\\(int\\)'" "" { target c++ } .-2 } +// { dg-message "sorry, unimplemented: 'simdlen' clause with 'scaled' modifier" "" { target *-*-* } .-2 } #pragma omp declare simd simdlen(scaled(_Complex double): 4) void g3(int a) { } -// { dg-message "sorry, unimplemented: 'scaled' modifier specified in 'simdlen' clause on 'declare simd' directive for 'g3'" "" { target c } .-1 } -// { dg-message "sorry, unimplemented: 'scaled' modifier specified in 'simdlen' clause on 'declare simd' directive for 'void g3\\(int\\)'" "" { target c++ } .-2 } +// { dg-message "sorry, unimplemented: 'simdlen' clause with 'scaled' modifier" "" { target *-*-* } .-2 } /* { dg-final { scan-tree-dump "__attribute__\\(\\(omp declare simd \\(simdlen\\(scaled\\(int,1\\):1\\)\\)\\)\\)" "gimple" } } */ /* { dg-final { scan-tree-dump "__attribute__\\(\\(omp declare simd \\(simdlen\\(scaled\\(float,2\\):2\\)\\)\\)\\)" "gimple" } } */ diff --git a/gcc/testsuite/c-c++-common/gomp/simdlen-scaled-4.c b/gcc/testsuite/c-c++-common/gomp/simdlen-scaled-4.c index 01f00922d803..574643235e89 100644 --- a/gcc/testsuite/c-c++-common/gomp/simdlen-scaled-4.c +++ b/gcc/testsuite/c-c++-common/gomp/simdlen-scaled-4.c @@ -31,8 +31,10 @@ void f() { } // Once implemented remove ... -// { dg-message "sorry, unimplemented: 'simdlen' clause with 'scaled' modifier" "" { target *-*-* } 19 } -// { dg-message "sorry, unimplemented: 'simdlen' clause with 'scaled' modifier" "" { target *-*-* } 23 } +// { dg-message "sorry, unimplemented: 'simdlen' clause with 'scaled' modifier" "" { target *-*-* } 10 } +// { dg-message "sorry, unimplemented: 'simdlen' clause with 'scaled' modifier" "" { target *-*-* } 11 } +// { dg-message "sorry, unimplemented: 'simdlen' clause with 'scaled' modifier" "" { target *-*-* } 16 } +// { dg-message "sorry, unimplemented: 'simdlen' clause with 'scaled' modifier" "" { target *-*-* } 20 } // ... and the following XFAIL should work ... (it fails because the clause is removed) // { dg-final { scan-tree-dump-times "fvarInt2 \\(1\\);" 1 "gimple" { xfail *-*-* } } } diff --git a/gcc/testsuite/g++.dg/gomp/simdlen-scaled-1.C b/gcc/testsuite/g++.dg/gomp/simdlen-scaled-1.C index 9d826fa7cd86..704269f54e2a 100644 --- a/gcc/testsuite/g++.dg/gomp/simdlen-scaled-1.C +++ b/gcc/testsuite/g++.dg/gomp/simdlen-scaled-1.C @@ -6,17 +6,17 @@ template<typename T, int d, long l> [[omp::decl(declare simd,simdlen(scaled(T, d): l))]] void g1(int a) { } -// { dg-message "sorry, unimplemented: 'scaled' modifier specified in 'simdlen' clause on 'declare simd' directive for 'void g1\\(int\\) \\\[with T = int; int d = 1; long int l = 1\\\]'" "" { target *-*-* } .-1 } +// { dg-message "sorry, unimplemented: 'simdlen' clause with 'scaled' modifier" "" { target *-*-* } .-2 } template<typename T, int d, long l> [[omp::decl(declare simd,simdlen(scaled(T, d + l): sizeof (T)))]] void g2(int a) { } -// { dg-message "sorry, unimplemented: 'scaled' modifier specified in 'simdlen' clause on 'declare simd' directive for 'void g2\\(int\\) \\\[with T = float; int d = 2; long int l = 0\\\]'" "" { target *-*-* } .-1 } +// { dg-message "sorry, unimplemented: 'simdlen' clause with 'scaled' modifier" "" { target *-*-* } .-2 } template<typename T, int d, long l> [[omp::decl(declare simd,simdlen(scaled(T): l/d))]] void g3(int a) { } -// { dg-message "sorry, unimplemented: 'scaled' modifier specified in 'simdlen' clause on 'declare simd' directive for 'void g3\\(int\\) \\\[with T = __complex__ double; int d = 2; long int l = 8\\\]'" "" { target *-*-* } .-1 } +// { dg-message "sorry, unimplemented: 'simdlen' clause with 'scaled' modifier" "" { target *-*-* } .-2 } void f() { g1<int, 1, 1>(1); diff --git a/gcc/testsuite/g++.dg/gomp/simdlen-scaled-2.C b/gcc/testsuite/g++.dg/gomp/simdlen-scaled-2.C index a180402f6b86..729a13b4e857 100644 --- a/gcc/testsuite/g++.dg/gomp/simdlen-scaled-2.C +++ b/gcc/testsuite/g++.dg/gomp/simdlen-scaled-2.C @@ -7,17 +7,17 @@ template<typename T, int d, long l> [[omp::decl(declare simd,simdlen(scaled(T, d): l))]] void g1(int a) { } -// { dg-message "sorry, unimplemented: 'scaled' modifier specified in 'simdlen' clause on 'declare simd' directive for 'void g1\\(int\\) \\\[with T = int; int d = 1; long int l = 1\\\]'" "" { target *-*-* } .-1 } +// { dg-message "sorry, unimplemented: 'simdlen' clause with 'scaled' modifier" "" { target *-*-* } .-2 } template<typename T, int d, long l> [[omp::decl(declare simd,simdlen(scaled(typeof (a), d + l): sizeof (T)))]] void g2(T a) { } -// { dg-message "sorry, unimplemented: 'scaled' modifier specified in 'simdlen' clause on 'declare simd' directive for 'void g2\\(T\\) \\\[with T = float; int d = 2; long int l = 0\\\]'" "" { target *-*-* } .-1 } +// { dg-message "sorry, unimplemented: 'simdlen' clause with 'scaled' modifier" "" { target *-*-* } .-2 } template<typename T, int d, long l> [[omp::decl(declare simd,simdlen(scaled(T): l/d))]] void g3(int a) { } -// { dg-message "sorry, unimplemented: 'scaled' modifier specified in 'simdlen' clause on 'declare simd' directive for 'void g3\\(int\\) \\\[with T = __complex__ double; int d = 2; long int l = 8\\\]'" "" { target *-*-* } .-1 } +// { dg-message "sorry, unimplemented: 'simdlen' clause with 'scaled' modifier" "" { target *-*-* } .-2 } void f() { g1<int, 1, 1>(1); diff --git a/libgomp/libgomp.texi b/libgomp/libgomp.texi index 36fbbb3e3ef5..f3f95df0c8b3 100644 --- a/libgomp/libgomp.texi +++ b/libgomp/libgomp.texi @@ -693,6 +693,7 @@ Technical Report (TR) 15 is the second preview for OpenMP 6.1. @item @code{grid} and @code{tile} modifier to the @code{size} clause @tab N @tab @item New @code{flatten} loop-transforming directive @tab N @tab @item @code{scaled} modifier to @code{simdlen} clause @tab N @tab + (@uref{https://gcc.gnu.org/PR127723,PR127723}) @item Lifted restriction on the first chunk size for the @code{schedule} clause with @code{simd} modifier @tab N @tab @item Change to the used chunk-size with the @code{schedule} clause and no
