[cfe-commits] r46651 - in /cfe/trunk: CodeGen/CGExprScalar.cpp test/CodeGen/vector.c

Anders Carlsson andersca at mac.com
Fri Feb 1 15:17:55 PST 2008


Author: andersca
Date: Fri Feb  1 17:17:55 2008
New Revision: 46651

URL: http://llvm.org/viewvc/llvm-project?rev=46651&view=rev
Log:
Only OCU vectors can be splatted.

Added:
    cfe/trunk/test/CodeGen/vector.c
Modified:
    cfe/trunk/CodeGen/CGExprScalar.cpp

Modified: cfe/trunk/CodeGen/CGExprScalar.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CGExprScalar.cpp?rev=46651&r1=46650&r2=46651&view=diff

==============================================================================
--- cfe/trunk/CodeGen/CGExprScalar.cpp (original)
+++ cfe/trunk/CodeGen/CGExprScalar.cpp Fri Feb  1 17:17:55 2008
@@ -370,8 +370,8 @@
     return Builder.CreatePtrToInt(Src, DstTy, "conv");
   }
   
-  // A scalar source can be splatted to a vector of the same element type
-  if (isa<llvm::VectorType>(DstTy) && !isa<VectorType>(SrcType)) {
+  // A scalar source can be splatted to an OCU vector of the same element type
+  if (DstType->isOCUVectorType() && !isa<VectorType>(SrcType)) {
     const llvm::VectorType *VT = cast<llvm::VectorType>(DstTy);
     assert((VT->getElementType() == Src->getType()) &&
            "Vector element type must match scalar type to splat.");

Added: cfe/trunk/test/CodeGen/vector.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/vector.c?rev=46651&view=auto

==============================================================================
--- cfe/trunk/test/CodeGen/vector.c (added)
+++ cfe/trunk/test/CodeGen/vector.c Fri Feb  1 17:17:55 2008
@@ -0,0 +1,6 @@
+typedef short __v4hi __attribute__ ((__vector_size__ (8)));
+
+void f()
+{
+    __v4hi A = (__v4hi)0LL;
+}
\ No newline at end of file





More information about the cfe-commits mailing list