aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@linaro.org>2017-08-30 11:10:44 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2017-08-30 11:10:44 +0000
commitf67f4dfffe08b1cea5de407e35e03dd38b64fcd3 (patch)
treea08f3d32bc93a70f1da4b61931edf7ce88da32b3 /gcc/expr.c
parent304b9962830476dce3fe7632713e5f5ce002c050 (diff)
downloadgcc-f67f4dfffe08b1cea5de407e35e03dd38b64fcd3.zip
gcc-f67f4dfffe08b1cea5de407e35e03dd38b64fcd3.tar.gz
gcc-f67f4dfffe08b1cea5de407e35e03dd38b64fcd3.tar.bz2
[19/77] Add a smallest_int_mode_for_size helper function
This patch adds a wrapper around smallest_mode_for_size for cases in which the mode class is MODE_INT. Unlike (int_)mode_for_size, smallest_mode_for_size always returns a mode of the specified class, asserting if no such mode exists. smallest_int_mode_for_size therefore returns a scalar_int_mode rather than an opt_scalar_int_mode. 2017-08-30 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> gcc/ * machmode.h (smallest_mode_for_size): Fix formatting. (smallest_int_mode_for_size): New function. * cfgexpand.c (expand_debug_expr): Use smallest_int_mode_for_size instead of smallest_mode_for_size. * combine.c (make_extraction): Likewise. * config/arc/arc.c (arc_expand_movmem): Likewise. * config/arm/arm.c (arm_expand_divmod_libfunc): Likewise. * config/i386/i386.c (ix86_get_mask_mode): Likewise. * config/s390/s390.c (s390_expand_insv): Likewise. * config/sparc/sparc.c (assign_int_registers): Likewise. * config/spu/spu.c (spu_function_value): Likewise. (spu_function_arg): Likewise. * coverage.c (get_gcov_type): Likewise. (get_gcov_unsigned_t): Likewise. * dse.c (find_shift_sequence): Likewise. * expmed.c (store_bit_field_1): Likewise. * expr.c (convert_move): Likewise. (store_field): Likewise. * internal-fn.c (expand_arith_overflow): Likewise. * optabs-query.c (get_best_extraction_insn): Likewise. * optabs.c (expand_twoval_binop_libfunc): Likewise. * stor-layout.c (layout_type): Likewise. (initialize_sizetypes): Likewise. * targhooks.c (default_get_mask_mode): Likewise. * tree-ssa-loop-manip.c (canonicalize_loop_ivs): Likewise. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r251471
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index b9a0b06..776c719 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -346,8 +346,8 @@ convert_move (rtx to, rtx from, int unsignedp)
xImode for all MODE_PARTIAL_INT modes they use, but no others. */
if (GET_MODE_CLASS (to_mode) == MODE_PARTIAL_INT)
{
- machine_mode full_mode
- = smallest_mode_for_size (GET_MODE_BITSIZE (to_mode), MODE_INT);
+ scalar_int_mode full_mode
+ = smallest_int_mode_for_size (GET_MODE_BITSIZE (to_mode));
gcc_assert (convert_optab_handler (trunc_optab, to_mode, full_mode)
!= CODE_FOR_nothing);
@@ -361,8 +361,8 @@ convert_move (rtx to, rtx from, int unsignedp)
if (GET_MODE_CLASS (from_mode) == MODE_PARTIAL_INT)
{
rtx new_from;
- machine_mode full_mode
- = smallest_mode_for_size (GET_MODE_BITSIZE (from_mode), MODE_INT);
+ scalar_int_mode full_mode
+ = smallest_int_mode_for_size (GET_MODE_BITSIZE (from_mode));
convert_optab ctab = unsignedp ? zext_optab : sext_optab;
enum insn_code icode;
@@ -6848,8 +6848,8 @@ store_field (rtx target, HOST_WIDE_INT bitsize, HOST_WIDE_INT bitpos,
if (GET_CODE (temp) == PARALLEL)
{
HOST_WIDE_INT size = int_size_in_bytes (TREE_TYPE (exp));
- machine_mode temp_mode
- = smallest_mode_for_size (size * BITS_PER_UNIT, MODE_INT);
+ scalar_int_mode temp_mode
+ = smallest_int_mode_for_size (size * BITS_PER_UNIT);
rtx temp_target = gen_reg_rtx (temp_mode);
emit_group_store (temp_target, temp, TREE_TYPE (exp), size);
temp = temp_target;
@@ -6920,7 +6920,7 @@ store_field (rtx target, HOST_WIDE_INT bitsize, HOST_WIDE_INT bitpos,
word size, we need to load the value (see again store_bit_field). */
if (GET_MODE (temp) == BLKmode && bitsize <= BITS_PER_WORD)
{
- machine_mode temp_mode = smallest_mode_for_size (bitsize, MODE_INT);
+ scalar_int_mode temp_mode = smallest_int_mode_for_size (bitsize);
temp = extract_bit_field (temp, bitsize, 0, 1, NULL_RTX, temp_mode,
temp_mode, false, NULL);
}