[cfe-commits] r46664 - /cfe/trunk/CodeGen/CGExprScalar.cpp
Chris Lattner
sabre at nondot.org
Fri Feb 1 20:51:41 PST 2008
Author: lattner
Date: Fri Feb 1 22:51:41 2008
New Revision: 46664
URL: http://llvm.org/viewvc/llvm-project?rev=46664&view=rev
Log:
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.
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=46664&r1=46663&r2=46664&view=diff
==============================================================================
--- cfe/trunk/CodeGen/CGExprScalar.cpp (original)
+++ cfe/trunk/CodeGen/CGExprScalar.cpp Fri Feb 1 22:51:41 2008
@@ -371,18 +371,15 @@
}
// 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.");
+ if (DstType->isOCUVectorType() && !isa<VectorType>(SrcType) &&
+ cast<llvm::VectorType>(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<llvm::VectorType>(Src->getType()) ||
- isa<llvm::VectorType>(DstTy)) {
+ isa<llvm::VectorType>(DstTy))
return Builder.CreateBitCast(Src, DstTy, "conv");
- }
// Finally, we have the arithmetic types: real int/float.
if (isa<llvm::IntegerType>(Src->getType())) {
More information about the cfe-commits
mailing list