Hi all,

the patch makes AltiVec vector comparison logic affect only vectors of fundamental AltiVec vector types. It fixes 9347.
Please review.

--
Anton

Index: CodeGen/CGExprScalar.cpp
===================================================================
--- CodeGen/CGExprScalar.cpp	(revision 126783)
+++ CodeGen/CGExprScalar.cpp	(working copy)
@@ -2115,7 +2115,9 @@
 
     // 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;
 
Index: Sema/SemaExpr.cpp
===================================================================
--- Sema/SemaExpr.cpp	(revision 126804)
+++ Sema/SemaExpr.cpp	(working copy)
@@ -7149,14 +7149,16 @@
   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.
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to