[8/8] libstdc++: Test that integral simd reductions are precise

Message ID 2166927.NgBsaNRSFp@minbar
State Repeat Merge
Headers
Series std::experimental::simd patchset |

Checks

Context Check Description
snail/gcc-patch-check warning Git am fail log

Commit Message

Matthias Kretz Feb. 23, 2023, 8:50 a.m. UTC
  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.
---
 libstdc++-v3/testsuite/experimental/simd/tests/reductions.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)


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

Comments

Jonathan Wakely Feb. 23, 2023, 11:08 a.m. UTC | #1
On Thu, 23 Feb 2023 at 08:51, Matthias Kretz via Libstdc++
<libstdc++@gcc.gnu.org> wrote:
>

OK for all branches.

>
> 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.
> ---
>  libstdc++-v3/testsuite/experimental/simd/tests/reductions.cc | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
>
> --
> ──────────────────────────────────────────────────────────────────────────
>  Dr. Matthias Kretz                           https://mattkretz.github.io
>  GSI Helmholtz Centre for Heavy Ion Research               https://gsi.de
>  stdₓ::simd
> ──────────────────────────────────────────────────────────────────────────
  

Patch

diff --git a/libstdc++-v3/testsuite/experimental/simd/tests/reductions.cc b/libstdc++-v3/testsuite/experimental/simd/tests/reductions.cc
index 0c4c79feb20..fed164314d7 100644
--- a/libstdc++-v3/testsuite/experimental/simd/tests/reductions.cc
+++ b/libstdc++-v3/testsuite/experimental/simd/tests/reductions.cc
@@ -112,6 +112,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);
     });
   }