aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/CGExprScalar.cpp4
-rw-r--r--lib/Sema/SemaExpr.cpp10
2 files changed, 9 insertions, 5 deletions
diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp
index 27b868974d..c6a5a40d76 100644
--- a/lib/CodeGen/CGExprScalar.cpp
+++ b/lib/CodeGen/CGExprScalar.cpp
@@ -2119,7 +2119,9 @@ Value *ScalarExprEmitter::EmitCompare(const BinaryOperator *E,unsigned UICmpOpc,
// If AltiVec, the comparison results in a numeric type, so we use
// intrinsics comparing vectors and giving 0 or 1 as a result
- if (LHSTy->isVectorType() && CGF.getContext().getLangOptions().AltiVec) {
+ if (LHSTy->isVectorType() &&
+ LHSTy->getAs<VectorType>()->getVectorKind() ==
+ VectorType::AltiVecVector) {
// constants for mapping CR6 register bits to predicate result
enum { CR6_EQ=0, CR6_EQ_REV, CR6_LT, CR6_LT_REV } CR6;
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index b5c67b8fe6..214edf145c 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -7277,14 +7277,16 @@ QualType Sema::CheckVectorCompareOperands(Expr *&lex, Expr *&rex,
if (vType.isNull())
return vType;
+ QualType lType = lex->getType();
+ QualType rType = rex->getType();
+
// If AltiVec, the comparison results in a numeric type, i.e.
// bool for C++, int for C
- if (getLangOptions().AltiVec)
+ if (lType->getAs<VectorType>()->getVectorKind() == VectorType::AltiVecVector
+ && rType->getAs<VectorType>()->getVectorKind() ==
+ VectorType::AltiVecVector)
return Context.getLogicalOperationType();
- QualType lType = lex->getType();
- QualType rType = rex->getType();
-
// For non-floating point types, check for self-comparisons of the form
// x == x, x != x, x < x, etc. These always evaluate to a constant, and
// often indicate logic errors in the program.