summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorEric Christopher <echristo@apple.com>2010-08-26 00:42:16 +0000
committerEric Christopher <echristo@apple.com>2010-08-26 00:42:16 +0000
commita613f56559102850a38d083d6a74b6963bd8243d (patch)
treeef7c825f5c80becb878d6ef698096288fd1ec863 /clang/lib
parent109986512462cdf99b555d87b3119ea009979b59 (diff)
downloadbcm5719-llvm-a613f56559102850a38d083d6a74b6963bd8243d.tar.gz
bcm5719-llvm-a613f56559102850a38d083d6a74b6963bd8243d.zip
With lax vector conversions (the default) make sure we convert between two
vectors that are the same size. Fix up testcases accordingly and add a new one to make sure we still error if lax vector conversions are disabled. Fixes rdar://8328190 llvm-svn: 112122
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaExpr.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 0bc58ef21c7..a452bf3557b 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -5005,7 +5005,6 @@ QualType Sema::CheckVectorOperands(SourceLocation Loc, Expr *&lex, Expr *&rex) {
// Handle the case of a vector & extvector type of the same size and element
// type. It would be nice if we only had one vector type someday.
if (getLangOptions().LaxVectorConversions) {
- // FIXME: Should we warn here?
if (const VectorType *LV = lhsType->getAs<VectorType>()) {
if (const VectorType *RV = rhsType->getAs<VectorType>())
if (LV->getElementType() == RV->getElementType() &&
@@ -5017,8 +5016,14 @@ QualType Sema::CheckVectorOperands(SourceLocation Loc, Expr *&lex, Expr *&rex) {
ImpCastExprToType(lex, rhsType, CK_BitCast);
return rhsType;
+ } else if (Context.getTypeSize(lhsType) ==Context.getTypeSize(rhsType)){
+ // If we are allowing lax vector conversions, and LHS and RHS are both
+ // vectors, the total size only needs to be the same. This is a
+ // bitcast; no bits are changed but the result type is different.
+ ImpCastExprToType(rex, lhsType, CK_BitCast);
+ return lhsType;
}
- }
+ }
}
// Handle the case of equivalent AltiVec and GCC vector types
OpenPOWER on IntegriCloud