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

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 18 06:51:55 PDT 2024


================
@@ -12091,6 +12093,57 @@ 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 SplatVal.isAllOnes()
----------------
RKSimon wrote:

Should we enforce that the contents of Mask match getBooleanContents ? And should we be flipping this logic and check for a zero or non-zero value?

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


More information about the llvm-commits mailing list