[llvm-bugs] [Bug 37939] New: Missed pattern B+(-C)*A
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Jun 26 04:19:21 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=37939
Bug ID: 37939
Summary: Missed pattern B+(-C)*A
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Scalar Optimizations
Assignee: unassignedbugs at nondot.org
Reporter: david.bolvansky at gmail.com
CC: llvm-bugs at lists.llvm.org
Code:
int foo2(int x, int y) {
return x + -2 *y;
}
int foo3(int x, int y) {
return x + -3 *y;
}
int foo4(int x, int y) {
return x + -4 *y;
}
Clang trunk:
foo2(int, int): # @foo2(int, int)
add esi, esi
sub edi, esi
mov eax, edi
ret
foo3(int, int): # @foo3(int, int)
lea eax, [rsi + 2*rsi]
neg eax
add eax, edi
ret
foo4(int, int): # @foo4(int, int)
shl esi, 2
sub edi, esi
mov eax, edi
ret
GCC 8:
foo2(int, int):
neg esi
lea eax, [rdi+rsi*2]
ret
foo3(int, int):
lea eax, [0+rsi*4]
sub esi, eax
lea eax, [rsi+rdi]
ret
foo4(int, int):
neg esi
lea eax, [rdi+rsi*4]
ret
--
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/20180626/739bb896/attachment.html>
More information about the llvm-bugs
mailing list