https://gcc.gnu.org/g:1cfdd868cea8583ba498fcc22690070d4cb24ee1

commit r16-8480-g1cfdd868cea8583ba498fcc22690070d4cb24ee1
Author: Matthias Kretz <[email protected]>
Date:   Sat Apr 4 11:40:38 2026 +0200

    libstdc++: Require SSE2 for std::simd [PR124722]
    
    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.
    
    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]>

Diff:
---
 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 1265f01757c9..cfb90533ce45 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 00f352089f7a..22dd31b9d324 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 5d605255f5ca..e662a26866c6 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 3a476058c7a0..e62fe53b5e15 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 905c09d6449d..f567281cdc99 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 cdb3eba5baf5..0f54f3d5d24d 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 8d48b8c55c8c..90790a46da3d 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 79ac8700b87e..f409d0b9c00d 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 9bfa356862c8..ebd9dc7728d3 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 4e65eac4164f..d4345c12243d 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 d3943874f54a..c2a018badac0 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 dadfd3df879e..3f3a89e1d4b9 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 d40b01f509b1..b97eb1be6097 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 52507c499d03..c4cab956aa37 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 1a7cc195851b..111643657e23 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 c0179503ce9e..b7fe4f2f5e69 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 99ae451ffd89..3adee7ffdbfa 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 2171d8aea05c..8136224e491b 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 98da15e11e3d..03ba83de8d40 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 066c3f43e878..6f162a4b23a4 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 7baa4118c0cf..483adb7dc2b9 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 d5721f7daa27..259b2a98f49c 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 36ee941d85db..3244331210c3 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 4ee126ccc973..ecbceef06bf3 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 2e9339e918cb..fc71ff9e3590 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>

Reply via email to