[llvm-bugs] [Bug 44346] New: Signed division with power of two - eliminate test instruction
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Dec 19 13:29:10 PST 2019
https://bugs.llvm.org/show_bug.cgi?id=44346
Bug ID: 44346
Summary: Signed division with power of two - eliminate test
instruction
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: X86
Assignee: unassignedbugs at nondot.org
Reporter: david.bolvansky 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
After PR43197, we have a better codegen for signed division with power of two,
but it could be improved a bit.
int al2(int x) {
return ((x + 3 )/4) *4;
}
We have:
al2(int): # @al2(int)
lea eax, [rdi + 3]
add edi, 6
test eax, eax
cmovs eax, edi
and eax, -4
ret
But test instruction could be eliminated, like GCC does:
al2(int):
lea eax, [rdi+6]
add edi, 3
cmovns eax, edi
and eax, -4
ret
https://godbolt.org/z/C9ij3Y
--
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/20191219/53952a90/attachment.html>
More information about the llvm-bugs
mailing list