[llvm] [AArch64] Add invalid 1 x vscale costs for reductions and reduction-operations. (PR #102105)

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 6 03:59:17 PDT 2024


================
@@ -541,7 +541,15 @@ static InstructionCost getHistogramCost(const IntrinsicCostAttributes &ICA) {
 InstructionCost
 AArch64TTIImpl::getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
                                       TTI::TargetCostKind CostKind) {
+  // The code-generator is currently not able to handle scalable vectors
+  // of <vscale x 1 x eltty> yet, so return an invalid cost to avoid selecting
+  // it. This change will be removed when code-generation for these types is
+  // sufficiently reliable.
   auto *RetTy = ICA.getReturnType();
+  if (auto *VTy = dyn_cast<ScalableVectorType>(RetTy))
+    if (VTy->getElementCount() == ElementCount::getScalable(1))
+      return InstructionCost::getInvalid();
+
----------------
sdesmalen-arm wrote:

Can you also add a similar check for vector operands (e.g. cntpop would return a scalar value, but might have a scalable vector operand).

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


More information about the llvm-commits mailing list