aboutsummaryrefslogtreecommitdiff
path: root/gcc/optabs-query.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@linaro.org>2017-09-05 19:57:39 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2017-09-05 19:57:39 +0000
commit9da15d4097fa2fde5c2a5f1681db8fd04488a563 (patch)
tree4f9be4daf0cecba38b9ccc0040c50f9f84bf3f6e /gcc/optabs-query.c
parentddc203a7b15306287792a3eed6abfe306e3d26ad (diff)
downloadgcc-9da15d4097fa2fde5c2a5f1681db8fd04488a563.zip
gcc-9da15d4097fa2fde5c2a5f1681db8fd04488a563.tar.gz
gcc-9da15d4097fa2fde5c2a5f1681db8fd04488a563.tar.bz2
Make mode_for_vector return an opt_mode
...following on from the mode_for_size change. The patch also removes machmode.h versions of the stor-layout.c comments, since the comments in the .c file are more complete. 2017-09-05 Richard Sandiford <richard.sandiford@linaro.org> gcc/ * machmode.h (mode_for_vector): Return an opt_mode. * stor-layout.c (mode_for_vector): Likewise. (mode_for_int_vector): Update accordingly. (layout_type): Likewise. * config/i386/i386.c (emit_memmov): Likewise. (ix86_expand_set_or_movmem): Likewise. (ix86_expand_vector_init): Likewise. (ix86_get_mask_mode): Likewise. * config/powerpcspe/powerpcspe.c (rs6000_expand_vec_perm_const_1): Likewise. * config/rs6000/rs6000.c (rs6000_expand_vec_perm_const_1): Likewise. * expmed.c (extract_bit_field_1): Likewise. * expr.c (expand_expr_real_2): Likewise. * optabs-query.c (can_vec_perm_p): Likewise. (can_vec_mask_load_store_p): Likewise. * optabs.c (expand_vec_perm): Likewise. * targhooks.c (default_get_mask_mode): Likewise. * tree-vect-stmts.c (vectorizable_store): Likewise. (vectorizable_load): Likewise. (get_vectype_for_scalar_type_and_size): Likewise. From-SVN: r251730
Diffstat (limited to 'gcc/optabs-query.c')
-rw-r--r--gcc/optabs-query.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/gcc/optabs-query.c b/gcc/optabs-query.c
index f606073..9afdd1f 100644
--- a/gcc/optabs-query.c
+++ b/gcc/optabs-query.c
@@ -376,10 +376,9 @@ can_vec_perm_p (machine_mode mode, bool variable,
return true;
/* We allow fallback to a QI vector mode, and adjust the mask. */
- if (GET_MODE_INNER (mode) == QImode)
- return false;
- qimode = mode_for_vector (QImode, GET_MODE_SIZE (mode));
- if (!VECTOR_MODE_P (qimode))
+ if (GET_MODE_INNER (mode) == QImode
+ || !mode_for_vector (QImode, GET_MODE_SIZE (mode)).exists (&qimode)
+ || !VECTOR_MODE_P (qimode))
return false;
/* ??? For completeness, we ought to check the QImode version of
@@ -547,12 +546,14 @@ can_vec_mask_load_store_p (machine_mode mode,
vector_sizes &= ~cur;
if (cur <= GET_MODE_SIZE (smode))
continue;
- vmode = mode_for_vector (smode, cur / GET_MODE_SIZE (smode));
- mask_mode = targetm.vectorize.get_mask_mode (GET_MODE_NUNITS (vmode),
- cur);
- if (VECTOR_MODE_P (vmode)
- && convert_optab_handler (op, vmode, mask_mode) != CODE_FOR_nothing)
- return true;
+ unsigned int nunits = cur / GET_MODE_SIZE (smode);
+ if (mode_for_vector (smode, nunits).exists (&vmode)
+ && VECTOR_MODE_P (vmode))
+ {
+ mask_mode = targetm.vectorize.get_mask_mode (nunits, cur);
+ if (convert_optab_handler (op, vmode, mask_mode) != CODE_FOR_nothing)
+ return true;
+ }
}
return false;
}