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

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Mon May 20 12:19:56 PDT 2024


================
@@ -2304,6 +2307,25 @@ void DAGTypeLegalizer::SplitVecRes_Gather(MemSDNode *N, SDValue &Lo,
   ReplaceValueWith(SDValue(N, 1), Ch);
 }
 
+void DAGTypeLegalizer::SplitVecRes_MCOMPRESS(SDNode *N, SDValue &Lo,
+                                             SDValue &Hi) {
+  // This is not "trivial", as there is a dependency between the two subvectors.
+  // Depending on the number of 1s in the mask, the elements from the Hi vector
+  // need to be moved to the Lo vector. So we just perform this as one "big"
+  // operation and then extract the Lo and Hi vectors from that. This gets rid
+  // of MCOMPRESS and all other operands can be legalized later.
+  SDValue Compressed = TLI.expandMCOMPRESS(N, DAG);
+
+  SDLoc DL(N);
----------------
topperc wrote:

Can we use DAG.getSplitVector here?

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


More information about the llvm-commits mailing list