From e8b3e965561fe4efda3c93b67191a3043272d49e Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 4 Jan 2008 23:32:24 +0000 Subject: [PATCH] unnest vector handling again. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45602 91177308-0d34-0410-b5e6-96231b3b80d8 --- Sema/SemaExpr.cpp | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/Sema/SemaExpr.cpp b/Sema/SemaExpr.cpp index 6661cfb8cb..c617c4667f 100644 --- a/Sema/SemaExpr.cpp +++ b/Sema/SemaExpr.cpp @@ -1103,32 +1103,32 @@ Sema::CheckAssignmentConstraints(QualType lhsType, QualType rhsType) { return Compatible; return Incompatible; } - - if (lhsType->isArithmeticType() && rhsType->isArithmeticType()) { - if (lhsType->isVectorType() || rhsType->isVectorType()) { - // For OCUVector, allow vector splats; float -> - if (const OCUVectorType *LV = lhsType->getAsOCUVectorType()) { - if (LV->getElementType().getTypePtr() == rhsType.getTypePtr()) + + if (lhsType->isVectorType() || rhsType->isVectorType()) { + // For OCUVector, allow vector splats; float -> + if (const OCUVectorType *LV = lhsType->getAsOCUVectorType()) { + if (LV->getElementType().getTypePtr() == rhsType.getTypePtr()) + return Compatible; + } + + // If LHS and RHS are both vectors of integer or both vectors of floating + // point types, and the total vector length is the same, allow the + // conversion. This is a bitcast; no bits are changed but the result type + // is different. + if (getLangOptions().LaxVectorConversions && + lhsType->isVectorType() && rhsType->isVectorType()) { + if ((lhsType->isIntegerType() && rhsType->isIntegerType()) || + (lhsType->isRealFloatingType() && rhsType->isRealFloatingType())) { + if (Context.getTypeSize(lhsType, SourceLocation()) == + Context.getTypeSize(rhsType, SourceLocation())) return Compatible; } - - if (getLangOptions().LaxVectorConversions && - lhsType->isVectorType() && rhsType->isVectorType()) { - // If LHS and RHS are both integer or both floating point types, and - // the total vector length is the same, allow the conversion. This is - // a bitcast; no bits are changed but the result type is different. - if ((lhsType->isIntegerType() && rhsType->isIntegerType()) || - (lhsType->isRealFloatingType() && - rhsType->isRealFloatingType())) { - if (Context.getTypeSize(lhsType, SourceLocation()) == - Context.getTypeSize(rhsType, SourceLocation())) - return Compatible; - } - } - return Incompatible; - } + } + return Incompatible; + } + + if (lhsType->isArithmeticType() && rhsType->isArithmeticType()) return Compatible; - } if (lhsType->isPointerType()) { if (rhsType->isIntegerType()) -- 2.50.1