From f69eb7cf8e616b5aad7911ec6f79b24b0a009227 Mon Sep 17 00:00:00 2001 From: Bob Wilson Date: Fri, 12 Nov 2010 17:24:54 +0000 Subject: [PATCH] Generalize ASTContext::areCompatibleVectorTypes to handle new Neon vector types. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118901 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/AST/ASTContext.h | 7 ++++--- lib/AST/ASTContext.cpp | 13 +++++++------ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/include/clang/AST/ASTContext.h b/include/clang/AST/ASTContext.h index 9e2221b217..cda07077f2 100644 --- a/include/clang/AST/ASTContext.h +++ b/include/clang/AST/ASTContext.h @@ -941,9 +941,10 @@ public: /// Qualifiers::GC getObjCGCAttrKind(const QualType &Ty) const; - /// areCompatibleVectorTypes - Return true if the given vector types either - /// are of the same unqualified type or if one is GCC and other - equivalent - /// AltiVec vector type. + /// areCompatibleVectorTypes - Return true if the given vector types + /// are of the same unqualified type or if they are equivalent to the same + /// GCC vector type, ignoring whether they are target-specific (AltiVec or + /// Neon) types. bool areCompatibleVectorTypes(QualType FirstVec, QualType SecondVec); /// isObjCNSObjectType - Return true if this is an NSObject object with diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 9146eb57aa..c852482af2 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -4284,15 +4284,16 @@ bool ASTContext::areCompatibleVectorTypes(QualType FirstVec, if (hasSameUnqualifiedType(FirstVec, SecondVec)) return true; - // AltiVec vectors types are identical to equivalent GCC vector types + // Treat Neon vector types and most AltiVec vector types as if they are the + // equivalent GCC vector types. const VectorType *First = FirstVec->getAs(); const VectorType *Second = SecondVec->getAs(); - if ((((First->getVectorKind() == VectorType::AltiVecVector) && - (Second->getVectorKind() == VectorType::GenericVector)) || - ((First->getVectorKind() == VectorType::GenericVector) && - (Second->getVectorKind() == VectorType::AltiVecVector))) && + if (First->getNumElements() == Second->getNumElements() && hasSameType(First->getElementType(), Second->getElementType()) && - (First->getNumElements() == Second->getNumElements())) + First->getVectorKind() != VectorType::AltiVecPixel && + First->getVectorKind() != VectorType::AltiVecBool && + Second->getVectorKind() != VectorType::AltiVecPixel && + Second->getVectorKind() != VectorType::AltiVecBool) return true; return false; -- 2.40.0