Skip to content

Commit 9588847

Browse files
committed
add comment
Change-Id: Ifc338ac65db118812affc782e08d32ca6a27516e
1 parent 0d4011a commit 9588847

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,16 +306,21 @@ bool GCNTTIImpl::hasBranchDivergence(const Function *F) const {
306306
return !F || !ST->isSingleLaneExecution(*F);
307307
}
308308

309-
unsigned GCNTTIImpl::getNumberOfParts(Type *Tp) const {
309+
unsigned GCNTTIImpl::getNumberOfParts(Type *Tp) {
310+
// For certain 8 bit ops, we can pack a v4i8 into a single part
311+
// (e.g. v4i8 shufflevectors -> v_perm v4i8, v4i8). Thus, we
312+
// do not limit the numberOfParts for 8 bit vectors to the
313+
// legalization costs of such. It is left up to other target
314+
// queries (e.g. get*InstrCost) to decide the proper handling
315+
// of 8 bit vectors.
310316
if (FixedVectorType *VTy = dyn_cast<FixedVectorType>(Tp)) {
311317
if (DL.getTypeSizeInBits(VTy->getElementType()) == 8) {
312318
unsigned ElCount = VTy->getElementCount().getFixedValue();
313319
return ElCount / 4;
314320
}
315321
}
316322

317-
std::pair<InstructionCost, MVT> LT = getTypeLegalizationCost(Tp);
318-
return LT.first.isValid() ? *LT.first.getValue() : 0;
323+
return BaseT::getNumberOfParts(Tp);
319324
}
320325

321326
unsigned GCNTTIImpl::getNumberOfRegisters(unsigned RCID) const {

llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class GCNTTIImpl final : public BasicTTIImplBase<GCNTTIImpl> {
117117
return TTI::PSK_FastHardware;
118118
}
119119

120-
unsigned getNumberOfParts(Type *Tp) const;
120+
unsigned getNumberOfParts(Type *Tp);
121121
unsigned getNumberOfRegisters(unsigned RCID) const;
122122
TypeSize getRegisterBitWidth(TargetTransformInfo::RegisterKind Vector) const;
123123
unsigned getMinVectorRegisterBitWidth() const;

0 commit comments

Comments
 (0)