[llvm] [LLVM] Add `llvm.masked.compress` intrinsic (PR #92289)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Thu May 23 10:15:03 PDT 2024
================
@@ -7197,6 +7200,47 @@ SDValue SelectionDAG::getNode(unsigned Opcode, const SDLoc &DL, EVT VT,
return N1.getOperand(1);
break;
}
+ case ISD::MCOMPRESS: {
+ EVT VecVT = N1.getValueType();
+ [[maybe_unused]] EVT MaskVT = N2.getValueType();
+ assert(VT == VecVT && "Vector and result type don't match.");
+ assert(VecVT.isVector() && MaskVT.isVector() &&
+ "Both inputs must be vectors.");
+ assert(VecVT.isScalableVector() == MaskVT.isScalableVector() &&
+ "Inputs must both be either fixed or scalable vectors.");
+ assert(VecVT.getVectorElementCount() == MaskVT.getVectorElementCount() &&
+ "Vector and mask must have same number of elements.");
+
+ APInt SplatVal;
+ if (ISD::isConstantSplatVector(N2.getNode(), SplatVal))
----------------
topperc wrote:
I'm not sure it makes sense to do a lot of folding in getNode. It would only trigger if the mcompress is created with a constant vector. It's more likely the mask becomes a constant as part of DAG combine which this code won't catch. So I think its better to do this in DAGCominer.
https://github.com/llvm/llvm-project/pull/92289
More information about the llvm-commits
mailing list