diff options
author | Richard Sandiford <richard.sandiford@linaro.org> | 2017-08-30 11:10:28 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2017-08-30 11:10:28 +0000 |
commit | fffbab82e7fd15ef695159746a0ce7b9ac906778 (patch) | |
tree | 1029fb2ff65fd47b432f0cdae4a809c11325b13b /gcc/expmed.c | |
parent | bf862c537bfd76233e3938cb3811f0fa2d27de25 (diff) | |
download | gcc-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/expmed.c')
-rw-r--r-- | gcc/expmed.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/gcc/expmed.c b/gcc/expmed.c index 48a0060..4c39096 100644 --- a/gcc/expmed.c +++ b/gcc/expmed.c @@ -364,7 +364,7 @@ check_reverse_float_storage_order_support (void) rtx flip_storage_order (machine_mode mode, rtx x) { - machine_mode int_mode; + scalar_int_mode int_mode; rtx result; if (mode == QImode) @@ -384,16 +384,13 @@ flip_storage_order (machine_mode mode, rtx x) if (__builtin_expect (reverse_storage_order_supported < 0, 0)) check_reverse_storage_order_support (); - if (SCALAR_INT_MODE_P (mode)) - int_mode = mode; - else + if (!is_a <scalar_int_mode> (mode, &int_mode)) { if (FLOAT_MODE_P (mode) && __builtin_expect (reverse_float_storage_order_supported < 0, 0)) check_reverse_float_storage_order_support (); - int_mode = mode_for_size (GET_MODE_PRECISION (mode), MODE_INT, 0); - if (int_mode == BLKmode) + if (!int_mode_for_size (GET_MODE_PRECISION (mode), 0).exists (&int_mode)) { sorry ("reverse storage order for %smode", GET_MODE_NAME (mode)); return x; @@ -1429,11 +1426,10 @@ convert_extracted_bit_field (rtx x, machine_mode mode, value via a SUBREG. */ if (!SCALAR_INT_MODE_P (tmode)) { - machine_mode smode; - - smode = mode_for_size (GET_MODE_BITSIZE (tmode), MODE_INT, 0); - x = convert_to_mode (smode, x, unsignedp); - x = force_reg (smode, x); + scalar_int_mode int_mode + = int_mode_for_size (GET_MODE_BITSIZE (tmode), 0).require (); + x = convert_to_mode (int_mode, x, unsignedp); + x = force_reg (int_mode, x); return gen_lowpart (tmode, x); } |