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/simplify-rtx.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/simplify-rtx.c')
-rw-r--r-- | gcc/simplify-rtx.c | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index 2255ccf..3c81cb8 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -926,7 +926,7 @@ simplify_unary_operation_1 (enum rtx_code code, machine_mode mode, rtx op) { enum rtx_code reversed; rtx temp; - scalar_int_mode inner, int_mode, op0_mode; + scalar_int_mode inner, int_mode, op_mode, op0_mode; switch (code) { @@ -1162,26 +1162,27 @@ simplify_unary_operation_1 (enum rtx_code code, machine_mode mode, rtx op) && XEXP (op, 1) == const0_rtx && is_a <scalar_int_mode> (GET_MODE (XEXP (op, 0)), &inner)) { + int_mode = as_a <scalar_int_mode> (mode); int isize = GET_MODE_PRECISION (inner); if (STORE_FLAG_VALUE == 1) { temp = simplify_gen_binary (ASHIFTRT, inner, XEXP (op, 0), GEN_INT (isize - 1)); - if (mode == inner) + if (int_mode == inner) return temp; - if (GET_MODE_PRECISION (mode) > isize) - return simplify_gen_unary (SIGN_EXTEND, mode, temp, inner); - return simplify_gen_unary (TRUNCATE, mode, temp, inner); + if (GET_MODE_PRECISION (int_mode) > isize) + return simplify_gen_unary (SIGN_EXTEND, int_mode, temp, inner); + return simplify_gen_unary (TRUNCATE, int_mode, temp, inner); } else if (STORE_FLAG_VALUE == -1) { temp = simplify_gen_binary (LSHIFTRT, inner, XEXP (op, 0), GEN_INT (isize - 1)); - if (mode == inner) + if (int_mode == inner) return temp; - if (GET_MODE_PRECISION (mode) > isize) - return simplify_gen_unary (ZERO_EXTEND, mode, temp, inner); - return simplify_gen_unary (TRUNCATE, mode, temp, inner); + if (GET_MODE_PRECISION (int_mode) > isize) + return simplify_gen_unary (ZERO_EXTEND, int_mode, temp, inner); + return simplify_gen_unary (TRUNCATE, int_mode, temp, inner); } } break; @@ -1501,12 +1502,13 @@ simplify_unary_operation_1 (enum rtx_code code, machine_mode mode, rtx op) && is_a <scalar_int_mode> (mode, &int_mode) && CONST_INT_P (XEXP (op, 1)) && XEXP (XEXP (op, 0), 1) == XEXP (op, 1) - && GET_MODE_BITSIZE (GET_MODE (op)) > INTVAL (XEXP (op, 1))) + && (op_mode = as_a <scalar_int_mode> (GET_MODE (op)), + GET_MODE_BITSIZE (op_mode) > INTVAL (XEXP (op, 1)))) { scalar_int_mode tmode; gcc_assert (GET_MODE_BITSIZE (int_mode) - > GET_MODE_BITSIZE (GET_MODE (op))); - if (int_mode_for_size (GET_MODE_BITSIZE (GET_MODE (op)) + > GET_MODE_BITSIZE (op_mode)); + if (int_mode_for_size (GET_MODE_BITSIZE (op_mode) - INTVAL (XEXP (op, 1)), 1).exists (&tmode)) { rtx inner = @@ -1618,10 +1620,11 @@ simplify_unary_operation_1 (enum rtx_code code, machine_mode mode, rtx op) && is_a <scalar_int_mode> (mode, &int_mode) && CONST_INT_P (XEXP (op, 1)) && XEXP (XEXP (op, 0), 1) == XEXP (op, 1) - && GET_MODE_PRECISION (GET_MODE (op)) > INTVAL (XEXP (op, 1))) + && (op_mode = as_a <scalar_int_mode> (GET_MODE (op)), + GET_MODE_PRECISION (op_mode) > INTVAL (XEXP (op, 1)))) { scalar_int_mode tmode; - if (int_mode_for_size (GET_MODE_PRECISION (GET_MODE (op)) + if (int_mode_for_size (GET_MODE_PRECISION (op_mode) - INTVAL (XEXP (op, 1)), 1).exists (&tmode)) { rtx inner = @@ -5395,10 +5398,10 @@ simplify_cond_clz_ctz (rtx x, rtx_code cmp_code, rtx true_val, rtx false_val) return NULL_RTX; HOST_WIDE_INT op_val; - if (((op_code == CLZ - && CLZ_DEFINED_VALUE_AT_ZERO (GET_MODE (on_nonzero), op_val)) - || (op_code == CTZ - && CTZ_DEFINED_VALUE_AT_ZERO (GET_MODE (on_nonzero), op_val))) + scalar_int_mode mode ATTRIBUTE_UNUSED + = as_a <scalar_int_mode> (GET_MODE (XEXP (on_nonzero, 0))); + if (((op_code == CLZ && CLZ_DEFINED_VALUE_AT_ZERO (mode, op_val)) + || (op_code == CTZ && CTZ_DEFINED_VALUE_AT_ZERO (mode, op_val))) && op_val == INTVAL (on_zero)) return on_nonzero; |