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

Shih-Po Hung via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 30 01:45:31 PST 2024


================
@@ -523,9 +523,9 @@ InstructionCost RISCVTTIImpl::getShuffleCost(TTI::ShuffleKind Kind,
     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);
+    InstructionCost GatherCost = getRISCVInstructionCost(
+        {RISCV::VID_V, RISCV::VRSUB_VX, RISCV::VRGATHER_VV}, LT.second,
----------------
arcbbb wrote:

I made a change to query the cost of VRSUB_VX/VRSUB_VI separately. Not sure this is what you expected.

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


More information about the llvm-commits mailing list