On Mon, 6 Apr 2026, 15:18 Matthias Kretz, <[email protected]> wrote:
> From: Matthias Kretz <[email protected]> > > Without SSE2 double precision uses excess precision, leading to test > failures. For now, std::simd remains a tech preview that simply is > disabled without SSE2. > OK > libstdc++-v3/ChangeLog: > > PR libstdc++/124722 > * include/bits/version.def: Check for __SSE2__ rather than x86. > * include/bits/version.h: Regenerate. > * testsuite/std/simd/arithmetic.cc: Build with -msse2. > * testsuite/std/simd/arithmetic_expensive.cc: Likewise. > * testsuite/std/simd/creation.cc: Likewise. > * testsuite/std/simd/creation_expensive.cc: Likewise. > * testsuite/std/simd/loads.cc: Likewise. > * testsuite/std/simd/loads_expensive.cc: Likewise. > * testsuite/std/simd/mask.cc: Likewise. > * testsuite/std/simd/mask2.cc: Likewise. > * testsuite/std/simd/mask2_expensive.cc: Likewise. > * testsuite/std/simd/mask_expensive.cc: Likewise. > * testsuite/std/simd/reductions.cc: Likewise. > * testsuite/std/simd/reductions_expensive.cc: Likewise. > * testsuite/std/simd/shift_left.cc: Likewise. > * testsuite/std/simd/shift_left_expensive.cc: Likewise. > * testsuite/std/simd/shift_right.cc: Likewise. > * testsuite/std/simd/shift_right_expensive.cc: Likewise. > * testsuite/std/simd/simd_alg.cc: Likewise. > * testsuite/std/simd/simd_alg_expensive.cc: Likewise. > * testsuite/std/simd/sse_intrin.cc: Likewise. > * testsuite/std/simd/stores.cc: Likewise. > * testsuite/std/simd/stores_expensive.cc: Likewise. > * testsuite/std/simd/traits_common.cc: Likewise. > * testsuite/std/simd/traits_math.cc: Likewise. > > Signed-off-by: Matthias Kretz <[email protected]> > --- > libstdc++-v3/include/bits/version.def | 2 +- > libstdc++-v3/include/bits/version.h | 2 +- > libstdc++-v3/testsuite/std/simd/arithmetic.cc | 1 + > libstdc++-v3/testsuite/std/simd/arithmetic_expensive.cc | 1 + > libstdc++-v3/testsuite/std/simd/creation.cc | 1 + > libstdc++-v3/testsuite/std/simd/creation_expensive.cc | 1 + > libstdc++-v3/testsuite/std/simd/loads.cc | 1 + > libstdc++-v3/testsuite/std/simd/loads_expensive.cc | 1 + > libstdc++-v3/testsuite/std/simd/mask.cc | 1 + > libstdc++-v3/testsuite/std/simd/mask2.cc | 1 + > libstdc++-v3/testsuite/std/simd/mask2_expensive.cc | 1 + > libstdc++-v3/testsuite/std/simd/mask_expensive.cc | 1 + > libstdc++-v3/testsuite/std/simd/reductions.cc | 1 + > libstdc++-v3/testsuite/std/simd/reductions_expensive.cc | 1 + > libstdc++-v3/testsuite/std/simd/shift_left.cc | 1 + > libstdc++-v3/testsuite/std/simd/shift_left_expensive.cc | 1 + > libstdc++-v3/testsuite/std/simd/shift_right.cc | 1 + > libstdc++-v3/testsuite/std/simd/shift_right_expensive.cc | 1 + > libstdc++-v3/testsuite/std/simd/simd_alg.cc | 1 + > libstdc++-v3/testsuite/std/simd/simd_alg_expensive.cc | 1 + > libstdc++-v3/testsuite/std/simd/sse_intrin.cc | 1 + > libstdc++-v3/testsuite/std/simd/stores.cc | 1 + > libstdc++-v3/testsuite/std/simd/stores_expensive.cc | 1 + > libstdc++-v3/testsuite/std/simd/traits_common.cc | 1 + > libstdc++-v3/testsuite/std/simd/traits_math.cc | 1 + > 25 files changed, 25 insertions(+), 2 deletions(-) > > diff --git a/libstdc++-v3/include/bits/version.def b/libstdc++-v3/include/ > bits/version.def > index 1265f01757c..cfb90533ce4 100644 > --- a/libstdc++-v3/include/bits/version.def > +++ b/libstdc++-v3/include/bits/version.def > @@ -2359,7 +2359,7 @@ ftms = { > cxxmin = 26; > extra_cond = "__cpp_structured_bindings >= 202411L " > "&& __cpp_expansion_statements >= 202411L " > - "&& (__x86_64__ || __i386__)"; // TODO: lift initial restriction to > x86 > + "&& __SSE2__"; // TODO: add more targets > hosted = yes; > }; > }; > diff --git a/libstdc++-v3/include/bits/version.h > b/libstdc++-v3/include/bits/ > version.h > index 00f352089f7..22dd31b9d32 100644 > --- a/libstdc++-v3/include/bits/version.h > +++ b/libstdc++-v3/include/bits/version.h > @@ -2627,7 +2627,7 @@ > #undef __glibcxx_want_contracts > > #if !defined(__cpp_lib_simd) > -# if (__cplusplus > 202302L) && _GLIBCXX_HOSTED && > (__cpp_structured_bindings >= 202411L && __cpp_expansion_statements >= > 202411L > && (__x86_64__ || __i386__)) > +# if (__cplusplus > 202302L) && _GLIBCXX_HOSTED && > (__cpp_structured_bindings >= 202411L && __cpp_expansion_statements >= > 202411L > && __SSE2__) > # define __glibcxx_simd 202506L > # if defined(__glibcxx_want_all) || defined(__glibcxx_want_simd) > # endif > diff --git a/libstdc++-v3/testsuite/std/simd/arithmetic.cc b/libstdc++-v3/ > testsuite/std/simd/arithmetic.cc > index 5d605255f5c..e662a26866c 100644 > --- a/libstdc++-v3/testsuite/std/simd/arithmetic.cc > +++ b/libstdc++-v3/testsuite/std/simd/arithmetic.cc > @@ -1,5 +1,6 @@ > // { dg-do run { target c++26 } } > // { dg-require-effective-target x86 } > +// { dg-additional-options "-msse2" } > > #include "test_setup.h" > > diff --git a/libstdc++-v3/testsuite/std/simd/arithmetic_expensive.cc b/ > libstdc++-v3/testsuite/std/simd/arithmetic_expensive.cc > index 3a476058c7a..e62fe53b5e1 100644 > --- a/libstdc++-v3/testsuite/std/simd/arithmetic_expensive.cc > +++ b/libstdc++-v3/testsuite/std/simd/arithmetic_expensive.cc > @@ -1,5 +1,6 @@ > // { dg-do run { target c++26 } } > // { dg-require-effective-target x86 } > +// { dg-additional-options "-msse2" } > // { dg-timeout-factor 2 } > // { dg-require-effective-target run_expensive_tests } > > diff --git a/libstdc++-v3/testsuite/std/simd/creation.cc b/libstdc++-v3/ > testsuite/std/simd/creation.cc > index 905c09d6449..f567281cdc9 100644 > --- a/libstdc++-v3/testsuite/std/simd/creation.cc > +++ b/libstdc++-v3/testsuite/std/simd/creation.cc > @@ -1,5 +1,6 @@ > // { dg-do run { target c++26 } } > // { dg-require-effective-target x86 } > +// { dg-additional-options "-msse2" } > > #include "test_setup.h" > > diff --git a/libstdc++-v3/testsuite/std/simd/creation_expensive.cc > b/libstdc+ > +-v3/testsuite/std/simd/creation_expensive.cc > index cdb3eba5baf..0f54f3d5d24 100644 > --- a/libstdc++-v3/testsuite/std/simd/creation_expensive.cc > +++ b/libstdc++-v3/testsuite/std/simd/creation_expensive.cc > @@ -1,5 +1,6 @@ > // { dg-do run { target c++26 } } > // { dg-require-effective-target x86 } > +// { dg-additional-options "-msse2" } > // { dg-timeout-factor 2 } > // { dg-require-effective-target run_expensive_tests } > > diff --git a/libstdc++-v3/testsuite/std/simd/loads.cc b/libstdc++-v3/ > testsuite/std/simd/loads.cc > index 8d48b8c55c8..90790a46da3 100644 > --- a/libstdc++-v3/testsuite/std/simd/loads.cc > +++ b/libstdc++-v3/testsuite/std/simd/loads.cc > @@ -1,5 +1,6 @@ > // { dg-do run { target c++26 } } > // { dg-require-effective-target x86 } > +// { dg-additional-options "-msse2" } > > #include "test_setup.h" > #include <numeric> > diff --git a/libstdc++-v3/testsuite/std/simd/loads_expensive.cc > b/libstdc++- > v3/testsuite/std/simd/loads_expensive.cc > index 79ac8700b87..f409d0b9c00 100644 > --- a/libstdc++-v3/testsuite/std/simd/loads_expensive.cc > +++ b/libstdc++-v3/testsuite/std/simd/loads_expensive.cc > @@ -1,5 +1,6 @@ > // { dg-do run { target c++26 } } > // { dg-require-effective-target x86 } > +// { dg-additional-options "-msse2" } > // { dg-timeout-factor 2 } > // { dg-require-effective-target run_expensive_tests } > > diff --git a/libstdc++-v3/testsuite/std/simd/mask.cc > b/libstdc++-v3/testsuite/ > std/simd/mask.cc > index 9bfa356862c..ebd9dc7728d 100644 > --- a/libstdc++-v3/testsuite/std/simd/mask.cc > +++ b/libstdc++-v3/testsuite/std/simd/mask.cc > @@ -1,5 +1,6 @@ > // { dg-do run { target c++26 } } > // { dg-require-effective-target x86 } > +// { dg-additional-options "-msse2" } > > #include "test_setup.h" > #include <utility> > diff --git a/libstdc++-v3/testsuite/std/simd/mask2.cc b/libstdc++-v3/ > testsuite/std/simd/mask2.cc > index 4e65eac4164..d4345c12243 100644 > --- a/libstdc++-v3/testsuite/std/simd/mask2.cc > +++ b/libstdc++-v3/testsuite/std/simd/mask2.cc > @@ -1,5 +1,6 @@ > // { dg-do run { target c++26 } } > // { dg-require-effective-target x86 } > +// { dg-additional-options "-msse2" } > > #include "test_setup.h" > #include <utility> > diff --git a/libstdc++-v3/testsuite/std/simd/mask2_expensive.cc > b/libstdc++- > v3/testsuite/std/simd/mask2_expensive.cc > index d3943874f54..c2a018badac 100644 > --- a/libstdc++-v3/testsuite/std/simd/mask2_expensive.cc > +++ b/libstdc++-v3/testsuite/std/simd/mask2_expensive.cc > @@ -1,5 +1,6 @@ > // { dg-do run { target c++26 } } > // { dg-require-effective-target x86 } > +// { dg-additional-options "-msse2" } > // { dg-require-effective-target run_expensive_tests } > // { dg-timeout-factor 2 } > > diff --git a/libstdc++-v3/testsuite/std/simd/mask_expensive.cc > b/libstdc++-v3/ > testsuite/std/simd/mask_expensive.cc > index dadfd3df879..3f3a89e1d4b 100644 > --- a/libstdc++-v3/testsuite/std/simd/mask_expensive.cc > +++ b/libstdc++-v3/testsuite/std/simd/mask_expensive.cc > @@ -1,5 +1,6 @@ > // { dg-do run { target c++26 } } > // { dg-require-effective-target x86 } > +// { dg-additional-options "-msse2" } > // { dg-timeout-factor 2 } > // { dg-require-effective-target run_expensive_tests } > > diff --git a/libstdc++-v3/testsuite/std/simd/reductions.cc b/libstdc++-v3/ > testsuite/std/simd/reductions.cc > index d40b01f509b..b97eb1be609 100644 > --- a/libstdc++-v3/testsuite/std/simd/reductions.cc > +++ b/libstdc++-v3/testsuite/std/simd/reductions.cc > @@ -1,5 +1,6 @@ > // { dg-do run { target c++26 } } > // { dg-require-effective-target x86 } > +// { dg-additional-options "-msse2" } > > #include "test_setup.h" > > diff --git a/libstdc++-v3/testsuite/std/simd/reductions_expensive.cc b/ > libstdc++-v3/testsuite/std/simd/reductions_expensive.cc > index 52507c499d0..c4cab956aa3 100644 > --- a/libstdc++-v3/testsuite/std/simd/reductions_expensive.cc > +++ b/libstdc++-v3/testsuite/std/simd/reductions_expensive.cc > @@ -1,5 +1,6 @@ > // { dg-do run { target c++26 } } > // { dg-require-effective-target x86 } > +// { dg-additional-options "-msse2" } > // { dg-timeout-factor 2 } > // { dg-require-effective-target run_expensive_tests } > > diff --git a/libstdc++-v3/testsuite/std/simd/shift_left.cc b/libstdc++-v3/ > testsuite/std/simd/shift_left.cc > index 1a7cc195851..111643657e2 100644 > --- a/libstdc++-v3/testsuite/std/simd/shift_left.cc > +++ b/libstdc++-v3/testsuite/std/simd/shift_left.cc > @@ -1,5 +1,6 @@ > // { dg-do run { target c++26 } } > // { dg-require-effective-target x86 } > +// { dg-additional-options "-msse2" } > > #include "test_setup.h" > > diff --git a/libstdc++-v3/testsuite/std/simd/shift_left_expensive.cc b/ > libstdc++-v3/testsuite/std/simd/shift_left_expensive.cc > index c0179503ce9..b7fe4f2f5e6 100644 > --- a/libstdc++-v3/testsuite/std/simd/shift_left_expensive.cc > +++ b/libstdc++-v3/testsuite/std/simd/shift_left_expensive.cc > @@ -1,5 +1,6 @@ > // { dg-do run { target c++26 } } > // { dg-require-effective-target x86 } > +// { dg-additional-options "-msse2" } > // { dg-timeout-factor 2 } > // { dg-require-effective-target run_expensive_tests } > > diff --git a/libstdc++-v3/testsuite/std/simd/shift_right.cc b/libstdc++-v3/ > testsuite/std/simd/shift_right.cc > index 99ae451ffd8..3adee7ffdbf 100644 > --- a/libstdc++-v3/testsuite/std/simd/shift_right.cc > +++ b/libstdc++-v3/testsuite/std/simd/shift_right.cc > @@ -1,5 +1,6 @@ > // { dg-do run { target c++26 } } > // { dg-require-effective-target x86 } > +// { dg-additional-options "-msse2" } > > #include "test_setup.h" > > diff --git a/libstdc++-v3/testsuite/std/simd/shift_right_expensive.cc b/ > libstdc++-v3/testsuite/std/simd/shift_right_expensive.cc > index 2171d8aea05..8136224e491 100644 > --- a/libstdc++-v3/testsuite/std/simd/shift_right_expensive.cc > +++ b/libstdc++-v3/testsuite/std/simd/shift_right_expensive.cc > @@ -1,5 +1,6 @@ > // { dg-do run { target c++26 } } > // { dg-require-effective-target x86 } > +// { dg-additional-options "-msse2" } > // { dg-timeout-factor 2 } > // { dg-require-effective-target run_expensive_tests } > > diff --git a/libstdc++-v3/testsuite/std/simd/simd_alg.cc b/libstdc++-v3/ > testsuite/std/simd/simd_alg.cc > index 98da15e11e3..03ba83de8d4 100644 > --- a/libstdc++-v3/testsuite/std/simd/simd_alg.cc > +++ b/libstdc++-v3/testsuite/std/simd/simd_alg.cc > @@ -1,5 +1,6 @@ > // { dg-do run { target c++26 } } > // { dg-require-effective-target x86 } > +// { dg-additional-options "-msse2" } > > #include "test_setup.h" > #include <utility> > diff --git a/libstdc++-v3/testsuite/std/simd/simd_alg_expensive.cc > b/libstdc+ > +-v3/testsuite/std/simd/simd_alg_expensive.cc > index 066c3f43e87..6f162a4b23a 100644 > --- a/libstdc++-v3/testsuite/std/simd/simd_alg_expensive.cc > +++ b/libstdc++-v3/testsuite/std/simd/simd_alg_expensive.cc > @@ -1,5 +1,6 @@ > // { dg-do run { target c++26 } } > // { dg-require-effective-target x86 } > +// { dg-additional-options "-msse2" } > // { dg-timeout-factor 2 } > // { dg-require-effective-target run_expensive_tests } > > diff --git a/libstdc++-v3/testsuite/std/simd/sse_intrin.cc b/libstdc++-v3/ > testsuite/std/simd/sse_intrin.cc > index 7baa4118c0c..483adb7dc2b 100644 > --- a/libstdc++-v3/testsuite/std/simd/sse_intrin.cc > +++ b/libstdc++-v3/testsuite/std/simd/sse_intrin.cc > @@ -1,5 +1,6 @@ > // { dg-do run { target c++26 } } > // { dg-require-effective-target x86 } > +// { dg-additional-options "-msse2" } > > #include "test_setup.h" > > diff --git a/libstdc++-v3/testsuite/std/simd/stores.cc b/libstdc++-v3/ > testsuite/std/simd/stores.cc > index d5721f7daa2..259b2a98f49 100644 > --- a/libstdc++-v3/testsuite/std/simd/stores.cc > +++ b/libstdc++-v3/testsuite/std/simd/stores.cc > @@ -1,5 +1,6 @@ > // { dg-do run { target c++26 } } > // { dg-require-effective-target x86 } > +// { dg-additional-options "-msse2" } > > #include "test_setup.h" > > diff --git a/libstdc++-v3/testsuite/std/simd/stores_expensive.cc > b/libstdc++- > v3/testsuite/std/simd/stores_expensive.cc > index 36ee941d85d..3244331210c 100644 > --- a/libstdc++-v3/testsuite/std/simd/stores_expensive.cc > +++ b/libstdc++-v3/testsuite/std/simd/stores_expensive.cc > @@ -1,5 +1,6 @@ > // { dg-do run { target c++26 } } > // { dg-require-effective-target x86 } > +// { dg-additional-options "-msse2" } > // { dg-timeout-factor 2 } > // { dg-require-effective-target run_expensive_tests } > > diff --git a/libstdc++-v3/testsuite/std/simd/traits_common.cc > b/libstdc++-v3/ > testsuite/std/simd/traits_common.cc > index 4ee126ccc97..ecbceef06bf 100644 > --- a/libstdc++-v3/testsuite/std/simd/traits_common.cc > +++ b/libstdc++-v3/testsuite/std/simd/traits_common.cc > @@ -1,5 +1,6 @@ > // { dg-do compile { target c++26 } } > // { dg-require-effective-target x86 } > +// { dg-additional-options "-msse2" } > // { dg-timeout-factor 2 } > > #include <simd> > diff --git a/libstdc++-v3/testsuite/std/simd/traits_math.cc b/libstdc++-v3/ > testsuite/std/simd/traits_math.cc > index 2e9339e918c..fc71ff9e359 100644 > --- a/libstdc++-v3/testsuite/std/simd/traits_math.cc > +++ b/libstdc++-v3/testsuite/std/simd/traits_math.cc > @@ -1,5 +1,6 @@ > // { dg-do compile { target c++26 } } > // { dg-require-effective-target x86 } > +// { dg-additional-options "-msse2" } > > #include <simd> > #include <stdfloat> > -- > ────────────────────────────────────────────────────────────────────────── > Dr. Matthias Kretz https://mattkretz.github.io > GSI Helmholtz Center for Heavy Ion Research https://gsi.de > std::simd > ────────────────────────────────────────────────────────────────────────── > > > > >
