From: Philip Reames Date: Mon, 13 Mar 2023 15:54:44 +0000 (-0700) Subject: [RISCV] Inline and delete RISCVTTIImpl::getSpliceCost [nfc] X-Git-Tag: upstream/17.0.6~15031 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cfcf2742453be26b77f0872c2ef23b991ada1d20;p=platform%2Fupstream%2Fllvm.git [RISCV] Inline and delete RISCVTTIImpl::getSpliceCost [nfc] The code structure was copied from AArch64 which has a much more complicated splice cost model. --- diff --git a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp index ebf80a3..ae04471 100644 --- a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp +++ b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp @@ -243,15 +243,6 @@ RISCVTTIImpl::getRegisterBitWidth(TargetTransformInfo::RegisterKind K) const { llvm_unreachable("Unsupported register kind"); } -InstructionCost RISCVTTIImpl::getSpliceCost(VectorType *Tp, int Index) { - std::pair LT = getTypeLegalizationCost(Tp); - - unsigned Cost = 2; // vslidedown+vslideup. - // TODO: Multiplying by LT.first implies this legalizes into multiple copies - // of similar code, but I think we expand through memory. - return Cost * LT.first * getLMULCost(LT.second); -} - InstructionCost RISCVTTIImpl::getShuffleCost(TTI::ShuffleKind Kind, VectorType *Tp, ArrayRef Mask, TTI::TargetCostKind CostKind, @@ -270,7 +261,10 @@ InstructionCost RISCVTTIImpl::getShuffleCost(TTI::ShuffleKind Kind, return LT.first * 1; } case TTI::SK_Splice: - return getSpliceCost(Tp, Index); + // vslidedown+vslideup. + // TODO: Multiplying by LT.first implies this legalizes into multiple copies + // of similar code, but I think we expand through memory. + return 2 * LT.first * getLMULCost(LT.second); case TTI::SK_Reverse: // Most of the cost here is producing the vrgather index register // Example sequence: diff --git a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h index 6646bd1..cdc0bcc 100644 --- a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h +++ b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h @@ -113,7 +113,6 @@ public: return ST->useRVVForFixedLengthVectors() ? 16 : 0; } - InstructionCost getSpliceCost(VectorType *Tp, int Index); InstructionCost getShuffleCost(TTI::ShuffleKind Kind, VectorType *Tp, ArrayRef Mask, TTI::TargetCostKind CostKind, int Index,