From cfcf2742453be26b77f0872c2ef23b991ada1d20 Mon Sep 17 00:00:00 2001 From: Philip Reames Date: Mon, 13 Mar 2023 08:54:44 -0700 Subject: [PATCH] [RISCV] Inline and delete RISCVTTIImpl::getSpliceCost [nfc] The code structure was copied from AArch64 which has a much more complicated splice cost model. --- llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp | 14 ++++---------- llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h | 1 - 2 files changed, 4 insertions(+), 11 deletions(-) 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, -- 2.7.4