This is an archive of the discontinued LLVM Phabricator instance.

Do (A == C1 || A == C2) -> (A & ~(C1 ^ C2)) == C1 rather than (A == C1 || A == C2) -> (A | (C1 ^ C2)) == C2 when C1 ^ C2 is a power of 2.
ClosedPublic

Authored by deadalnix on Nov 1 2015, 11:02 PM.

Diff Detail

Event Timeline

deadalnix updated this revision to Diff 38870.Nov 1 2015, 11:02 PM
deadalnix retitled this revision from to Do (A == C1 || A == C2) -> (A & ~(C1 ^ C2)) == C1 rather than (A == C1 || A == C2) -> (A | (C1 ^ C2)) == C2 when C1 ^ C2 is a power of 2..
deadalnix updated this object.
deadalnix added a subscriber: llvm-commits.
majnemer edited edge metadata.Nov 2 2015, 12:22 AM

Both transforms are correct, what is the specific rationale behind this change?

I get a power of 2 as a constant rather than something full of ones, which lead to more compact codegen in some cases (depending on how the target encode constant in the instruction stream).

majnemer accepted this revision.Nov 2 2015, 10:35 AM
majnemer edited edge metadata.

I get a power of 2 as a constant rather than something full of ones, which lead to more compact codegen in some cases (depending on how the target encode constant in the instruction stream).

LGTM

This revision is now accepted and ready to land.Nov 2 2015, 10:35 AM
deadalnix updated this revision to Diff 39408.Nov 5 2015, 1:33 PM
deadalnix edited edge metadata.

Can we get this in ?

deadalnix updated this revision to Diff 39884.Nov 10 2015, 9:06 PM

Rebase, also, can we get this merged ?

deadalnix updated this revision to Diff 41430.Nov 30 2015, 1:39 PM

Rebased and ping whoever with merge right feels like merging this now that it is accepted ?

mcrosier closed this revision.Dec 3 2015, 12:54 PM
mcrosier added a subscriber: mcrosier.

Committed in r254518.