https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115454
--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-11 branch has been updated by Matthias Kretz <mkr...@gcc.gnu.org>: https://gcc.gnu.org/g:a0b92a530ad61389c0cdeb8d8ece4677e019c28e commit r11-11517-ga0b92a530ad61389c0cdeb8d8ece4677e019c28e 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. (cherry picked from commit 4787960dcaf0de3f46464960f5246de9b3c69a06)