[llvm] [RISCV][CostModel] Updates reduction and shuffle cost (PR #77342)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 30 07:17:10 PST 2024


================
@@ -528,12 +526,19 @@ InstructionCost RISCVTTIImpl::getShuffleCost(TTI::ShuffleKind Kind,
     //   vrsub.vx v10, v9, a0
     //   vrgather.vv v9, v8, v10
     InstructionCost LenCost = 3;
-    if (LT.second.isFixedLengthVector())
+    InstructionCost GatherCost;
+    if (LT.second.isFixedLengthVector()) {
       // vrsub.vi has a 5 bit immediate field, otherwise an li suffices
       LenCost = isInt<5>(LT.second.getVectorNumElements() - 1) ? 0 : 1;
-    // FIXME: replace the constant `2` below with cost of {VID_V,VRSUB_VX}
-    InstructionCost GatherCost =
-        2 + getRISCVInstructionCost(RISCV::VRGATHER_VV, LT.second, CostKind);
+      GatherCost = getRISCVInstructionCost(
----------------
preames wrote:

Please common the tail here, and undo the change which is restructuring the existing LenCost computation since that appears to be non-functional in your diff.  

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


More information about the llvm-commits mailing list