[PATCH] Introduce VEC_UNPACK_FIX_TRUNC_{LO,HI}_EXPR and VEC_PACK_FLOAT_EXPR, use it in x86 vectorization (PR target/85918)
Richard Biener
rguenther@suse.de
Tue May 29 09:29:00 GMT 2018
On Tue, 29 May 2018, Jakub Jelinek wrote:
> 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).
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.
Ok with this adjustment.
Thanks,
Richard.
> 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
>
>
--
Richard Biener <rguenther@suse.de>
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)
More information about the Gcc-patches
mailing list