@@ -175,7 +175,7 @@ unsigned X86TTIImpl::getNumberOfRegisters(unsigned ClassID) const {
175175 return 8 ;
176176}
177177
178- bool X86TTIImpl::hasConditionalLoadStoreForType (Type *Ty) const {
178+ bool X86TTIImpl::hasConditionalLoadStoreForType (Type *Ty, bool IsStore ) const {
179179 if (!ST->hasCF ())
180180 return false ;
181181 if (!Ty)
@@ -6229,13 +6229,7 @@ bool X86TTIImpl::canMacroFuseCmp() {
62296229 return ST->hasMacroFusion () || ST->hasBranchFusion ();
62306230}
62316231
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) {
62396233 if (!ST->hasAVX ())
62406234 return false ;
62416235
@@ -6259,8 +6253,28 @@ bool X86TTIImpl::isLegalMaskedLoad(Type *DataTy, Align Alignment) {
62596253 ((IntWidth == 8 || IntWidth == 16 ) && ST->hasBWI ());
62606254}
62616255
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);
62646278}
62656279
62666280bool X86TTIImpl::isLegalNTLoad (Type *DataType, Align Alignment) {
0 commit comments