@@ -5841,59 +5841,12 @@ InstructionCost X86TTIImpl::getGSVectorCost(unsigned Opcode,
5841
5841
CostKind);
5842
5842
}
5843
5843
5844
- // / Return the cost of full scalarization of gather / scatter operation.
5845
- // /
5846
- // / Opcode - Load or Store instruction.
5847
- // / SrcVTy - The type of the data vector that should be gathered or scattered.
5848
- // / VariableMask - The mask is non-constant at compile time.
5849
- // / Alignment - Alignment for one element.
5850
- // / AddressSpace - pointer[s] address space.
5851
- // / TODO: Remove this and use getCommonMaskedMemoryOpCost directly.
5852
- InstructionCost X86TTIImpl::getGSScalarCost (unsigned Opcode,
5853
- TTI::TargetCostKind CostKind,
5854
- Type *SrcVTy, bool VariableMask,
5855
- Align Alignment,
5856
- unsigned AddressSpace) {
5857
- Type *ScalarTy = SrcVTy->getScalarType ();
5858
- unsigned VF = cast<FixedVectorType>(SrcVTy)->getNumElements ();
5859
- APInt DemandedElts = APInt::getAllOnes (VF);
5860
-
5861
- InstructionCost MaskUnpackCost = 0 ;
5862
- if (VariableMask) {
5863
- auto *MaskTy =
5864
- FixedVectorType::get (Type::getInt1Ty (SrcVTy->getContext ()), VF);
5865
- MaskUnpackCost = getScalarizationOverhead (
5866
- MaskTy, DemandedElts, /* Insert=*/ false , /* Extract=*/ true , CostKind);
5867
- InstructionCost BranchCost = getCFInstrCost (Instruction::Br, CostKind);
5868
- MaskUnpackCost += VF * BranchCost;
5869
- }
5870
-
5871
- InstructionCost AddressUnpackCost = getScalarizationOverhead (
5872
- FixedVectorType::get (PointerType::getUnqual (ScalarTy->getContext ()), VF),
5873
- DemandedElts, /* Insert=*/ false , /* Extract=*/ true , CostKind);
5874
-
5875
- // The cost of the scalar loads/stores.
5876
- InstructionCost MemoryOpCost =
5877
- VF * getMemoryOpCost (Opcode, ScalarTy, MaybeAlign (Alignment),
5878
- AddressSpace, CostKind);
5879
-
5880
- // The cost of forming the vector from loaded scalars/
5881
- // scalarizing the vector to perform scalar stores.
5882
- InstructionCost InsertExtractCost = getScalarizationOverhead (
5883
- cast<FixedVectorType>(SrcVTy), DemandedElts,
5884
- /* Insert=*/ Opcode == Instruction::Load,
5885
- /* Extract=*/ Opcode == Instruction::Store, CostKind);
5886
-
5887
- return AddressUnpackCost + MemoryOpCost + MaskUnpackCost + InsertExtractCost;
5888
- }
5889
-
5890
5844
// / Calculate the cost of Gather / Scatter operation
5891
5845
InstructionCost X86TTIImpl::getGatherScatterOpCost (
5892
5846
unsigned Opcode, Type *SrcVTy, const Value *Ptr, bool VariableMask,
5893
5847
Align Alignment, TTI::TargetCostKind CostKind,
5894
5848
const Instruction *I = nullptr ) {
5895
- if (CostKind != TTI::TCK_RecipThroughput &&
5896
- ((Opcode == Instruction::Load &&
5849
+ if (((Opcode == Instruction::Load &&
5897
5850
(!isLegalMaskedGather (SrcVTy, Align (Alignment)) ||
5898
5851
forceScalarizeMaskedGather (cast<VectorType>(SrcVTy),
5899
5852
Align (Alignment)))) ||
@@ -5911,18 +5864,6 @@ InstructionCost X86TTIImpl::getGatherScatterOpCost(
5911
5864
cast<VectorType>(Ptr->getType ())->getElementType ());
5912
5865
assert (PtrTy && " Unexpected type for Ptr argument" );
5913
5866
unsigned AddressSpace = PtrTy->getAddressSpace ();
5914
-
5915
- if ((Opcode == Instruction::Load &&
5916
- (!isLegalMaskedGather (SrcVTy, Align (Alignment)) ||
5917
- forceScalarizeMaskedGather (cast<VectorType>(SrcVTy),
5918
- Align (Alignment)))) ||
5919
- (Opcode == Instruction::Store &&
5920
- (!isLegalMaskedScatter (SrcVTy, Align (Alignment)) ||
5921
- forceScalarizeMaskedScatter (cast<VectorType>(SrcVTy),
5922
- Align (Alignment)))))
5923
- return getGSScalarCost (Opcode, CostKind, SrcVTy, VariableMask, Alignment,
5924
- AddressSpace);
5925
-
5926
5867
return getGSVectorCost (Opcode, CostKind, SrcVTy, Ptr, Alignment,
5927
5868
AddressSpace);
5928
5869
}
0 commit comments