From 8fda668e0919af9ceda9435f02a1708b375b2913 Mon Sep 17 00:00:00 2001 From: Matthias Kretz Date: Tue, 21 Feb 2023 10:43:13 +0100 Subject: [PATCH] libstdc++: Test that integral simd reductions are precise Signed-off-by: Matthias Kretz libstdc++-v3/ChangeLog: * testsuite/experimental/simd/tests/reductions.cc: Introduce max_distance as the type-dependent max error. --- libstdc++-v3/testsuite/experimental/simd/tests/reductions.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/testsuite/experimental/simd/tests/reductions.cc b/libstdc++-v3/testsuite/experimental/simd/tests/reductions.cc index 0c4c79feb20f..fed164314d7e 100644 --- a/libstdc++-v3/testsuite/experimental/simd/tests/reductions.cc +++ b/libstdc++-v3/testsuite/experimental/simd/tests/reductions.cc @@ -112,6 +112,7 @@ template T acc = x[0]; for (size_t i = 1; i < V::size(); ++i) acc += x[i]; - ULP_COMPARE(reduce(x), acc, V::size() / 2).on_failure("x = ", x); + const T max_distance = std::is_integral_v ? 0 : V::size() / 2; + ULP_COMPARE(reduce(x), acc, max_distance).on_failure("x = ", x); }); } -- 2.47.2