@@ -10443,87 +10443,6 @@ bool ASTContext::areCompatibleVectorTypes(QualType FirstVec,
1044310443 return false;
1044410444}
1044510445
10446- /// getSVETypeSize - Return SVE vector or predicate register size.
10447- static uint64_t getSVETypeSize(ASTContext &Context, const BuiltinType *Ty) {
10448- assert(Ty->isSveVLSBuiltinType() && "Invalid SVE Type");
10449- if (Ty->getKind() == BuiltinType::SveBool ||
10450- Ty->getKind() == BuiltinType::SveCount)
10451- return (Context.getLangOpts().VScaleMin * 128) / Context.getCharWidth();
10452- return Context.getLangOpts().VScaleMin * 128;
10453- }
10454-
10455- bool ASTContext::areCompatibleSveTypes(QualType FirstType,
10456- QualType SecondType) {
10457- auto IsValidCast = [this](QualType FirstType, QualType SecondType) {
10458- if (const auto *BT = FirstType->getAs<BuiltinType>()) {
10459- if (const auto *VT = SecondType->getAs<VectorType>()) {
10460- // Predicates have the same representation as uint8 so we also have to
10461- // check the kind to make these types incompatible.
10462- if (VT->getVectorKind() == VectorKind::SveFixedLengthPredicate)
10463- return BT->getKind() == BuiltinType::SveBool;
10464- else if (VT->getVectorKind() == VectorKind::SveFixedLengthData)
10465- return VT->getElementType().getCanonicalType() ==
10466- FirstType->getSveEltType(*this);
10467- else if (VT->getVectorKind() == VectorKind::Generic)
10468- return getTypeSize(SecondType) == getSVETypeSize(*this, BT) &&
10469- hasSameType(VT->getElementType(),
10470- getBuiltinVectorTypeInfo(BT).ElementType);
10471- }
10472- }
10473- return false;
10474- };
10475-
10476- return IsValidCast(FirstType, SecondType) ||
10477- IsValidCast(SecondType, FirstType);
10478- }
10479-
10480- bool ASTContext::areLaxCompatibleSveTypes(QualType FirstType,
10481- QualType SecondType) {
10482- auto IsLaxCompatible = [this](QualType FirstType, QualType SecondType) {
10483- const auto *BT = FirstType->getAs<BuiltinType>();
10484- if (!BT)
10485- return false;
10486-
10487- const auto *VecTy = SecondType->getAs<VectorType>();
10488- if (VecTy && (VecTy->getVectorKind() == VectorKind::SveFixedLengthData ||
10489- VecTy->getVectorKind() == VectorKind::Generic)) {
10490- const LangOptions::LaxVectorConversionKind LVCKind =
10491- getLangOpts().getLaxVectorConversions();
10492-
10493- // Can not convert between sve predicates and sve vectors because of
10494- // different size.
10495- if (BT->getKind() == BuiltinType::SveBool &&
10496- VecTy->getVectorKind() == VectorKind::SveFixedLengthData)
10497- return false;
10498-
10499- // If __ARM_FEATURE_SVE_BITS != N do not allow GNU vector lax conversion.
10500- // "Whenever __ARM_FEATURE_SVE_BITS==N, GNUT implicitly
10501- // converts to VLAT and VLAT implicitly converts to GNUT."
10502- // ACLE Spec Version 00bet6, 3.7.3.2. Behavior common to vectors and
10503- // predicates.
10504- if (VecTy->getVectorKind() == VectorKind::Generic &&
10505- getTypeSize(SecondType) != getSVETypeSize(*this, BT))
10506- return false;
10507-
10508- // If -flax-vector-conversions=all is specified, the types are
10509- // certainly compatible.
10510- if (LVCKind == LangOptions::LaxVectorConversionKind::All)
10511- return true;
10512-
10513- // If -flax-vector-conversions=integer is specified, the types are
10514- // compatible if the elements are integer types.
10515- if (LVCKind == LangOptions::LaxVectorConversionKind::Integer)
10516- return VecTy->getElementType().getCanonicalType()->isIntegerType() &&
10517- FirstType->getSveEltType(*this)->isIntegerType();
10518- }
10519-
10520- return false;
10521- };
10522-
10523- return IsLaxCompatible(FirstType, SecondType) ||
10524- IsLaxCompatible(SecondType, FirstType);
10525- }
10526-
1052710446/// getRVVTypeSize - Return RVV vector register size.
1052810447static uint64_t getRVVTypeSize(ASTContext &Context, const BuiltinType *Ty) {
1052910448 assert(Ty->isRVVVLSBuiltinType() && "Invalid RVV Type");
0 commit comments