]> granicus.if.org Git - llvm/commit
[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)
commit3a615f3a766f4d54ca3bdbc7a0d6dac8e83773f6
treefca128ae483a5127f8efa36ad0da478920437a27
parent40e66efebe4f438f53d4b98d7e4a5aed7fdf5f36
[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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372671 91177308-0d34-0410-b5e6-96231b3b80d8
test/Transforms/InstCombine/sub-ashr-and-to-icmp-select.ll [new file with mode: 0644]
test/Transforms/InstCombine/sub-ashr-or-to-icmp-select.ll [new file with mode: 0644]