[llvm-branch-commits] [RISCV][TTI] Adjust the cost of `llvm.abs` intrinsic when `Zvabd` exists (PR #180146)

Pengcheng Wang via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sun Feb 8 19:52:59 PST 2026


================
@@ -1577,6 +1577,11 @@ RISCVTTIImpl::getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
   case Intrinsic::abs: {
     auto LT = getTypeLegalizationCost(RetTy);
     if (ST->hasVInstructions() && LT.second.isVector()) {
+      // vabs.v v10, v8
+      if (ST->hasStdExtZvabd())
----------------
wangpc-pp wrote:

Yeah, `vabs.v` can support all `SEW`s. ABD operations can accept all `SEW`s in the initial version but the RVI suggested to restrict them to 8/16 bits for implementation complexity/pragmatism reasons.

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


More information about the llvm-branch-commits mailing list