[InstCombine] Use uadd.sat and usub.sat for canonicalization
authorNikita Popov <nikita.ppv@gmail.com>
Wed, 27 Mar 2019 17:56:15 +0000 (17:56 +0000)
committerNikita Popov <nikita.ppv@gmail.com>
Wed, 27 Mar 2019 17:56:15 +0000 (17:56 +0000)
commit7462303e0680d36ff856c54707489474f717e83f
tree33f551363ede878a420ac6f51fcdc2671cf12e8c
parenta69698f45fadefd2cabba8d5aa1a8e93463a6d49
[InstCombine] Use uadd.sat and usub.sat for canonicalization

Start using the uadd.sat and usub.sat intrinsics for the existing
canonicalizations. These intrinsics should optimize better than
expanded IR, have better handling in the X86 backend and should
be no worse than expanded IR in other backends, as far as we know.

rL357012 already introduced use of uadd.sat for the add+umin pattern.

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

llvm-svn: 357103
llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
llvm/test/Transforms/InstCombine/saturating-add-sub.ll
llvm/test/Transforms/InstCombine/unsigned_saturated_sub.ll