[llvm-bugs] [Bug 41647] New: does not eliminate a branch on shifts
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Apr 29 07:37:48 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=41647
Bug ID: 41647
Summary: does not eliminate a branch on shifts
Product: new-bugs
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: slandden at gmail.com
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org
When creating a mask, with unsigned n (I'm doing this in Zig because underflow
is undefined in Zig)
if (n == 0) {
return 0;
} else {
return u64(math.maxInt(u64)) >> @intCast(u6, ((64 - @intCast(u7, n))));
}
mask:
test dil, dil
je .LBB0_1
neg dil
mov rax, -1
shrx rax, rax, rdi
ret
.LBB0_1:
xor eax, eax
ret
But the branch is unneeded.
https://www.felixcloutier.com/x86/sarx:shlx:shrx
If the value specified in the first source operand exceeds OperandSize -1, the
COUNT value is masked.
--
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/20190429/13bffe9f/attachment.html>
More information about the llvm-bugs
mailing list