https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65409
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Ok, the pessimization (your patch vs. my patch) is only at -O0: + movl %edx, %ecx + movl %ecx, %esi + movq %rdx, %rdi + movabsq $-4294967296, %rcx + andq %rdi, %rcx + orq %rsi, %rcx + movq %rcx, %rdx is added, for -O1+ the optimizers manage to fix it up.