[llvm-bugs] [Bug 41495] New: Suboptimal codegen: (x << 1) | 1 results in LEA+ADD while could be just LEA
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Apr 14 12:28:25 PDT 2019
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: unassignedbugs at nondot.org
Reporter: nok.raven at gmail.com
CC: craig.topper at gmail.com, llvm-bugs at lists.llvm.org,
llvm-dev at redking.me.uk, spatel+llvm at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190414/e1e09a12/attachment.html>
More information about the llvm-bugs
mailing list