[PATCH] Introduce VEC_UNPACK_FIX_TRUNC_{LO,HI}_EXPR and VEC_PACK_FLOAT_EXPR, use it in x86 vectorization (PR target/85918)
Jakub Jelinek
jakub@redhat.com
Tue May 29 08:59:00 GMT 2018
On Mon, May 28, 2018 at 12:12:18PM +0200, Richard Biener wrote:
> > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
> Apart from
>
> --- gcc/tree-cfg.c.jj 2018-05-26 23:03:55.361873297 +0200
> +++ gcc/tree-cfg.c 2018-05-27 12:54:55.046197128 +0200
> @@ -3676,6 +3676,8 @@ verify_gimple_assign_unary (gassign *stm
> case VEC_UNPACK_LO_EXPR:
> case VEC_UNPACK_FLOAT_HI_EXPR:
> case VEC_UNPACK_FLOAT_LO_EXPR:
> + case VEC_UNPACK_FIX_TRUNC_HI_EXPR:
> + case VEC_UNPACK_FIX_TRUNC_LO_EXPR:
> /* FIXME. */
> return false;
>
>
> the middle-end changes look OK. Can you please add verification
> for the new codes here?
So like this (incremental patch, as it affects also the other codes)?
The VECTOR_BOOLEAN_P stuff is there because apparently we use these codes on
vector booleans too where the element size is the same (for
VEC_UNPACK_{HI,LO}_EXPR only).
Also, not really sure how to verify sizes of the whole vectors or better
nunits in the world of poly-int vector sizes (but VEC_PACK_*EXPR doesn't
verify that either).
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
2018-05-29 Jakub Jelinek <jakub@redhat.com>
* tree-cfg.c (verify_gimple_assign_unary): Add checking for
VEC_UNPACK_*_EXPR.
--- gcc/tree-cfg.c.jj 2018-05-28 19:47:55.180685259 +0200
+++ gcc/tree-cfg.c 2018-05-29 10:05:55.213775216 +0200
@@ -3678,7 +3678,35 @@ 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))))
+ {
+ error ("type mismatch in vector unpack expression");
+ debug_generic_expr (lhs_type);
+ debug_generic_expr (rhs1_type);
+ return true;
+ }
+
return false;
case NEGATE_EXPR:
Jakub
More information about the Gcc-patches
mailing list