]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Fix find_last_set(simd_mask) to ignore padding bits
authorMatthias Kretz <m.kretz@gsi.de>
Fri, 14 Jun 2024 13:11:25 +0000 (15:11 +0200)
committerMatthias Kretz <m.kretz@gsi.de>
Thu, 20 Jun 2024 18:44:06 +0000 (20:44 +0200)
commita0b92a530ad61389c0cdeb8d8ece4677e019c28e
treeb6930061d7f5d912a9b4299949f8626215866b29
parenta0dac8fdf477f0ee7fa4f54bbfc4cafec944b042
libstdc++: Fix find_last_set(simd_mask) to ignore padding bits

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.

(cherry picked from commit 4787960dcaf0de3f46464960f5246de9b3c69a06)
libstdc++-v3/include/experimental/bits/simd_x86.h
libstdc++-v3/testsuite/experimental/simd/pr115454_find_last_set.cc [new file with mode: 0644]