aboutsummaryrefslogtreecommitdiff
path: root/gcc/optabs-query.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@linaro.org>2018-01-02 18:26:35 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2018-01-02 18:26:35 +0000
commit6da64f1b329f57c07f22ec034bc7bc4b0dc9e87b (patch)
tree0a0b3fe9156bf5b9fca9cd0f7f6423bc94766db1 /gcc/optabs-query.c
parentf151c9e1414c00e300c9385bc9512c3d9a481296 (diff)
downloadgcc-6da64f1b329f57c07f22ec034bc7bc4b0dc9e87b.zip
gcc-6da64f1b329f57c07f22ec034bc7bc4b0dc9e87b.tar.gz
gcc-6da64f1b329f57c07f22ec034bc7bc4b0dc9e87b.tar.bz2
Check whether a vector of QIs can store all indices
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
Diffstat (limited to 'gcc/optabs-query.c')
-rw-r--r--gcc/optabs-query.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/optabs-query.c b/gcc/optabs-query.c
index 4060b4f..7396664 100644
--- a/gcc/optabs-query.c
+++ b/gcc/optabs-query.c
@@ -390,7 +390,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)