]> 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>
Tue, 23 May 2023 08:12:11 +0000 (10:12 +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 f3fd1487cbfa622be34bc362cffc1733656feeab..00fba1b039cd35aaae8a45418948a2c9b91456a9 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);
     });
   }