diff mbox

[Boolean,Vector,2/5] Change vector comparison IL requirement

Message ID 20151002140151.GF26618@msticlxl57.ims.intel.com
State New
Headers show

Commit Message

Ilya Enkovich Oct. 2, 2015, 2:01 p.m. UTC
Hi,

This patch change vector comparison to require boolean vector resulting type.

Thanks,
Ilya
--
gcc/

2015-10-02  Ilya Enkovich  <enkovich.gnu@gmail.com>

	* tree-cfg.c (verify_gimple_comparison) Require boolean
	vector type for vector comparison.
	(verify_gimple_assign_ternary): Likewise.

Comments

Jeff Law Oct. 9, 2015, 8:44 p.m. UTC | #1
On 10/02/2015 08:01 AM, Ilya Enkovich wrote:
> Hi,
>
> This patch change vector comparison to require boolean vector resulting type.
>
> Thanks,
> Ilya
> --
> gcc/
>
> 2015-10-02  Ilya Enkovich  <enkovich.gnu@gmail.com>
>
> 	* tree-cfg.c (verify_gimple_comparison) Require boolean
> 	vector type for vector comparison.
> 	(verify_gimple_assign_ternary): Likewise.
OK.
jeff
diff mbox

Patch

diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 807d96f..c3dcced 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -3464,10 +3464,10 @@  verify_gimple_comparison (tree type, tree op0, tree op1)
           return true;
         }
     }
-  /* Or an integer vector type with the same size and element count
+  /* Or a boolean vector type with the same element count
      as the comparison operand types.  */
   else if (TREE_CODE (type) == VECTOR_TYPE
-	   && TREE_CODE (TREE_TYPE (type)) == INTEGER_TYPE)
+	   && TREE_CODE (TREE_TYPE (type)) == BOOLEAN_TYPE)
     {
       if (TREE_CODE (op0_type) != VECTOR_TYPE
 	  || TREE_CODE (op1_type) != VECTOR_TYPE)
@@ -3478,12 +3478,7 @@  verify_gimple_comparison (tree type, tree op0, tree op1)
           return true;
         }
 
-      if (TYPE_VECTOR_SUBPARTS (type) != TYPE_VECTOR_SUBPARTS (op0_type)
-	  || (GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (type)))
-	      != GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (op0_type))))
-	  /* The result of a vector comparison is of signed
-	     integral type.  */
-	  || TYPE_UNSIGNED (TREE_TYPE (type)))
+      if (TYPE_VECTOR_SUBPARTS (type) != TYPE_VECTOR_SUBPARTS (op0_type))
         {
           error ("invalid vector comparison resulting type");
           debug_generic_expr (type);
@@ -3970,15 +3965,13 @@  verify_gimple_assign_ternary (gassign *stmt)
       break;
 
     case VEC_COND_EXPR:
-      if (!VECTOR_INTEGER_TYPE_P (rhs1_type)
-	  || TYPE_SIGN (rhs1_type) != SIGNED
-	  || TYPE_SIZE (rhs1_type) != TYPE_SIZE (lhs_type)
+      if (!VECTOR_BOOLEAN_TYPE_P (rhs1_type)
 	  || TYPE_VECTOR_SUBPARTS (rhs1_type)
 	     != TYPE_VECTOR_SUBPARTS (lhs_type))
 	{
-	  error ("the first argument of a VEC_COND_EXPR must be of a signed "
-		 "integral vector type of the same size and number of "
-		 "elements as the result");
+	  error ("the first argument of a VEC_COND_EXPR must be of a "
+		 "boolean vector type of the same number of elements "
+		 "as the result");
 	  debug_generic_expr (lhs_type);
 	  debug_generic_expr (rhs1_type);
 	  return true;