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: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected], [email protected]
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._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs