]> granicus.if.org Git - llvm/commit
[x86] improve the default expansion of uaddsat/usubsat
authorSanjay Patel <spatel@rotateright.com>
Sun, 24 Mar 2019 13:55:54 +0000 (13:55 +0000)
committerSanjay Patel <spatel@rotateright.com>
Sun, 24 Mar 2019 13:55:54 +0000 (13:55 +0000)
commitd6a187abe9ebb3eb185e64815fa3b44c56e5702f
tree13449b76c41ca7fd448556b5252b3141a7b22b4c
parent8731cd195cc3ccb1d49ae05e260e94208b60d8c5
[x86] improve the default expansion of uaddsat/usubsat

This is yet another step towards solving PR14613:
https://bugs.llvm.org/show_bug.cgi?id=14613

uaddsat X, Y --> (X >u (X + Y)) ? -1 : X + Y
usubsat X, Y --> (X >u Y) ? X - Y : 0

We can't count on a sane vector ISA, so override the default (umin/umax)
expansion of unsigned add/sub saturate in cases where we do not have umin/umax.

Differential Revision: https://reviews.llvm.org/D59006

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@356855 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86ISelLowering.cpp
test/CodeGen/X86/uadd_sat.ll
test/CodeGen/X86/uadd_sat_vec.ll
test/CodeGen/X86/usub_sat.ll
test/CodeGen/X86/usub_sat_vec.ll