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.
2018-01-02 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.
From-SVN: r256094
+2018-01-02 Richard Sandiford <richard.sandiford@linaro.org>
+
+ * optabs-query.c (can_vec_perm_var_p): Check whether lowering
+ to qimode could truncate the indices.
+ * optabs.c (expand_vec_perm_var): Likewise.
+
2018-01-02 Richard Sandiford <richard.sandiford@linaro.org>
* Makefile.in (OBJS): Add vec-perm-indices.o.
/* 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)
/* 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)