From 59b5118623ad2e755fbb16b03f2ea122bceebdd2 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Wed, 30 Aug 2017 11:17:29 +0000 Subject: [51/77] Use opt_scalar_int_mode when iterating over integer modes This patch uses opt_scalar_int_mode rather than machine_mode when iterating over scalar_int_modes, in cases where that helps with future patches. (Using machine_mode is still OK in places that don't really care about the mode being a scalar integer.) 2017-08-30 Richard Sandiford Alan Hayward David Sherwood gcc/ * cse.c (cse_insn): Use opt_scalar_int_mode for the mode iterator. * explow.c (hard_function_value): Likewise. * expmed.c (extract_fixed_bit_field_1): Likewise. Move the convert_to_mode call outside the loop. * expr.c (alignment_for_piecewise_move): Use opt_scalar_int_mode for the mode iterator. Require the mode specified by max_pieces to exist. (emit_block_move_via_movmem): Use opt_scalar_int_mode for the mode iterator. (copy_blkmode_to_reg): Likewise. (set_storage_via_setmem): Likewise. * optabs.c (prepare_cmp_insn): Likewise. * rtlanal.c (init_num_sign_bit_copies_in_rep): Likewise. * stor-layout.c (finish_bitfield_representative): Likewise. gcc/fortran/ * trans-types.c (gfc_init_kinds): Use opt_scalar_int_mode for the mode iterator. Co-Authored-By: Alan Hayward Co-Authored-By: David Sherwood From-SVN: r251503 --- gcc/expmed.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'gcc/expmed.c') diff --git a/gcc/expmed.c b/gcc/expmed.c index dabde4e..0422ba2 100644 --- a/gcc/expmed.c +++ b/gcc/expmed.c @@ -2076,12 +2076,13 @@ extract_fixed_bit_field_1 (machine_mode tmode, rtx op0, /* Find the narrowest integer mode that contains the field. */ - FOR_EACH_MODE_IN_CLASS (mode, MODE_INT) - if (GET_MODE_BITSIZE (mode) >= bitsize + bitnum) - { - op0 = convert_to_mode (mode, op0, 0); - break; - } + opt_scalar_int_mode mode_iter; + FOR_EACH_MODE_IN_CLASS (mode_iter, MODE_INT) + if (GET_MODE_BITSIZE (mode_iter.require ()) >= bitsize + bitnum) + break; + + mode = mode_iter.require (); + op0 = convert_to_mode (mode, op0, 0); if (mode != tmode) target = 0; -- cgit v1.1