https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89676
Bug ID: 89676 Summary: Redundant moves for long long shift on 32bit x86 Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: ubizjak at gmail dot com Target Milestone: --- Following testcase: --cut here-- unsigned long long foo (unsigned long long i) { return i << 3; } --cut here-- compiles for 32bit x86 to (-O2): pushl %ebx movl 8(%esp), %ecx movl 12(%esp), %ebx movl %ecx, %eax movl %ebx, %edx popl %ebx shldl $3, %eax, %edx sall $3, %eax ret There is unnecessary move to %ecx/%ebx pair in the above code. Clang creates: movl 4(%esp), %eax movl 8(%esp), %edx shldl $3, %eax, %edx shll $3, %eax retl