summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2008-02-01 23:17:55 +0000
committerAnders Carlsson <andersca@mac.com>2008-02-01 23:17:55 +0000
commit0b05d041f29c80a1230c2bb19c58647f0d5c3c98 (patch)
tree6197849d50fc9fe4469264d63aea945a02e1c9e7
parent0dffa442eaf43d9a9eb73f49e046583e567e6d2a (diff)
downloadbcm5719-llvm-0b05d041f29c80a1230c2bb19c58647f0d5c3c98.tar.gz
bcm5719-llvm-0b05d041f29c80a1230c2bb19c58647f0d5c3c98.zip
Only OCU vectors can be splatted.
llvm-svn: 46651
-rw-r--r--clang/CodeGen/CGExprScalar.cpp4
-rw-r--r--clang/test/CodeGen/vector.c6
2 files changed, 8 insertions, 2 deletions
diff --git a/clang/CodeGen/CGExprScalar.cpp b/clang/CodeGen/CGExprScalar.cpp
index 820234033b0..c812e21437a 100644
--- a/clang/CodeGen/CGExprScalar.cpp
+++ b/clang/CodeGen/CGExprScalar.cpp
@@ -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/clang/test/CodeGen/vector.c b/clang/test/CodeGen/vector.c
new file mode 100644
index 00000000000..1edef0ef40f
--- /dev/null
+++ b/clang/test/CodeGen/vector.c
@@ -0,0 +1,6 @@
+typedef short __v4hi __attribute__ ((__vector_size__ (8)));
+
+void f()
+{
+ __v4hi A = (__v4hi)0LL;
+} \ No newline at end of file
OpenPOWER on IntegriCloud