@@ -5828,14 +5828,17 @@ InstructionCost X86TTIImpl::getGSVectorCost(unsigned Opcode,
5828
5828
Alignment, AddressSpace);
5829
5829
}
5830
5830
5831
+ // If we didn't split, this will be a single gather/scatter instruction.
5832
+ if (CostKind == TTI::TCK_CodeSize)
5833
+ return 1 ;
5834
+
5831
5835
// The gather / scatter cost is given by Intel architects. It is a rough
5832
5836
// number since we are looking at one instruction in a time.
5833
- const int GSOverhead = (Opcode == Instruction::Load)
5834
- ? getGatherOverhead ()
5835
- : getScatterOverhead ();
5837
+ const int GSOverhead = (Opcode == Instruction::Load) ? getGatherOverhead ()
5838
+ : getScatterOverhead ();
5836
5839
return GSOverhead + VF * getMemoryOpCost (Opcode, SrcVTy->getScalarType (),
5837
5840
MaybeAlign (Alignment), AddressSpace,
5838
- TTI::TCK_RecipThroughput );
5841
+ CostKind );
5839
5842
}
5840
5843
5841
5844
// / Return the cost of full scalarization of gather / scatter operation.
@@ -5892,19 +5895,17 @@ InstructionCost X86TTIImpl::getGatherScatterOpCost(
5892
5895
unsigned Opcode, Type *SrcVTy, const Value *Ptr, bool VariableMask,
5893
5896
Align Alignment, TTI::TargetCostKind CostKind,
5894
5897
const Instruction *I = nullptr ) {
5895
- if (CostKind != TTI::TCK_RecipThroughput) {
5896
- if ((Opcode == Instruction::Load &&
5897
- isLegalMaskedGather (SrcVTy, Align (Alignment)) &&
5898
- !forceScalarizeMaskedGather (cast<VectorType>(SrcVTy),
5899
- Align (Alignment))) ||
5900
- (Opcode == Instruction::Store &&
5901
- isLegalMaskedScatter (SrcVTy, Align (Alignment)) &&
5902
- !forceScalarizeMaskedScatter (cast<VectorType>(SrcVTy),
5903
- Align (Alignment))))
5904
- return 1 ;
5898
+ if (CostKind != TTI::TCK_RecipThroughput &&
5899
+ ((Opcode == Instruction::Load &&
5900
+ (!isLegalMaskedGather (SrcVTy, Align (Alignment)) ||
5901
+ forceScalarizeMaskedGather (cast<VectorType>(SrcVTy),
5902
+ Align (Alignment)))) ||
5903
+ (Opcode == Instruction::Store &&
5904
+ (!isLegalMaskedScatter (SrcVTy, Align (Alignment)) ||
5905
+ forceScalarizeMaskedScatter (cast<VectorType>(SrcVTy),
5906
+ Align (Alignment))))))
5905
5907
return BaseT::getGatherScatterOpCost (Opcode, SrcVTy, Ptr, VariableMask,
5906
5908
Alignment, CostKind, I);
5907
- }
5908
5909
5909
5910
assert (SrcVTy->isVectorTy () && " Unexpected data type for Gather/Scatter" );
5910
5911
PointerType *PtrTy = dyn_cast<PointerType>(Ptr->getType ());
0 commit comments