This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Additional check for mask type in masked load/store vectorization
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Ilya Enkovich <enkovich dot gnu at gmail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 10 Mar 2016 11:50:58 +0100
- Subject: Re: [PATCH] Additional check for mask type in masked load/store vectorization
- Authentication-results: sourceware.org; auth=none
- References: <20160310101255 dot GB3131 at msticlxl57 dot ims dot intel dot com>
On Thu, Mar 10, 2016 at 11:12 AM, Ilya Enkovich <enkovich.gnu@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.gnu@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)