[PATCH] D67798: [NFC][InstCombine] Add tests for shifty implementation of image clamping.

Huihui Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 19 23:24:29 PDT 2019


huihuiz created this revision.
huihuiz added reviewers: lebedev.ri, efriedma, spatel, kparzysz, bcahoon.
huihuiz added a project: LLVM.

Clamping, such as clamp0 and clamp255 are common in computer graphics.
Add tests for shifty implementation of clamping, as prepare work for
folding:

and(ashr(sub(0, V), ScalarSizeInBits - 1), V) --> V s< 0 ? 0 : V, where
sub hasNoSignedWrap.

or(ashr(sub(C, V), ScalarSizeInBits - 1), V) --> V s> C ? AllOnesValue : V,
where sub hasNoSignedWrap.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D67798

Files:
  llvm/test/Transforms/InstCombine/sub-ashr-and-to-icmp-select.ll
  llvm/test/Transforms/InstCombine/sub-ashr-or-to-icmp-select.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67798.220951.patch
Type: text/x-patch
Size: 15789 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190920/22969732/attachment.bin>


More information about the llvm-commits mailing list