https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84781
Bug ID: 84781 Summary: [missed optimization] ignore bitmask after movemask Product: gcc Version: 8.0.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: kretz at kde dot org Target Milestone: --- Testcase: https://godbolt.org/g/S3tfrL #include <x86intrin.h> int f(__m128 a) { return _mm_movemask_ps(a) & 0xf; } int f(__m128d a) { return _mm_movemask_pd(a) & 0x3; } int f(__m128i a) { return _mm_movemask_epi8(a) & 0xffffu; } int f(__m256 a) { return _mm256_movemask_ps(a) & 0xff; } int f(__m256d a) { return _mm256_movemask_pd(a) & 0xf; } In all of these functions, the bitmask is a no-op since the movemask cannot yield bits in any of the masked-off places. Consequently, the bitwise and should be dropped.