On Thu, Mar 10, 2016 at 11:12 AM, Ilya Enkovich <enkovich....@gmail.com> wrote:
> Hi,
>
> Curently when vectorizing masked load/store we don't check
> mask and value have the same number of elements.  Usually
> conversion patterns apply and we don't have such case but
> conversion patterns may fail to properly determine mask
> type and we shouldn't rely on it so hard.
>
> Unfortunately I couldn't make a small testcase where we fail
> to determine mask type.  For me it happeneds when mixed C/Fortran
> code was compiled with LTO and I had various scalar boolean types.
>
> Bootstrapped and regtested on x86_64-pc-linux-gnu.  Ok for trunk
> with no testcase?

Ok.

Richard.

> Thanks,
> Ilya
> --
> gcc/
>
> 2016-03-10  Ilya Enkovich  <enkovich....@gmail.com>
>
>         * tree-vect-stmts.c (vectorizable_mask_load_store): Check mask
>         has a proper number of elements.
>
>
> diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
> index 6ac273d..06b1ab7 100644
> --- a/gcc/tree-vect-stmts.c
> +++ b/gcc/tree-vect-stmts.c
> @@ -1742,7 +1742,8 @@ vectorizable_mask_load_store (gimple *stmt, 
> gimple_stmt_iterator *gsi,
>    if (!mask_vectype)
>      mask_vectype = get_mask_type_for_scalar_type (TREE_TYPE (vectype));
>
> -  if (!mask_vectype || !VECTOR_BOOLEAN_TYPE_P (mask_vectype))
> +  if (!mask_vectype || !VECTOR_BOOLEAN_TYPE_P (mask_vectype)
> +      || TYPE_VECTOR_SUBPARTS (mask_vectype) != TYPE_VECTOR_SUBPARTS 
> (vectype))
>      return false;
>
>    if (is_store)

Reply via email to