[llvm] [RISCV] Adjust select shuffle cost to reflect mask creation cost (PR #77963)
Shih-Po Hung via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 12 19:43:27 PST 2024
================
@@ -443,10 +441,13 @@ InstructionCost RISCVTTIImpl::getShuffleCost(TTI::ShuffleKind Kind,
// vsetivli zero, 8, e8, mf2, ta, ma (ignored)
// vmv.s.x v0, a0
// vmerge.vvm v8, v9, v8, v0
+ // We use 2 for the cost of the mask materialization as this is the true
+ // cost for small masks and most shuffles are small. At worst, this cost
+ // should be a very small constant for the constant pool load. As such,
+ // we may bias towards large selects slightly more than truely warranted.
return LT.first *
- (TLI->getLMULCost(LT.second) + // FIXME: should be 1 for li
- getRISCVInstructionCost({RISCV::VMV_S_X, RISCV::VMERGE_VVM},
- LT.second, CostKind));
+ (2 + getRISCVInstructionCost({RISCV::VMERGE_VVM},
----------------
arcbbb wrote:
Can we query the cost of VMV_S_*/VMV_*_S instead? So vendors can provide their own number in getRISCVInstructionCost.
https://github.com/llvm/llvm-project/pull/77963
More information about the llvm-commits
mailing list