[llvm] [AArch64] Add MATCH loops to LoopIdiomVectorizePass (PR #101976)

Sjoerd Meijer via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 25 08:26:43 PST 2024


================
@@ -914,6 +914,23 @@ AArch64TTIImpl::getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
     }
     break;
   }
+  case Intrinsic::experimental_vector_match: {
+    EVT SearchVT = getTLI()->getValueType(DL, ICA.getArgTypes()[0]);
+    unsigned SearchSize =
+        cast<FixedVectorType>(ICA.getArgTypes()[1])->getNumElements();
+    // If we can't lower to MATCH, return an invalid cost.
+    if (getTLI()->shouldExpandVectorMatch(SearchVT, SearchSize))
+      return InstructionCost::getInvalid();
+    // Base cost for MATCH instructions. At least on the Neoverse V2 and
+    // Neoverse V3 these are cheap operations with the same latency as a vector
+    // ADD, though in most cases we also need to do an extra DUP.
+    InstructionCost Cost = 4;
+    // For fixed-length vectors we currently need an extra five--six
+    // instructions besides the MATCH.
+    if (isa<FixedVectorType>(RetTy))
----------------
sjoerdmeijer wrote:

If I understand correctly, there is a comment elsewhere that says we don't support fixed width types. 
Maybe use this fixed type check to return InvalidCost, or if we do support this, we are missing a test case?

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


More information about the llvm-commits mailing list