https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101716
Bug ID: 101716
Summary: lea does not have a zero_extend version of it
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: enhancement
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
Target: x86_64-*-*
Take:
unsigned long long sample1(unsigned long long m) {
unsigned int t = -1;
return (m << 1) & t;
}
---- CUT ----
Currently we produce:
lea rax, [rdi+rdi]
mov eax, eax
But really we should just produce:
lea eax, [rdi + rdi]
ret
Note I noticed a few other related addressing modes missing too.