[PATCH] D129207: [X86] isTargetShuffleEquivalent - attempt to match SM_SentinelZero shuffle mask elements using known bits

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 11 06:57:25 PDT 2022


spatel accepted this revision.
spatel added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:11818
       continue;
+    if (MaskIdx == SM_SentinelZero && 0 <= ExpectedIdx) {
+      // If we need this expected index to be a zero element, then update the
----------------
RKSimon wrote:
> spatel wrote:
> > What do you think about adding a clause above this and below the first clause like:
> >     // If the mask is more defined than expected, the shuffles are not the same.
> >     if (ExpectedIdx == SM_SentinelUndef)
> >       return false;
> > 
> > I think that would then allow simplifying the later checks (converting to asserts).
> We assert that ExpectedMask is isUndefOrZeroOrInRange above, although tbh I'm not certain how many callers ever have sentinal values in expected mask.
Ok - maybe we can tighten up the logic with asserts as a follow-up. Also, I misread the constant-on-left compares  ("Yoda conditions") on first reading. :)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129207/new/

https://reviews.llvm.org/D129207



More information about the llvm-commits mailing list