https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120034
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- We get (-O2 -mbmi2): bzhi_emulation1: .LFB1: .cfi_startproc movq $-1, %rax shlx %rsi, %rax, %rax notl %eax andl %edi, %eax ret that has single uses only. The issue is likely that 1ULL << index is well-defined for value >= 32 and we likely fail to "saturate" this case when it's demoted to SImode for the AND.