This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] (gimple) Allow integer return type from vector compares


Hi, 
    
Update the logic in verify_gimple_comparision to allow a vector integer result
from a vector comparison, where it previously was limited to only allowing
compares with boolean results.  This allows powerpc intrinsics such as this
one to build (after gimple folding):
   vector bool int vec_cmpeq (vector signed int, vector signed int);

This has been tested in conjunction with the "rs6000 GIMPLE folding for vector
compares" patch (posted separately) on p6 and newer.

OK for trunk?
    
Thanks,
-Will
    
[gcc]

2017-10-12  Will Schmidt  <will_schmidt@vnet.ibm.com>

	* gcc/tree-cfg.c: (@ verify_gimple_comparison ): allow boolean result
	from vector compares.

diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index b5e0460..adf3607 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -3624,14 +3624,16 @@ verify_gimple_comparison (tree type, tree op0, tree op1, enum tree_code code)
 	  debug_generic_expr (op0_type);
 	  debug_generic_expr (op1_type);
 	  return true;
         }
     }
-  /* Or a boolean vector type with the same element count
-     as the comparison operand types.  */
+  /* Or a vector type with the same element count
+     as the comparison operand types.  The vector type may
+     be boolean or integer.  */
   else if (TREE_CODE (type) == VECTOR_TYPE
-	   && TREE_CODE (TREE_TYPE (type)) == BOOLEAN_TYPE)
+	   && (( TREE_CODE (TREE_TYPE (type)) == BOOLEAN_TYPE)
+	   || ( TREE_CODE (TREE_TYPE (type)) == INTEGER_TYPE)))
     {
       if (TREE_CODE (op0_type) != VECTOR_TYPE
 	  || TREE_CODE (op1_type) != VECTOR_TYPE)
         {
           error ("non-vector operands in vector comparison");



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]