@@ -10510,87 +10510,6 @@ bool ASTContext::areCompatibleVectorTypes(QualType FirstVec,
1051010510 return false;
1051110511}
1051210512
10513- /// getSVETypeSize - Return SVE vector or predicate register size.
10514- static uint64_t getSVETypeSize(ASTContext &Context, const BuiltinType *Ty) {
10515- assert(Ty->isSveVLSBuiltinType() && "Invalid SVE Type");
10516- if (Ty->getKind() == BuiltinType::SveBool ||
10517- Ty->getKind() == BuiltinType::SveCount)
10518- return (Context.getLangOpts().VScaleMin * 128) / Context.getCharWidth();
10519- return Context.getLangOpts().VScaleMin * 128;
10520- }
10521-
10522- bool ASTContext::areCompatibleSveTypes(QualType FirstType,
10523- QualType SecondType) {
10524- auto IsValidCast = [this](QualType FirstType, QualType SecondType) {
10525- if (const auto *BT = FirstType->getAs<BuiltinType>()) {
10526- if (const auto *VT = SecondType->getAs<VectorType>()) {
10527- // Predicates have the same representation as uint8 so we also have to
10528- // check the kind to make these types incompatible.
10529- if (VT->getVectorKind() == VectorKind::SveFixedLengthPredicate)
10530- return BT->getKind() == BuiltinType::SveBool;
10531- else if (VT->getVectorKind() == VectorKind::SveFixedLengthData)
10532- return VT->getElementType().getCanonicalType() ==
10533- FirstType->getSveEltType(*this);
10534- else if (VT->getVectorKind() == VectorKind::Generic)
10535- return getTypeSize(SecondType) == getSVETypeSize(*this, BT) &&
10536- hasSameType(VT->getElementType(),
10537- getBuiltinVectorTypeInfo(BT).ElementType);
10538- }
10539- }
10540- return false;
10541- };
10542-
10543- return IsValidCast(FirstType, SecondType) ||
10544- IsValidCast(SecondType, FirstType);
10545- }
10546-
10547- bool ASTContext::areLaxCompatibleSveTypes(QualType FirstType,
10548- QualType SecondType) {
10549- auto IsLaxCompatible = [this](QualType FirstType, QualType SecondType) {
10550- const auto *BT = FirstType->getAs<BuiltinType>();
10551- if (!BT)
10552- return false;
10553-
10554- const auto *VecTy = SecondType->getAs<VectorType>();
10555- if (VecTy && (VecTy->getVectorKind() == VectorKind::SveFixedLengthData ||
10556- VecTy->getVectorKind() == VectorKind::Generic)) {
10557- const LangOptions::LaxVectorConversionKind LVCKind =
10558- getLangOpts().getLaxVectorConversions();
10559-
10560- // Can not convert between sve predicates and sve vectors because of
10561- // different size.
10562- if (BT->getKind() == BuiltinType::SveBool &&
10563- VecTy->getVectorKind() == VectorKind::SveFixedLengthData)
10564- return false;
10565-
10566- // If __ARM_FEATURE_SVE_BITS != N do not allow GNU vector lax conversion.
10567- // "Whenever __ARM_FEATURE_SVE_BITS==N, GNUT implicitly
10568- // converts to VLAT and VLAT implicitly converts to GNUT."
10569- // ACLE Spec Version 00bet6, 3.7.3.2. Behavior common to vectors and
10570- // predicates.
10571- if (VecTy->getVectorKind() == VectorKind::Generic &&
10572- getTypeSize(SecondType) != getSVETypeSize(*this, BT))
10573- return false;
10574-
10575- // If -flax-vector-conversions=all is specified, the types are
10576- // certainly compatible.
10577- if (LVCKind == LangOptions::LaxVectorConversionKind::All)
10578- return true;
10579-
10580- // If -flax-vector-conversions=integer is specified, the types are
10581- // compatible if the elements are integer types.
10582- if (LVCKind == LangOptions::LaxVectorConversionKind::Integer)
10583- return VecTy->getElementType().getCanonicalType()->isIntegerType() &&
10584- FirstType->getSveEltType(*this)->isIntegerType();
10585- }
10586-
10587- return false;
10588- };
10589-
10590- return IsLaxCompatible(FirstType, SecondType) ||
10591- IsLaxCompatible(SecondType, FirstType);
10592- }
10593-
1059410513/// getRVVTypeSize - Return RVV vector register size.
1059510514static uint64_t getRVVTypeSize(ASTContext &Context, const BuiltinType *Ty) {
1059610515 assert(Ty->isRVVVLSBuiltinType() && "Invalid RVV Type");
0 commit comments