[cfe-commits] r45442 - /cfe/trunk/Sema/SemaExpr.cpp
    Nate Begeman 
    natebegeman at mac.com
       
    Sat Dec 29 17:45:55 PST 2007
    
    
  
Author: sampo
Date: Sat Dec 29 19:45:55 2007
New Revision: 45442
URL: http://llvm.org/viewvc/llvm-project?rev=45442&view=rev
Log:
Allow splat casts for OCU vector assignments & add some comments.
Modified:
    cfe/trunk/Sema/SemaExpr.cpp
Modified: cfe/trunk/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaExpr.cpp?rev=45442&r1=45441&r2=45442&view=diff
==============================================================================
--- cfe/trunk/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/Sema/SemaExpr.cpp Sat Dec 29 19:45:55 2007
@@ -1129,7 +1129,15 @@
         if (lhsType.getCanonicalType() != rhsType.getCanonicalType())
           return Incompatible;
       } else {
+        // For OCUVector, allow vector splats; float -> <n x float>
+        if (const OCUVectorType *LV = lhsType->getAsOCUVectorType()) {
+          if (LV->getElementType().getTypePtr() == rhsType.getTypePtr())
+            return Compatible;
+        }
         if (lhsType->isVectorType() && rhsType->isVectorType()) {
+          // If LHS and RHS are both integer or both floating point types, and
+          // the total vector length is the same, allow the conversion.  This is
+          // a bitcast; no bits are changed but the result type is different.
           if ((lhsType->isIntegerType() && rhsType->isIntegerType()) ||
               (lhsType->isRealFloatingType() && 
                rhsType->isRealFloatingType())) {
    
    
More information about the cfe-commits
mailing list