https://bugs.llvm.org/show_bug.cgi?id=41495
Bug ID: 41495
Summary: Suboptimal codegen: (x << 1) | 1 results in LEA+ADD
while could be just LEA
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Keywords: code-quality
Severity: normal
Priority: P
Component: Backend: X86
Assignee: unassignedb...@nondot.org
Reporter: nok.ra...@gmail.com
CC: craig.top...@gmail.com, llvm-bugs@lists.llvm.org,
llvm-...@redking.me.uk, spatel+l...@rotateright.com
int foo(int x)
{
return (x << 1) | 1;
}
GCC/ICC:
lea eax, [rdi+1+rdi]
Clang:
lea eax, [rdi+rdi]
add eax, 1
Interestingly enough for 32bit target Clang produces:
mov eax, dword ptr [esp + 4]
lea eax, [eax+eax+1]
https://godbolt.org/z/PpiqqU
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs