[llvm] [LLVM] Add `llvm.masked.compress` intrinsic (PR #92289)

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 19 13:24:08 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())
----------------
efriedma-quic wrote:

Should this be `if ((Vec.isUndef() && Passthru.isUndef()) || Mask.isUndef())`?

https://github.com/llvm/llvm-project/pull/92289


More information about the llvm-commits mailing list