[llvm] [RISCV][CostModel] Updates reduction and shuffle cost (PR #77342)
Shih-Po Hung via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 1 18:34:47 PST 2024
================
@@ -531,9 +529,12 @@ 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}
+ unsigned Opcodes[] = {RISCV::VID_V, RISCV::VRSUB_VX, RISCV : VRGATHER_VV};
----------------
arcbbb wrote:
Maybe I overlooked something, here are the three cost sequences I am considering:
1. scalable vector
LenCost:3 from { csrr a0, vlenb, srli a0, a0, 3, addi a0, a0, -1 }
GatherCost from {vid.v, vrsub.vx, vrgather.vv}
2. fixed-length vector, imm > 5bit
LenCost:1 from { li }
GatherCost from {vid.v, vrsub.vx, vrgather.vv}
3. fixed-length vector, imm <= 5 bit
LenCost:0 from { }
GatherCost from {vid.v, vrsub.vi, vrgather.vv}
Could you help me correct this?
https://github.com/llvm/llvm-project/pull/77342
More information about the llvm-commits
mailing list