[PATCH] libstdc++: Implement P4012R1 while reverting P3844R2 (consteval simd broadcast)

Matthias Kretz m.kretz@gsi.de
Tue Apr 21 12:33:50 GMT 2026


Jonathan Wakely [Tuesday, 21 April 2026, 11:57:27 CEST]:
> On Mon, 20 Apr 2026 at 16:52, Matthias Kretz <MatthiasKretz@gmx.net> wrote:
> 
> 
> > Tested on x86_64-linux-gnu (unix/-march=native and unix/-m32/-march=i686).
> > 
> > OK for trunk?
> 
> OK, thanks

Sorry, my v2 patch for this issue got stuck in my outbox. The additional 
changes in the v2 patch are (they are needed for -ffast-math tests and even 
then it still doesn't compile because of missing 'fabs'):

in arithmetic.cc:

@@ -259,10 +260,10 @@ struct Tests
     ADD_TEST(divide0, std::is_floating_point_v<T> && !is_iec559) {
       std::tuple{T(2), init_vec<V, 1, 2, 3, 4, 5, 6, 7>},
       [](auto& t, V x, V y) {
-	t.verify_equal_to_ulp(x / x, V(T(1)), 1);
-	t.verify_equal_to_ulp(T(3) / x, V(T(3) / T(2)), 1);
-	t.verify_equal_to_ulp(x / T(3), V(T(2) / T(3)), 1);
-	t.verify_equal_to_ulp(y / x, init_vec<V, .5, 1, 1.5, 2, 2.5, 3, 3.5>, 
1);
+	t.verify_equal_to_ulp(x / x, V(T(1)), std::cw<1>);
+	t.verify_equal_to_ulp(T(3) / x, V(T(3) / T(2)), std::cw<1>);
+	t.verify_equal_to_ulp(x / T(3), V(T(2) / T(3)), std::cw<1>);
+	t.verify_equal_to_ulp(y / x, init_vec<V, .5, 1, 1.5, 2, 2.5, 3, 3.5>, 
std::cw<1>);
       }
     };
 
@@ -272,18 +273,18 @@ struct Tests
       [](auto& t, V a) {
 	V b = std::cw<2>;
 	V ref([&](int i) { return a[i] / 2; });
-	t.verify_equal_to_ulp(a / b, ref, 1);
+	t.verify_equal_to_ulp(a / b, ref, std::cw<1>);
 	a = select(a == std::cw<0>, T(1), a);
 	// -freciprocal-math together with flush-to-zero makes
 	// the following range restriction necessary (i.e.
 	// 1/|a| must be >= min). Intel vrcpps and vrcp14ps
 	// need some extra slack (use 1.1 instead of 1).
 	a = select(fabs(a) >= T(1.1) / norm_min, T(1), a);
-	t.verify_equal_to_ulp(a / a, V(1), 1)("\na = ", a);
+	t.verify_equal_to_ulp(a / a, V(std::cw<1>), std::cw<1>)("\na = ", a);
 	ref = V([&](int i) { return 2 / a[i]; });
-	t.verify_equal_to_ulp(b / a, ref, 1)("\na = ", a);
-	t.verify_equal_to_ulp(b /= a, ref, 1);
-	t.verify_equal_to_ulp(b, ref, 1);
+	t.verify_equal_to_ulp(b / a, ref, std::cw<1>)("\na = ", a);
+	t.verify_equal_to_ulp(b /= a, ref, std::cw<1>);
+	t.verify_equal_to_ulp(b, ref, std::cw<1>);
       }
     };

-- 
──────────────────────────────────────────────────────────────────────────
 Dr. Matthias Kretz                           https://mattkretz.github.io
 GSI Helmholtz Center for Heavy Ion Research               https://gsi.de
 std::simd
──────────────────────────────────────────────────────────────────────────


More information about the Libstdc++ mailing list