This is an archive of the discontinued LLVM Phabricator instance.

[NFC][InstCombine] Add tests for shifty implementation of image clamping.
ClosedPublic

Authored by huihuiz on Sep 19 2019, 11:24 PM.

Details

Summary

Clamp negative to zero and clamp positive to allOnesValue are common
operation in image saturation.
Add tests for shifty implementation of clamping, as prepare work for
folding:

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

or(ashr(subNSW(X, V), ScalarSizeInBits - 1), V) --> V s> X ? AllOnesValue : V.

Diff Detail

Repository
rL LLVM

Event Timeline

huihuiz created this revision.Sep 19 2019, 11:24 PM
huihuiz updated this revision to Diff 221144.Sep 20 2019, 6:02 PM

move test "extra_use_sub" to positive case

huihuiz updated this revision to Diff 221256.Sep 23 2019, 12:10 AM
huihuiz edited the summary of this revision. (Show Details)

make test more general

This revision was not accepted when it landed; it landed in state Needs Review.Sep 23 2019, 4:47 PM
This revision was automatically updated to reflect the committed changes.