From 79b67f351fe885118d0685fafc9518e97a159529 Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Fri, 1 Feb 2008 23:17:55 +0000 Subject: [PATCH] Only OCU vectors can be splatted. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46651 91177308-0d34-0410-b5e6-96231b3b80d8 --- CodeGen/CGExprScalar.cpp | 4 ++-- test/CodeGen/vector.c | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 test/CodeGen/vector.c diff --git a/CodeGen/CGExprScalar.cpp b/CodeGen/CGExprScalar.cpp index 820234033b..c812e21437 100644 --- a/CodeGen/CGExprScalar.cpp +++ b/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(DstTy) && !isa(SrcType)) { + // A scalar source can be splatted to an OCU vector of the same element type + if (DstType->isOCUVectorType() && !isa(SrcType)) { const llvm::VectorType *VT = cast(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 index 0000000000..1edef0ef40 --- /dev/null +++ b/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 -- 2.40.0