@@ -175,7 +175,7 @@ unsigned X86TTIImpl::getNumberOfRegisters(unsigned ClassID) const {
175
175
return 8;
176
176
}
177
177
178
- bool X86TTIImpl::hasConditionalLoadStoreForType(Type *Ty) const {
178
+ bool X86TTIImpl::hasConditionalLoadStoreForType(Type *Ty, bool IsStore ) const {
179
179
if (!ST->hasCF())
180
180
return false;
181
181
if (!Ty)
@@ -6229,13 +6229,7 @@ bool X86TTIImpl::canMacroFuseCmp() {
6229
6229
return ST->hasMacroFusion() || ST->hasBranchFusion();
6230
6230
}
6231
6231
6232
- bool X86TTIImpl::isLegalMaskedLoad(Type *DataTy, Align Alignment) {
6233
- Type *ScalarTy = DataTy->getScalarType();
6234
-
6235
- // The backend can't handle a single element vector w/o CFCMOV.
6236
- if (isa<VectorType>(DataTy) && cast<FixedVectorType>(DataTy)->getNumElements() == 1)
6237
- return ST->hasCF() && hasConditionalLoadStoreForType(ScalarTy);
6238
-
6232
+ static bool isLegalMaskedLoadStore(Type *ScalarTy, const X86Subtarget *ST) {
6239
6233
if (!ST->hasAVX())
6240
6234
return false;
6241
6235
@@ -6259,8 +6253,28 @@ bool X86TTIImpl::isLegalMaskedLoad(Type *DataTy, Align Alignment) {
6259
6253
((IntWidth == 8 || IntWidth == 16) && ST->hasBWI());
6260
6254
}
6261
6255
6262
- bool X86TTIImpl::isLegalMaskedStore(Type *DataType, Align Alignment) {
6263
- return isLegalMaskedLoad(DataType, Alignment);
6256
+ bool X86TTIImpl::isLegalMaskedLoad(Type *DataTy, Align Alignment) {
6257
+ Type *ScalarTy = DataTy->getScalarType();
6258
+
6259
+ // The backend can't handle a single element vector w/o CFCMOV.
6260
+ if (isa<VectorType>(DataTy) &&
6261
+ cast<FixedVectorType>(DataTy)->getNumElements() == 1)
6262
+ return ST->hasCF() &&
6263
+ hasConditionalLoadStoreForType(ScalarTy, /*IsStore=*/false);
6264
+
6265
+ return isLegalMaskedLoadStore(ScalarTy, ST);
6266
+ }
6267
+
6268
+ bool X86TTIImpl::isLegalMaskedStore(Type *DataTy, Align Alignment) {
6269
+ Type *ScalarTy = DataTy->getScalarType();
6270
+
6271
+ // The backend can't handle a single element vector w/o CFCMOV.
6272
+ if (isa<VectorType>(DataTy) &&
6273
+ cast<FixedVectorType>(DataTy)->getNumElements() == 1)
6274
+ return ST->hasCF() &&
6275
+ hasConditionalLoadStoreForType(ScalarTy, /*IsStore=*/true);
6276
+
6277
+ return isLegalMaskedLoadStore(ScalarTy, ST);
6264
6278
}
6265
6279
6266
6280
bool X86TTIImpl::isLegalNTLoad(Type *DataType, Align Alignment) {
0 commit comments