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]

Re: [PATCH] Introduce VEC_UNPACK_FIX_TRUNC_{LO,HI}_EXPR and VEC_PACK_FLOAT_EXPR, use it in x86 vectorization (PR target/85918)


On Tue, May 29, 2018 at 11:15:51AM +0200, Richard Biener wrote:
> Looking at other examples the only thing we have is
> maybe_ne and friends on TYPE_VECTOR_SUBPARTS.  But I think the only
> thing missing is
> 
>  || (maybe_ne (TYPE_VECTOR_SUBPARTS (lhs_type),
> 	       2 * TYPE_VECTOR_SUBPARTS (rhs_type)))
> 
> that together with the mode size check should ensure same size
> vectors.

The other way around.  It would then be (and I've added similar tests for
VEC_PACK*):

2018-05-29  Jakub Jelinek  <jakub@redhat.com>

	* tree-cfg.c (verify_gimple_assign_unary): Add checking for
	VEC_UNPACK_*_EXPR.
	(verify_gimple_assign_binary): Check TYPE_VECTOR_SUBPARTS for
	VEC_PACK_*_EXPR.

--- gcc/tree-cfg.c.jj	2018-05-28 19:47:55.180685259 +0200
+++ gcc/tree-cfg.c	2018-05-29 11:27:14.521339290 +0200
@@ -3678,7 +3678,37 @@ verify_gimple_assign_unary (gassign *stm
     case VEC_UNPACK_FLOAT_LO_EXPR:
     case VEC_UNPACK_FIX_TRUNC_HI_EXPR:
     case VEC_UNPACK_FIX_TRUNC_LO_EXPR:
-      /* FIXME.  */
+      if (TREE_CODE (rhs1_type) != VECTOR_TYPE
+          || TREE_CODE (lhs_type) != VECTOR_TYPE
+          || (!INTEGRAL_TYPE_P (TREE_TYPE (lhs_type))
+	      && !SCALAR_FLOAT_TYPE_P (TREE_TYPE (lhs_type)))
+          || (!INTEGRAL_TYPE_P (TREE_TYPE (rhs1_type))
+	      && !SCALAR_FLOAT_TYPE_P (TREE_TYPE (rhs1_type)))
+	  || ((rhs_code == VEC_UNPACK_HI_EXPR
+	       || rhs_code == VEC_UNPACK_LO_EXPR)
+	      && (INTEGRAL_TYPE_P (TREE_TYPE (lhs_type))
+		  != INTEGRAL_TYPE_P (TREE_TYPE (rhs1_type))))
+	  || ((rhs_code == VEC_UNPACK_FLOAT_HI_EXPR
+	       || rhs_code == VEC_UNPACK_FLOAT_LO_EXPR)
+	      && (INTEGRAL_TYPE_P (TREE_TYPE (lhs_type))
+		  || SCALAR_FLOAT_TYPE_P (TREE_TYPE (rhs1_type))))
+	  || ((rhs_code == VEC_UNPACK_FIX_TRUNC_HI_EXPR
+	       || rhs_code == VEC_UNPACK_FIX_TRUNC_LO_EXPR)
+	      && (INTEGRAL_TYPE_P (TREE_TYPE (rhs1_type))
+		  || SCALAR_FLOAT_TYPE_P (TREE_TYPE (lhs_type))))
+	  || (maybe_ne (GET_MODE_SIZE (element_mode (lhs_type)),
+			2 * GET_MODE_SIZE (element_mode (rhs1_type)))
+	      && (!VECTOR_BOOLEAN_TYPE_P (lhs_type)
+		  || !VECTOR_BOOLEAN_TYPE_P (rhs1_type)))
+	  || maybe_ne (2 * TYPE_VECTOR_SUBPARTS (lhs_type),
+		       TYPE_VECTOR_SUBPARTS (rhs1_type)))
+	{
+	  error ("type mismatch in vector unpack expression");
+	  debug_generic_expr (lhs_type);
+	  debug_generic_expr (rhs1_type);
+	  return true;
+        }
+
       return false;
 
     case NEGATE_EXPR:
@@ -3993,7 +4023,9 @@ verify_gimple_assign_binary (gassign *st
 		     == INTEGRAL_TYPE_P (TREE_TYPE (lhs_type))))
 	    || !types_compatible_p (rhs1_type, rhs2_type)
 	    || maybe_ne (GET_MODE_SIZE (element_mode (rhs1_type)),
-			 2 * GET_MODE_SIZE (element_mode (lhs_type))))
+			 2 * GET_MODE_SIZE (element_mode (lhs_type)))
+	    || maybe_ne (2 * TYPE_VECTOR_SUBPARTS (rhs1_type),
+			 TYPE_VECTOR_SUBPARTS (lhs_type)))
           {
             error ("type mismatch in vector pack expression");
             debug_generic_expr (lhs_type);
@@ -4012,7 +4044,9 @@ verify_gimple_assign_binary (gassign *st
 	  || !SCALAR_FLOAT_TYPE_P (TREE_TYPE (lhs_type))
 	  || !types_compatible_p (rhs1_type, rhs2_type)
 	  || maybe_ne (GET_MODE_SIZE (element_mode (rhs1_type)),
-		       2 * GET_MODE_SIZE (element_mode (lhs_type))))
+		       2 * GET_MODE_SIZE (element_mode (lhs_type)))
+	  || maybe_ne (2 * TYPE_VECTOR_SUBPARTS (rhs1_type),
+		       TYPE_VECTOR_SUBPARTS (lhs_type)))
 	{
 	  error ("type mismatch in vector pack expression");
 	  debug_generic_expr (lhs_type);


	Jakub


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