OSDN Git Service

[InstCombine] add unsigned saturation subtraction canonicalizations
authorSanjay Patel <spatel@rotateright.com>
Mon, 5 Feb 2018 17:53:29 +0000 (17:53 +0000)
committerSanjay Patel <spatel@rotateright.com>
Mon, 5 Feb 2018 17:53:29 +0000 (17:53 +0000)
commit50b49991b4eb52e1a31f52d0c33dfb31b4a94aad
tree0d7fac357451fe9f18d45fd20c2752adf5812e26
parent2e9c44b034c9c47e53b2ff67f0746ee41c05e422
[InstCombine] add unsigned saturation subtraction canonicalizations

This is the instcombine part of unsigned saturation canonicalization.
Backend patches already commited:
https://reviews.llvm.org/D37510
https://reviews.llvm.org/D37534

It converts unsigned saturated subtraction patterns to forms recognized
by the backend:
(a > b) ? a - b : 0 -> ((a > b) ? a : b) - b)
(b < a) ? a - b : 0 -> ((a > b) ? a : b) - b)
(b > a) ? 0 : a - b -> ((a > b) ? a : b) - b)
(a < b) ? 0 : a - b -> ((a > b) ? a : b) - b)
((a > b) ? b - a : 0) -> - ((a > b) ? a : b) - b)
((b < a) ? b - a : 0) -> - ((a > b) ? a : b) - b)
((b > a) ? 0 : b - a) -> - ((a > b) ? a : b) - b)
((a < b) ? 0 : b - a) -> - ((a > b) ? a : b) - b)

Patch by Yulia Koval!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324255 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstCombineSelect.cpp
test/Transforms/InstCombine/unsigned_saturated_sub.ll