https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110479
Bug ID: 110479 Summary: Unnecessary register move Product: gcc Version: unknown Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: tkoenig at gcc dot gnu.org Target Milestone: --- May be related to / a dup of PR110240. The function unsigned int bar(unsigned int a) { return 1u << (((a >> 10) & 3) + 3); } is compiled, with a relatively recent trunk and -O3, to bar: .LFB12: .cfi_startproc shrl $10, %edi movl $1, %eax movl %edi, %ecx andl $3, %ecx addl $3, %ecx sall %cl, %eax ret where the register move seems unnecessary.