]> granicus.if.org Git - clang/commitdiff
Only OCU vectors can be splatted.
authorAnders Carlsson <andersca@mac.com>
Fri, 1 Feb 2008 23:17:55 +0000 (23:17 +0000)
committerAnders Carlsson <andersca@mac.com>
Fri, 1 Feb 2008 23:17:55 +0000 (23:17 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46651 91177308-0d34-0410-b5e6-96231b3b80d8

CodeGen/CGExprScalar.cpp
test/CodeGen/vector.c [new file with mode: 0644]

index 820234033b0bb4aa03b94fb81bbe595a16588752..c812e21437af0b4896330102388553893e6b6b30 100644 (file)
@@ -370,8 +370,8 @@ Value *ScalarExprEmitter::EmitScalarConversion(Value *Src, QualType SrcType,
     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.");
diff --git a/test/CodeGen/vector.c b/test/CodeGen/vector.c
new file mode 100644 (file)
index 0000000..1edef0e
--- /dev/null
@@ -0,0 +1,6 @@
+typedef short __v4hi __attribute__ ((__vector_size__ (8)));
+
+void f()
+{
+    __v4hi A = (__v4hi)0LL;
+}
\ No newline at end of file