[llvm] [LLVM] Add `llvm.masked.compress` intrinsic (PR #92289)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 21 04:20:22 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())
----------------
RKSimon wrote:
Can we just do this?
```c
if (Vec.isUndef() || Mask.isUndef())
return Passthru;
```
https://github.com/llvm/llvm-project/pull/92289
More information about the llvm-commits
mailing list