[llvm] [LLVM] Add `llvm.masked.compress` intrinsic (PR #92289)
Lawrence Benson via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 21 04:36:55 PDT 2024
================
@@ -12078,6 +12080,54 @@ SDValue DAGCombiner::visitVP_STRIDED_STORE(SDNode *N) {
return SDValue();
}
+SDValue DAGCombiner::visitMASKED_COMPRESS(SDNode *N) {
+ SDLoc DL(N);
+ SDValue Vec = N->getOperand(0);
+ SDValue Mask = N->getOperand(1);
+ SDValue Passthru = N->getOperand(2);
+ EVT VecVT = Vec.getValueType();
+
+ bool HasPassthru = !Passthru.isUndef();
+
+ APInt SplatVal;
+ if (ISD::isConstantSplatVector(Mask.getNode(), SplatVal))
+ return TLI.isConstTrueVal(Mask) ? Vec : Passthru;
+
+ if (Vec.isUndef() || Mask.isUndef())
----------------
lawben wrote:
Yes, I actually like that better. This is also more consistent with the semantics of "undef bits in the mask are false", as a completely undef mask is then also completely false.
https://github.com/llvm/llvm-project/pull/92289
More information about the llvm-commits
mailing list