[llvm] [AArch64] Add @llvm.experimental.vector.match (PR #101974)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 23 01:58:08 PDT 2024


================
@@ -8137,6 +8137,42 @@ void SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I,
              DAG.getNode(ISD::EXTRACT_SUBVECTOR, sdl, ResultVT, Vec, Index));
     return;
   }
+  case Intrinsic::experimental_vector_match: {
+    SDValue Op1 = getValue(I.getOperand(0));
+    SDValue Op2 = getValue(I.getOperand(1));
+    SDValue Mask = getValue(I.getOperand(2));
+    EVT Op1VT = Op1.getValueType();
+    EVT Op2VT = Op2.getValueType();
+    EVT ResVT = Mask.getValueType();
+    unsigned SearchSize = Op2VT.getVectorNumElements();
+
+    LLVMContext &Ctx = *DAG.getContext();
+    const auto &TTI =
+        TLI.getTargetMachine().getTargetTransformInfo(*I.getFunction());
+
+    // If the target has native support for this vector match operation, lower
+    // the intrinsic directly; otherwise, lower it below.
+    if (TTI.hasVectorMatch(cast<VectorType>(Op1VT.getTypeForEVT(Ctx)),
----------------
david-arm wrote:

I guess there is no urgency to add a cost model if it's only going to be used by LoopIdiomVectorize. I guess the call will just appear to be very expensive in any analysis (such as loop unrolling, inlining, etc.) in later passes so by default it's more conservative anyway.

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


More information about the llvm-commits mailing list