https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82897
Bug ID: 82897 Summary: Unnecessary zero-extension when loading mask register from memory Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: ubizjak at gmail dot com Target Milestone: --- Following testcase: --cut here-- __mmask16 m; __m512i foo (__m512i x, __m512i y, int a) { return _mm512_mask_srai_epi32 (y, m, x, a); } --cut here-- compiles with -O2 -mavx512f to: movl %edi, %edi vmovdqa64 %zmm1, %zmm2 --> movzwl m(%rip), %eax vmovq %rdi, %xmm3 --> kmovw %eax, %k1 vpsrad %xmm3, %zmm0, %zmm2{%k1} vmovdqa64 %zmm2, %zmm0 ret Note unnecessary zero-extension when mask reg is loaded from memory.