From: Chris Lattner Date: Sat, 2 Feb 2008 04:51:41 +0000 (+0000) Subject: minor tweak to anders patch: (only) ocu vectors support splatting, but X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3b1ae004d0ee88fc029dad876ec5695f178ef3f6;p=clang minor tweak to anders patch: (only) ocu vectors support splatting, but ocu vectors should not treat bitcasts from int <-> vector as a splat unless it is of the element type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46664 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/CodeGen/CGExprScalar.cpp b/CodeGen/CGExprScalar.cpp index c812e21437..6db7beed0b 100644 --- a/CodeGen/CGExprScalar.cpp +++ b/CodeGen/CGExprScalar.cpp @@ -371,18 +371,15 @@ Value *ScalarExprEmitter::EmitScalarConversion(Value *Src, QualType 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."); + if (DstType->isOCUVectorType() && !isa(SrcType) && + cast(DstTy)->getElementType() == Src->getType()) return CGF.EmitVector(&Src, DstType->getAsVectorType()->getNumElements(), true); - } + // Allow bitcast from vector to integer/fp of the same size. if (isa(Src->getType()) || - isa(DstTy)) { + isa(DstTy)) return Builder.CreateBitCast(Src, DstTy, "conv"); - } // Finally, we have the arithmetic types: real int/float. if (isa(Src->getType())) {