[TTI][X86][APX] Calculate registers number according to FP or not (#154257)
This commit is contained in:
parent
6462223853
commit
4ae3c77066
@ -161,19 +161,26 @@ std::optional<unsigned> X86TTIImpl::getCacheAssociativity(
|
||||
llvm_unreachable("Unknown TargetTransformInfo::CacheLevel");
|
||||
}
|
||||
|
||||
enum ClassIDEnum { GPRClass = 0, VectorClass = 1, ScalarFPClass = 2 };
|
||||
|
||||
unsigned X86TTIImpl::getRegisterClassForType(bool Vector, Type *Ty) const {
|
||||
return Vector ? VectorClass
|
||||
: Ty && Ty->isFloatingPointTy() ? ScalarFPClass
|
||||
: GPRClass;
|
||||
}
|
||||
|
||||
unsigned X86TTIImpl::getNumberOfRegisters(unsigned ClassID) const {
|
||||
bool Vector = (ClassID == 1);
|
||||
if (Vector && !ST->hasSSE1())
|
||||
if (ClassID == VectorClass && !ST->hasSSE1())
|
||||
return 0;
|
||||
|
||||
if (ST->is64Bit()) {
|
||||
if (Vector && ST->hasAVX512())
|
||||
return 32;
|
||||
if (!Vector && ST->hasEGPR())
|
||||
return 32;
|
||||
return 16;
|
||||
}
|
||||
return 8;
|
||||
if (!ST->is64Bit())
|
||||
return 8;
|
||||
|
||||
if ((ClassID == GPRClass && ST->hasEGPR()) ||
|
||||
(ClassID != GPRClass && ST->hasAVX512()))
|
||||
return 32;
|
||||
|
||||
return 16;
|
||||
}
|
||||
|
||||
bool X86TTIImpl::hasConditionalLoadStoreForType(Type *Ty, bool IsStore) const {
|
||||
|
@ -132,6 +132,7 @@ public:
|
||||
/// @{
|
||||
|
||||
unsigned getNumberOfRegisters(unsigned ClassID) const override;
|
||||
unsigned getRegisterClassForType(bool Vector, Type *Ty) const override;
|
||||
bool hasConditionalLoadStoreForType(Type *Ty, bool IsStore) const override;
|
||||
TypeSize
|
||||
getRegisterBitWidth(TargetTransformInfo::RegisterKind K) const override;
|
||||
|
Loading…
x
Reference in New Issue
Block a user