Page MenuHomePhabricator

[InstCombine] Add transforms for `(icmp (xor X, Y), X)`
Needs ReviewPublic

Authored by goldstein.w.n on Fri, Mar 3, 3:55 PM.

Details

Summary

There are a variety of cases we can simplify either saving
instructions are creating sequences that are easier to optimize
elsewhere.

(X ^ Y) u> X --> X & MSB(Y) == 0

(X ^ Y) u< X --> X & MSB(Y) != 0

(X ^ Pos_Y) s> X --> X & MSB(Pow2_Y) == 0

(X ^ Pos_Y) s< X --> X & MSB(Pow2_Y) != 0

(X ^ Neg_Y) s> X --> X s< 0

(X ^ Neg_Y) s< X --> X s>= 0

Diff Detail

Event Timeline

goldstein.w.n created this revision.Fri, Mar 3, 3:55 PM
Herald added a project: Restricted Project. · View Herald TranscriptFri, Mar 3, 3:55 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
goldstein.w.n requested review of this revision.Fri, Mar 3, 3:55 PM
Herald added a project: Restricted Project. · View Herald TranscriptFri, Mar 3, 3:55 PM
nikic added a comment.Thu, Mar 9, 12:19 PM

Is there any real-world motivation for these xor transforms (and also the signed predicate variants in this patch stack)? If not, I'm not sure this is worthwhile.