[PATCH] D129150: [DAG] Canonicalize non-inlane shuffle -> AND if all non-inlane referenced elements are known zero
Simon Pilgrim via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 14 03:22:57 PDT 2022
RKSimon added inline comments.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:22679-22680
+ for (int I = 0; I != (int)NumElts; ++I)
+ if (Mask[I] == I)
+ AndMask[I] = AllOnesElt;
+
----------------
dmgreen wrote:
> Why is a zero mask better than an undef mask for undef shuffle mask elements?
This was from before I added the isVectorClearMaskLegal handling, I'll see if I can relax it again, but XformToShuffleWithZero always forces undef mask elements to zero as "X & undef --> 0 (not undef)" and IIRC I was trying to keep the behaviours as similar as possible.
================
Comment at: llvm/lib/Target/AArch64/AArch64ISelLowering.cpp:11814
+bool AArch64TargetLowering::isVectorClearMaskLegal(ArrayRef<int> M,
+ EVT VT) const {
----------------
dmgreen wrote:
> Is this saying that `MOV #0 + LegalShuffle` is always better than `create mask + and`? I think that sounds OK, so long as it doesn't destroy any BIC patterns.
There's nothing enforcing it, but M should always be a 'select/blend' style mask (+ undefs) - afaict it will only ever match in isShuffleMaskLegal against 2-element zip style patterns? I think those were the regressions I saw.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D129150/new/
https://reviews.llvm.org/D129150
More information about the llvm-commits
mailing list