File tree Expand file tree Collapse file tree 2 files changed +18
-10
lines changed
Expand file tree Collapse file tree 2 files changed +18
-10
lines changed Original file line number Diff line number Diff line change @@ -161,19 +161,26 @@ std::optional<unsigned> X86TTIImpl::getCacheAssociativity(
161161 llvm_unreachable (" Unknown TargetTransformInfo::CacheLevel" );
162162}
163163
164+ enum ClassIDEnum { GPRClass = 0 , VectorClass = 1 , ScalarFPClass = 2 };
165+
166+ unsigned X86TTIImpl::getRegisterClassForType (bool Vector, Type *Ty) const {
167+ return Vector ? VectorClass
168+ : Ty && Ty->isFloatingPointTy () ? ScalarFPClass
169+ : GPRClass;
170+ }
171+
164172unsigned X86TTIImpl::getNumberOfRegisters (unsigned ClassID) const {
165- bool Vector = (ClassID == 1 );
166- if (Vector && !ST->hasSSE1 ())
173+ if (ClassID == VectorClass && !ST->hasSSE1 ())
167174 return 0 ;
168175
169- if (ST->is64Bit ()) {
170- if (Vector && ST-> hasAVX512 ())
171- return 32 ;
172- if (!Vector && ST->hasEGPR ())
173- return 32 ;
174- return 16 ;
175- }
176- return 8 ;
176+ if (! ST->is64Bit ())
177+ return 8 ;
178+
179+ if ((ClassID == GPRClass && ST->hasEGPR ()) ||
180+ (ClassID != GPRClass && ST-> hasAVX512 ()))
181+ return 32 ;
182+
183+ return 16 ;
177184}
178185
179186bool X86TTIImpl::hasConditionalLoadStoreForType (Type *Ty, bool IsStore) const {
Original file line number Diff line number Diff line change @@ -132,6 +132,7 @@ class X86TTIImpl final : public BasicTTIImplBase<X86TTIImpl> {
132132 // / @{
133133
134134 unsigned getNumberOfRegisters (unsigned ClassID) const override ;
135+ unsigned getRegisterClassForType (bool Vector, Type *Ty) const override ;
135136 bool hasConditionalLoadStoreForType (Type *Ty, bool IsStore) const override ;
136137 TypeSize
137138 getRegisterBitWidth (TargetTransformInfo::RegisterKind K) const override ;
You can’t perform that action at this time.
0 commit comments