[cfe-commits] r118901 - in /cfe/trunk: include/clang/AST/ASTContext.h lib/AST/ASTContext.cpp

Bob Wilson bob.wilson at apple.com
Fri Nov 12 09:24:55 PST 2010


Author: bwilson
Date: Fri Nov 12 11:24:54 2010
New Revision: 118901

URL: http://llvm.org/viewvc/llvm-project?rev=118901&view=rev
Log:
Generalize ASTContext::areCompatibleVectorTypes to handle new Neon vector types.

Modified:
    cfe/trunk/include/clang/AST/ASTContext.h
    cfe/trunk/lib/AST/ASTContext.cpp

Modified: cfe/trunk/include/clang/AST/ASTContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=118901&r1=118900&r2=118901&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ASTContext.h (original)
+++ cfe/trunk/include/clang/AST/ASTContext.h Fri Nov 12 11:24:54 2010
@@ -941,9 +941,10 @@
   ///
   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

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=118901&r1=118900&r2=118901&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Fri Nov 12 11:24:54 2010
@@ -4284,15 +4284,16 @@
   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;





More information about the cfe-commits mailing list