From: Matthias Kretz <m.kretz@gsi.de>
To: <gcc-patches@gcc.gnu.org>, <libstdc++@gcc.gnu.org>
Subject: [PATCH] libstdc++: Simplify calculation of expected value in simd test
Date: Fri, 26 May 2023 13:09:01 +0200 [thread overview]
Message-ID: <10530000.NyiUUSuA9g@minbar> (raw)
[-- Attachment #1: Type: text/plain, Size: 1104 bytes --]
OK for master and all backports (after 11.4 is done)?
tested on powerpc64le-linux-gnu
----------- 8< ------------
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.
---
.../experimental/simd/tests/integer_operators.cc | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
--
──────────────────────────────────────────────────────────────────────────
Dr. Matthias Kretz https://mattkretz.github.io
GSI Helmholtz Centre for Heavy Ion Research https://gsi.de
stdₓ::simd
──────────────────────────────────────────────────────────────────────────
[-- Attachment #2: 0003-libstdc-Simplify-calculation-of-expected-value-in-si.patch --]
[-- Type: text/x-patch, Size: 1092 bytes --]
diff --git a/libstdc++-v3/testsuite/experimental/simd/tests/integer_operators.cc b/libstdc++-v3/testsuite/experimental/simd/tests/integer_operators.cc
index 7a2bc085e49..08ad49ca710 100644
--- a/libstdc++-v3/testsuite/experimental/simd/tests/integer_operators.cc
+++ b/libstdc++-v3/testsuite/experimental/simd/tests/integer_operators.cc
@@ -179,11 +179,10 @@ for (int s = 1; s < nbits; ++s)
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;
next reply other threads:[~2023-05-26 11:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-26 11:09 Matthias Kretz [this message]
2023-05-26 15:45 ` Jonathan Wakely
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=10530000.NyiUUSuA9g@minbar \
--to=m.kretz@gsi.de \
--cc=gcc-patches@gcc.gnu.org \
--cc=libstdc++@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).