]> granicus.if.org Git - clang/commitdiff
Generalize ASTContext::areCompatibleVectorTypes to handle new Neon vector types.
authorBob Wilson <bob.wilson@apple.com>
Fri, 12 Nov 2010 17:24:54 +0000 (17:24 +0000)
committerBob Wilson <bob.wilson@apple.com>
Fri, 12 Nov 2010 17:24:54 +0000 (17:24 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118901 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/ASTContext.h
lib/AST/ASTContext.cpp

index 9e2221b21798a2a00ac600bf95b0f2905614a175..cda07077f24c1d961436d454e7def454bf23d90e 100644 (file)
@@ -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
index 9146eb57aa99b8be4a392e2f726f820ecbb36500..c852482af2e1eacfe88c4da8dc31cd5bd51552b2 100644 (file)
@@ -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<VectorType>();
   const VectorType *Second = SecondVec->getAs<VectorType>();
-  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;