[llvm] [RISCV] Fix missing scaling by LMUL in cost model (PR #73342)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 18 05:30:32 PST 2024


================
@@ -1117,30 +1120,30 @@ RISCVTTIImpl::getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
     if (ST->hasVInstructions() && LT.second.isVector()) {
       // vrsub.vi v10, v8, 0
       // vmax.vv v8, v8, v10
-      return LT.first * 2;
+      return LT.first * TLI->getLMULCost(LT.second) * 2;
     }
     break;
   }
   // TODO: add more intrinsic
   case Intrinsic::experimental_stepvector: {
     unsigned Cost = 1; // vid
     auto LT = getTypeLegalizationCost(RetTy);
-    return Cost + (LT.first - 1);
+    return (Cost + (LT.first - 1)) * TLI->getLMULCost(LT.second);
----------------
lukel97 wrote:

Side note not related to this PR, Isn't this just 
```suggestion
    return LT.first * TLI->getLMULCost(LT.second);
```

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


More information about the llvm-commits mailing list