public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-10834] libstdc++: Simplify calculation of expected value in simd test
@ 2023-05-30 20:06 Matthias Kretz
  0 siblings, 0 replies; only message in thread
From: Matthias Kretz @ 2023-05-30 20:06 UTC (permalink / raw)
  To: gcc-cvs, libstdc++-cvs

https://gcc.gnu.org/g:c4dc05d1f617c5763be10cf53cc2fac22fa1dcd2

commit r11-10834-gc4dc05d1f617c5763be10cf53cc2fac22fa1dcd2
Author: Matthias Kretz <m.kretz@gsi.de>
Date:   Thu May 25 12:53:06 2023 +0200

    libstdc++: Simplify calculation of expected value in simd test
    
    This avoids a failure on PR109964.
    
    Signed-off-by: Matthias Kretz <m.kretz@gsi.de>
    
    libstdc++-v3/ChangeLog:
    
            * testsuite/experimental/simd/tests/integer_operators.cc:
            Compute expected value differently to avoid getting turned into
            a vector shift.
    
    (cherry picked from commit 3e2689e568425f14d6728504ad6f5d32b90320ad)

Diff:
---
 .../testsuite/experimental/simd/tests/integer_operators.cc       | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/libstdc++-v3/testsuite/experimental/simd/tests/integer_operators.cc b/libstdc++-v3/testsuite/experimental/simd/tests/integer_operators.cc
index 7416952ad42..7a456b9f3bf 100644
--- a/libstdc++-v3/testsuite/experimental/simd/tests/integer_operators.cc
+++ b/libstdc++-v3/testsuite/experimental/simd/tests/integer_operators.cc
@@ -180,11 +180,10 @@ template <typename V>
 	  for (int j = 0; j < 100; ++j)
 	    {
 	      const V seq([&](auto i) -> T { return (j + i) % n_promo_bits; });
-	      COMPARE(V(1) >> seq, V([&](auto i) { return T(T(1) >> seq[i]); }))
-		<< "seq = " << seq;
-	      COMPARE(make_value_unknown(V(1)) >> make_value_unknown(seq),
-		V([&](auto i) { return T(T(1) >> seq[i]); }))
-		<< "seq = " << seq;
+	      const V expect([&](auto i) { return seq[i] == 0 ? T(1) : T(0); });
+	      COMPARE(V(1) >> seq, expect) << "\nseq = " << seq;
+	      COMPARE(make_value_unknown(V(1)) >> make_value_unknown(seq), expect)
+		<< "\nseq = " << seq;
 	    }
 	  for_constexpr<int, 0, n_promo_bits - 1>([](auto shift_ic) {
 	    constexpr int shift = shift_ic;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-05-30 20:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-30 20:06 [gcc r11-10834] libstdc++: Simplify calculation of expected value in simd test Matthias Kretz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).