diff options
author | Richard Sandiford <rsandifo@gcc.gnu.org> | 2017-08-30 11:13:29 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2017-08-30 11:13:29 +0000 |
commit | c7ad039d8d75666f4f188a913033da36206503b8 (patch) | |
tree | 39a850b1263916714cd0fc62162dc9adaf993d73 /gcc/cse.c | |
parent | 7a504f3390ecfe3457d37b9d716262a14d5d1938 (diff) | |
download | gcc-c7ad039d8d75666f4f188a913033da36206503b8.zip gcc-c7ad039d8d75666f4f188a913033da36206503b8.tar.gz gcc-c7ad039d8d75666f4f188a913033da36206503b8.tar.bz2 |
[35/77] Add uses of as_a <scalar_int_mode>
This patch adds asserting as_a <scalar_int_mode> conversions
to contexts in which the input is known to be a scalar integer mode.
In expand_divmod, op1 is always a scalar_int_mode if
op1_is_constant (but might not be otherwise).
In expand_binop, the patch reverses a < comparison in order to
avoid splitting a long line.
gcc/
2017-08-30 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
* cfgexpand.c (convert_debug_memory_address): Use
as_a <scalar_int_mode>.
* combine.c (expand_compound_operation): Likewise.
(make_extraction): Likewise.
(change_zero_ext): Likewise.
(simplify_comparison): Likewise.
* cse.c (cse_insn): Likewise.
* dwarf2out.c (minmax_loc_descriptor): Likewise.
(mem_loc_descriptor): Likewise.
(loc_descriptor): Likewise.
* expmed.c (init_expmed_one_mode): Likewise.
(synth_mult): Likewise.
(emit_store_flag_1): Likewise.
(expand_divmod): Likewise. Use HWI_COMPUTABLE_MODE_P instead
of a comparison with size.
* expr.c (expand_assignment): Use as_a <scalar_int_mode>.
(reduce_to_bit_field_precision): Likewise.
* function.c (expand_function_end): Likewise.
* internal-fn.c (expand_arith_overflow_result_store): Likewise.
* loop-doloop.c (doloop_modify): Likewise.
* optabs.c (expand_binop): Likewise.
(expand_unop): Likewise.
(expand_copysign_absneg): Likewise.
(prepare_cmp_insn): Likewise.
(maybe_legitimize_operand): Likewise.
* recog.c (const_scalar_int_operand): Likewise.
* rtlanal.c (get_address_mode): Likewise.
* simplify-rtx.c (simplify_unary_operation_1): Likewise.
(simplify_cond_clz_ctz): Likewise.
* tree-nested.c (get_nl_goto_field): Likewise.
* tree.c (build_vector_type_for_mode): Likewise.
* var-tracking.c (use_narrower_mode): Likewise.
gcc/c-family/
2017-08-30 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
* c-common.c (c_common_type_for_mode): Use as_a <scalar_int_mode>.
gcc/lto/
2017-08-30 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
* lto-lang.c (lto_type_for_mode): Use as_a <scalar_int_mode>.
From-SVN: r251487
Diffstat (limited to 'gcc/cse.c')
-rw-r--r-- | gcc/cse.c | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -4552,14 +4552,17 @@ cse_insn (rtx_insn *insn) && CONST_INT_P (XEXP (SET_DEST (sets[0].rtl), 2))) { rtx dest_reg = XEXP (SET_DEST (sets[0].rtl), 0); + /* This is the mode of XEXP (tem, 0) as well. */ + scalar_int_mode dest_mode + = as_a <scalar_int_mode> (GET_MODE (dest_reg)); rtx width = XEXP (SET_DEST (sets[0].rtl), 1); rtx pos = XEXP (SET_DEST (sets[0].rtl), 2); HOST_WIDE_INT val = INTVAL (XEXP (tem, 0)); HOST_WIDE_INT mask; unsigned int shift; if (BITS_BIG_ENDIAN) - shift = GET_MODE_PRECISION (GET_MODE (dest_reg)) - - INTVAL (pos) - INTVAL (width); + shift = (GET_MODE_PRECISION (dest_mode) + - INTVAL (pos) - INTVAL (width)); else shift = INTVAL (pos); if (INTVAL (width) == HOST_BITS_PER_WIDE_INT) @@ -5231,8 +5234,11 @@ cse_insn (rtx_insn *insn) HOST_WIDE_INT val = INTVAL (dest_cst); HOST_WIDE_INT mask; unsigned int shift; + /* This is the mode of DEST_CST as well. */ + scalar_int_mode dest_mode + = as_a <scalar_int_mode> (GET_MODE (dest_reg)); if (BITS_BIG_ENDIAN) - shift = GET_MODE_PRECISION (GET_MODE (dest_reg)) + shift = GET_MODE_PRECISION (dest_mode) - INTVAL (pos) - INTVAL (width); else shift = INTVAL (pos); @@ -5242,7 +5248,7 @@ cse_insn (rtx_insn *insn) mask = (HOST_WIDE_INT_1 << INTVAL (width)) - 1; val &= ~(mask << shift); val |= (INTVAL (trial) & mask) << shift; - val = trunc_int_for_mode (val, GET_MODE (dest_reg)); + val = trunc_int_for_mode (val, dest_mode); validate_unshare_change (insn, &SET_DEST (sets[i].rtl), dest_reg, 1); validate_unshare_change (insn, &SET_SRC (sets[i].rtl), |