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: [06/13] Check whether a vector of QIs can store all indices


On Sun, Dec 10, 2017 at 12:18 AM, Richard Sandiford
<richard.sandiford@linaro.org> wrote:
> The patch to remove the vec_perm_const optab checked whether replacing
> a constant permute with a variable permute is safe, or whether it might
> truncate the indices.  This patch adds a corresponding check for whether
> variable permutes can be lowered to QImode-based permutes.

Ok.

>
> 2017-12-09  Richard Sandiford  <richard.sandiford@linaro.org>
>
> gcc/
>         * optabs-query.c (can_vec_perm_var_p): Check whether lowering
>         to qimode could truncate the indices.
>         * optabs.c (expand_vec_perm_var): Likewise.
>
> Index: gcc/optabs-query.c
> ===================================================================
> --- gcc/optabs-query.c  2017-12-09 22:47:21.534314227 +0000
> +++ gcc/optabs-query.c  2017-12-09 22:47:25.861316866 +0000
> @@ -378,7 +378,8 @@ can_vec_perm_var_p (machine_mode mode)
>
>    /* We allow fallback to a QI vector mode, and adjust the mask.  */
>    machine_mode qimode;
> -  if (!qimode_for_vec_perm (mode).exists (&qimode))
> +  if (!qimode_for_vec_perm (mode).exists (&qimode)
> +      || GET_MODE_NUNITS (qimode) > GET_MODE_MASK (QImode) + 1)
>      return false;
>
>    if (direct_optab_handler (vec_perm_optab, qimode) == CODE_FOR_nothing)
> Index: gcc/optabs.c
> ===================================================================
> --- gcc/optabs.c        2017-12-09 22:47:23.878315657 +0000
> +++ gcc/optabs.c        2017-12-09 22:47:25.861316866 +0000
> @@ -5595,7 +5595,8 @@ expand_vec_perm_var (machine_mode mode,
>    /* As a special case to aid several targets, lower the element-based
>       permutation to a byte-based permutation and try again.  */
>    machine_mode qimode;
> -  if (!qimode_for_vec_perm (mode).exists (&qimode))
> +  if (!qimode_for_vec_perm (mode).exists (&qimode)
> +      || GET_MODE_NUNITS (qimode) > GET_MODE_MASK (QImode) + 1)
>      return NULL_RTX;
>    icode = direct_optab_handler (vec_perm_optab, qimode);
>    if (icode == CODE_FOR_nothing)


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