[llvm] [AArch64] Fix SVE cost model for various math intrinsics (PR #184358)

David Green via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 4 03:39:32 PST 2026


================
@@ -696,6 +696,13 @@ AArch64TTIImpl::getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
     break;
   }
   case Intrinsic::abs: {
+    if (isa<ScalableVectorType>(RetTy) && ST->isSVEorStreamingSVEAvailable()) {
+      auto LT = getTypeLegalizationCost(RetTy);
----------------
davemgreen wrote:

What happens for smaller than legal node, like a vscale x 2 x i32? IIUC it needs to add an extend (or the codegen does at the moment), but the cost will now be too low. https://godbolt.org/z/rPaod77hq

I would say the same for i128 but that might still be an invalid cost?

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


More information about the llvm-commits mailing list