[NFC][InstCombine] Add tests for shifty implementation of clamping.
authorHuihui Zhang <huihuiz@quicinc.com>
Mon, 23 Sep 2019 23:48:32 +0000 (23:48 +0000)
committerHuihui Zhang <huihuiz@quicinc.com>
Mon, 23 Sep 2019 23:48:32 +0000 (23:48 +0000)
commit5b5f1c8efd676696f2f035f70bce0efc955b9019
tree6fb5c163be80e9333d33c7aff70ba52ed7bac68b
parent1cefad10cfd32a4c24d23139cdd44350d5374419
[NFC][InstCombine] Add tests for shifty implementation of clamping.

Summary:
Clamp negative to zero and clamp positive to allOnes are common
operation in image saturation.

Add tests for shifty implementation of clamping, as prepare work for
folding:

and(ashr(subNSW(Y, X), ScalarSizeInBits(Y)-1), X) --> X s> 0 ? X : 0;

or(ashr(subNSW(Y, X), ScalarSizeInBits(Y)-1), X) --> X s> Y ? allOnes : X.

Reviewers: lebedev.ri, efriedma, spatel, kparzysz, bcahoon

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 372671
llvm/test/Transforms/InstCombine/sub-ashr-and-to-icmp-select.ll [new file with mode: 0644]
llvm/test/Transforms/InstCombine/sub-ashr-or-to-icmp-select.ll [new file with mode: 0644]