[PATCH] libstdc++: Fix find_last_set(simd_mask) to ignore padding bits
Matthias Kretz
m.kretz@gsi.de
Thu Jun 20 07:28:20 GMT 2024
Ping.
I fear that time to make GCC 11.5 is running out.
-Matthias
On Tuesday, 18 June 2024 08:22:13 GMT+2 Matthias Kretz wrote:
> Tested on x86_64-linux-gnu (also -m32 and -mx32), aarch64-linux-gnu, and
> arm- linux-gnueabi(hf).
>
> OK for trunk and backports? OK, to go for GCC 11.5 as early as possible?
>
> ----------------------- 8< -----------------------
>
> With the change to the AVX512 find_last_set implementation, the change
> to AVX512 operator!= is unnecessary. However, the latter was not
> producing optimal code and unnecessarily set the padding bits. In
> theory, the compiler could determine that with the new !=
> implementation, the bit operation for clearing the padding bits is a
> no-op and can be elided.
>
> Signed-off-by: Matthias Kretz <m.kretz@gsi.de>
>
> libstdc++-v3/ChangeLog:
>
> PR libstdc++/115454
> * include/experimental/bits/simd_x86.h (_S_not_equal_to): Use
> neq comparison instead of bitwise negation after eq.
> (_S_find_last_set): Clear unused high bits before computing
> bit_width.
> * testsuite/experimental/simd/pr115454_find_last_set.cc: New
> test.
> ---
> .../include/experimental/bits/simd_x86.h | 26 +++++-----
> .../simd/pr115454_find_last_set.cc | 49 +++++++++++++++++++
> 2 files changed, 62 insertions(+), 13 deletions(-)
> create mode 100644 libstdc++-v3/testsuite/experimental/simd/
> pr115454_find_last_set.cc
>
>
> --
> ──────────────────────────────────────────────────────────────────────────
> Dr. Matthias Kretz https://mattkretz.github.io
> GSI Helmholtz Centre for Heavy Ion Research https://gsi.de
> stdₓ::simd
> ──────────────────────────────────────────────────────────────────────────
--
──────────────────────────────────────────────────────────────────────────
Dr. Matthias Kretz https://mattkretz.github.io
GSI Helmholtz Center for Heavy Ion Research https://gsi.de
std::simd
──────────────────────────────────────────────────────────────────────────
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part.
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20240620/b0a31536/attachment.sig>
More information about the Libstdc++
mailing list