https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101142
--- Comment #2 from Hongtao.liu <crazylht at gmail dot com> --- I'm working on a patch which disparages slightly the mask register alternative for bitwise operations(using "?k" in alternatives). It can prevent mask bitwise instruction generation when the input is not allocate as mask registers. Also when allocano cost of GENERAL_REGS is same as MASK_REGS, allocate MASK_REGS first since it has already been disparaged. This is for testcase like below where the input is allocated as mask registers, then mask bitwise instructions should be used here. #include<immintrin.h> volatile __mmask8 foo; void foo_orb (__m512i a, __m512i b, __m512i c, __m512i d) { __mmask8 m1 = _mm512_cmp_epi64_mask (a, b, 2); __mmask8 m2 = _mm512_cmp_epi64_mask (c, d, 4); foo = m1 | m2; } vpcmpq $2, %zmm1, %zmm0, %k0 vpcmpq $4, %zmm3, %zmm2, %k1 korb %k1, %k0, %k2 kmovb %k2, foo(%rip) ret foo: