aboutsummaryrefslogtreecommitdiff
path: root/gcc/combine.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@linaro.org>2017-08-30 11:10:28 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2017-08-30 11:10:28 +0000
commitfffbab82e7fd15ef695159746a0ce7b9ac906778 (patch)
tree1029fb2ff65fd47b432f0cdae4a809c11325b13b /gcc/combine.c
parentbf862c537bfd76233e3938cb3811f0fa2d27de25 (diff)
downloadgcc-fffbab82e7fd15ef695159746a0ce7b9ac906778.zip
gcc-fffbab82e7fd15ef695159746a0ce7b9ac906778.tar.gz
gcc-fffbab82e7fd15ef695159746a0ce7b9ac906778.tar.bz2
[17/77] Add an int_mode_for_size helper function
This patch adds a wrapper around mode_for_size for cases in which the mode class is MODE_INT (the commonest case). The return type can then be an opt_scalar_int_mode instead of a machine_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 (int_mode_for_size): New function. * builtins.c (set_builtin_user_assembler_name): Use int_mode_for_size instead of mode_for_size. * calls.c (save_fixed_argument_area): Likewise. Make use of BLKmode explicit. * combine.c (expand_field_assignment): Use int_mode_for_size instead of mode_for_size. (make_extraction): Likewise. (simplify_shift_const_1): Likewise. (simplify_comparison): Likewise. * dojump.c (do_jump): Likewise. * dwarf2out.c (mem_loc_descriptor): Likewise. * emit-rtl.c (init_derived_machine_modes): Likewise. * expmed.c (flip_storage_order): Likewise. (convert_extracted_bit_field): Likewise. * expr.c (copy_blkmode_from_reg): Likewise. * graphite-isl-ast-to-gimple.c (max_mode_int_precision): Likewise. * internal-fn.c (expand_mul_overflow): Likewise. * lower-subreg.c (simple_move): Likewise. * optabs-libfuncs.c (init_optabs): Likewise. * simplify-rtx.c (simplify_unary_operation_1): Likewise. * tree.c (vector_type_mode): Likewise. * tree-ssa-strlen.c (handle_builtin_memcmp): Likewise. * tree-vect-data-refs.c (vect_lanes_optab_supported_p): Likewise. * tree-vect-generic.c (expand_vector_parallel): Likewise. * tree-vect-stmts.c (vectorizable_load): Likewise. (vectorizable_store): Likewise. gcc/ada/ * gcc-interface/decl.c (gnat_to_gnu_entity): Use int_mode_for_size instead of mode_for_size. (gnat_to_gnu_subprog_type): Likewise. * gcc-interface/utils.c (make_type_from_size): Likewise. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r251469
Diffstat (limited to 'gcc/combine.c')
-rw-r--r--gcc/combine.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/gcc/combine.c b/gcc/combine.c
index 1a6eda6..a717ca5 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -7306,19 +7306,16 @@ expand_field_assignment (const_rtx x)
/* Don't attempt bitwise arithmetic on non scalar integer modes. */
if (! SCALAR_INT_MODE_P (compute_mode))
{
- machine_mode imode;
-
/* Don't do anything for vector or complex integral types. */
if (! FLOAT_MODE_P (compute_mode))
break;
/* Try to find an integral mode to pun with. */
- imode = mode_for_size (GET_MODE_BITSIZE (compute_mode), MODE_INT, 0);
- if (imode == BLKmode)
+ if (!int_mode_for_size (GET_MODE_BITSIZE (compute_mode), 0)
+ .exists (&compute_mode))
break;
- compute_mode = imode;
- inner = gen_lowpart (imode, inner);
+ inner = gen_lowpart (compute_mode, inner);
}
/* Compute a mask of LEN bits, if we can do this on the host machine. */
@@ -7389,7 +7386,6 @@ make_extraction (machine_mode mode, rtx inner, HOST_WIDE_INT pos,
machine_mode wanted_inner_reg_mode = word_mode;
machine_mode pos_mode = word_mode;
machine_mode extraction_mode = word_mode;
- machine_mode tmode = mode_for_size (len, MODE_INT, 1);
rtx new_rtx = 0;
rtx orig_pos_rtx = pos_rtx;
HOST_WIDE_INT orig_pos;
@@ -7437,7 +7433,8 @@ make_extraction (machine_mode mode, rtx inner, HOST_WIDE_INT pos,
For MEM, we can avoid an extract if the field starts on an appropriate
boundary and we can change the mode of the memory reference. */
- if (tmode != BLKmode
+ scalar_int_mode tmode;
+ if (int_mode_for_size (len, 1).exists (&tmode)
&& ((pos_rtx == 0 && (pos % BITS_PER_WORD) == 0
&& !MEM_P (inner)
&& (pos == 0 || REG_P (inner))
@@ -10444,8 +10441,8 @@ simplify_shift_const_1 (enum rtx_code code, machine_mode result_mode,
&& ! mode_dependent_address_p (XEXP (varop, 0),
MEM_ADDR_SPACE (varop))
&& ! MEM_VOLATILE_P (varop)
- && (tmode = mode_for_size (GET_MODE_BITSIZE (mode) - count,
- MODE_INT, 1)) != BLKmode)
+ && (int_mode_for_size (GET_MODE_BITSIZE (mode) - count, 1)
+ .exists (&tmode)))
{
new_rtx = adjust_address_nv (varop, tmode,
BYTES_BIG_ENDIAN ? 0
@@ -12371,7 +12368,7 @@ simplify_comparison (enum rtx_code code, rtx *pop0, rtx *pop1)
& GET_MODE_MASK (mode))
+ 1)) >= 0
&& const_op >> i == 0
- && (tmode = mode_for_size (i, MODE_INT, 1)) != BLKmode)
+ && int_mode_for_size (i, 1).exists (&tmode))
{
op0 = gen_lowpart_or_truncate (tmode, XEXP (op0, 0));
continue;
@@ -12531,8 +12528,8 @@ simplify_comparison (enum rtx_code code, rtx *pop0, rtx *pop1)
&& CONST_INT_P (XEXP (op0, 1))
&& GET_CODE (XEXP (op0, 0)) == ASHIFT
&& XEXP (op0, 1) == XEXP (XEXP (op0, 0), 1)
- && (tmode = mode_for_size (mode_width - INTVAL (XEXP (op0, 1)),
- MODE_INT, 1)) != BLKmode
+ && (int_mode_for_size (mode_width - INTVAL (XEXP (op0, 1)), 1)
+ .exists (&tmode))
&& (((unsigned HOST_WIDE_INT) const_op
+ (GET_MODE_MASK (tmode) >> 1) + 1)
<= GET_MODE_MASK (tmode)))
@@ -12550,8 +12547,8 @@ simplify_comparison (enum rtx_code code, rtx *pop0, rtx *pop1)
&& CONST_INT_P (XEXP (XEXP (op0, 0), 1))
&& GET_CODE (XEXP (XEXP (op0, 0), 0)) == ASHIFT
&& XEXP (op0, 1) == XEXP (XEXP (XEXP (op0, 0), 0), 1)
- && (tmode = mode_for_size (mode_width - INTVAL (XEXP (op0, 1)),
- MODE_INT, 1)) != BLKmode
+ && (int_mode_for_size (mode_width - INTVAL (XEXP (op0, 1)), 1)
+ .exists (&tmode))
&& (((unsigned HOST_WIDE_INT) const_op
+ (GET_MODE_MASK (tmode) >> 1) + 1)
<= GET_MODE_MASK (tmode)))