https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115454
--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Matthias Kretz <mkr...@gcc.gnu.org>: https://gcc.gnu.org/g:1340ddea0158de3f49aeb75b4013e5fc313ff6f4 commit r15-1500-g1340ddea0158de3f49aeb75b4013e5fc313ff6f4 Author: Matthias Kretz <m.kr...@gsi.de> Date: Fri Jun 14 15:11:25 2024 +0200 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.kr...@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.