[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
Thu Jan 18 09:50:56 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:
@lukel97 Agree. Is is not blocking issue.
@preames I would like to override VMV_X_S for sifive-x280, and VMV_S_X is for consistency.
https://github.com/llvm/llvm-project/pull/77963
More information about the llvm-commits
mailing list