[RISCV] Inline and delete RISCVTTIImpl::getSpliceCost [nfc]
authorPhilip Reames <preames@rivosinc.com>
Mon, 13 Mar 2023 15:54:44 +0000 (08:54 -0700)
committerPhilip Reames <listmail@philipreames.com>
Mon, 13 Mar 2023 15:55:32 +0000 (08:55 -0700)
The code structure was copied from AArch64 which has a much more complicated splice cost model.

llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h

index ebf80a3..ae04471 100644 (file)
@@ -243,15 +243,6 @@ RISCVTTIImpl::getRegisterBitWidth(TargetTransformInfo::RegisterKind K) const {
   llvm_unreachable("Unsupported register kind");
 }
 
-InstructionCost RISCVTTIImpl::getSpliceCost(VectorType *Tp, int Index) {
-  std::pair<InstructionCost, MVT> 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<int> 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:
index 6646bd1..cdc0bcc 100644 (file)
@@ -113,7 +113,6 @@ public:
     return ST->useRVVForFixedLengthVectors() ? 16 : 0;
   }
 
-  InstructionCost getSpliceCost(VectorType *Tp, int Index);
   InstructionCost getShuffleCost(TTI::ShuffleKind Kind, VectorType *Tp,
                                  ArrayRef<int> Mask,
                                  TTI::TargetCostKind CostKind, int Index,