]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Test that integral simd reductions are precise
authorMatthias Kretz <m.kretz@gsi.de>
Tue, 21 Feb 2023 09:43:13 +0000 (10:43 +0100)
committerMatthias Kretz <m.kretz@gsi.de>
Thu, 25 May 2023 07:04:02 +0000 (09:04 +0200)
Signed-off-by: Matthias Kretz <m.kretz@gsi.de>
libstdc++-v3/ChangeLog:

* testsuite/experimental/simd/tests/reductions.cc: Introduce
max_distance as the type-dependent max error.

(cherry picked from commit 8fda668e0919af9ceda9435f02a1708b375b2913)

libstdc++-v3/testsuite/experimental/simd/tests/reductions.cc

index 1f20961825b76d3b3b4faf5793070ba07b5bf4ee..07ab50a2312494ce0fc728e224c921b7fb86ec87 100644 (file)
@@ -114,6 +114,7 @@ template <typename V>
       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<T> ? 0 : V::size() / 2;
+      ULP_COMPARE(reduce(x), acc, max_distance).on_failure("x = ", x);
     });
   }