[llvm-bugs] [Bug 42178] New: Missed canonicalization for usub.sat(a, b) + b
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Jun 7 07:25:01 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=42178
Bug ID: 42178
Summary: Missed canonicalization for usub.sat(a, b) + b
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
#define T unsigned
T do_shift(T a, T b)
{
return a - ((a - b) & - (T)(a < b));
}
Current trunk:
do_shift: # @do_shift
xor eax, eax
sub esi, edi
cmovae eax, esi
add eax, edi
ret
Clang 8:
do_shift: # @do_shift
mov eax, edi
cmp esi, edi
cmova eax, esi
ret
define dso_local i32 @do_shift(i32, i32) local_unnamed_addr #0 {
%3 = tail call i32 @llvm.usub.sat.i32(i32 %1, i32 %0)
%4 = add i32 %3, %0
ret i32 %4
}
As noted by nikic: "Looks like an instcombine fail: usub.sat(a, b) + b should
be canonicalized to umax(a, b)."
--
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/20190607/bddd78d1/attachment.html>
More information about the llvm-bugs
mailing list