diff options
author | amodra <amodra@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-07-08 03:02:27 +0000 |
---|---|---|
committer | amodra <amodra@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-07-08 03:02:27 +0000 |
commit | 5ae4887dccf204e60ec92f302c92a6d3dce73c2c (patch) | |
tree | 53f49dedf673ef5042d1e6f2ea443c7106b2c8ce /gcc/config/c6x/c6x.c | |
parent | 9ef16211c2c2d8888c3242b454edcca167246aef (diff) | |
download | gcc-5ae4887dccf204e60ec92f302c92a6d3dce73c2c.tar.gz |
* target.def (rtx_costs): Remove "code" param, add "mode".
* rtl.h (rtx_cost, get_full_rtx_cost): Update prototype.
(set_src_cost, get_full_set_src_cost): Likewise. Move later in file.
(set_rtx_cost, get_full_set_rtx_cost): Move later in file.
* rtlanal.c (rtx_cost): Add "mode" parameter. Update targetm.rtx_costs
call. Track mode when given in rtx.
(get_full_rtx_cost): Add "mode" parameter. Update rtx_cost calls.
(default_address_cost): Pass Pmode to rtx_cost.
(insn_rtx_cost): Pass dest mode of set to set_src_cost.
* cprop.c (try_replace_reg): Ensure set_rtx_cost is not called
with NULL set.
* cse.c (COST, COST_IN): Add MODE param. Update all uses.
(notreg_cost): Add mode param. Use it.
* gcse.c (want_to_gcse_p): Delete forward declaration. Add
mode param and pass to set_src_cost. Update all calls.
(hash_scan_set): Formatting.
* hooks.c (hook_bool_rtx_int_int_int_intp_bool_false): Delete.
(hook_bool_rtx_mode_int_int_intp_bool_false): New function.
* hooks.h: Ditto.
* expmed.c (init_expmed_one_conv, init_expmed_one_mode,
init_expmed, expand_mult, mult_by_coeff_cost, expand_smod_pow2,
emit_store_flag): Update set_src_cost and rtx_cost calls.
* auto-inc-dec.c (attempt_change): Likewise.
* calls.c (precompute_register_parameters): Likewise.
* combine.c (expand_compound_operation, make_extraction,
force_to_mode, distribute_and_simplify_rtx): Likewise.
* dojump.c (prefer_and_bit_test): Likewise.
* dse.c (find_shift_sequence): Likewise.
* expr.c (compress_float_constant): Likewise.
* fwprop.c (should_replace_address, try_fwprop_subst): Likewise.
* ifcvt.c (noce_try_sign_mask): Likewise.
* loop-doloop.c (doloop_optimize): Likewise.
* loop-invariant.c (create_new_invariant): Likewise.
* lower-subreg.c (shift_cost, compute_costs): Likewise.
* optabs.c (avoid_expensive_constant, prepare_cmp_insn,
lshift_cheap_p): Likewise.
* postreload.c (reload_cse_simplify_set, reload_cse_simplify_operands,
try_replace_in_use, reload_cse_move2add): Likewise.
* reload1.c (calculate_elim_costs_all_insns, note_reg_elim_costly):
Likewise.
* simplify-rtx.c (simplify_binary_operation_1): Likewise.
* tree-ssa-loop-ivopts.c (computation_cost): Likewise.
* tree-ssa-reassoc.c (optimize_range_tests_to_bit_test): Likewise.
* tree-switch-conversion.c (emit_case_bit_tests): Likewise.
* config/aarch64/aarch64.c (aarch64_rtx_costs): Delete "code" param,
add "mode" param. Use "mode: in place of GET_MODE (x). Pass mode
to rtx_cost calls.
* config/alpha/alpha.c (alpha_rtx_costs): Likewise.
* config/arc/arc.c (arc_rtx_costs): Likewise.
* config/arm/arm.c (arm_rtx_costs): Likewise.
* config/avr/avr.c (avr_rtx_costs, avr_rtx_costs_1): Likewise.
* config/bfin/bfin.c (bfin_rtx_costs): Likewise.
* config/c6x/c6x.c (c6x_rtx_costs): Likewise.
* config/cris/cris.c (cris_rtx_costs): Likewise.
* config/epiphany/epiphany.c (epiphany_rtx_costs): Likewise.
* config/frv/frv.c (frv_rtx_costs): Likewise.
* config/h8300/h8300.c (h8300_rtx_costs): Likewise.
* config/i386/i386.c (ix86_rtx_costs): Likewise.
* config/ia64/ia64.c (ia64_rtx_costs): Likewise.
* config/iq2000/iq2000.c (iq2000_rtx_costs): Likewise.
* config/lm32/lm32.c (lm32_rtx_costs): Likewise.
* config/m32c/m32c.c (m32c_rtx_costs): Likewise.
* config/m32r/m32r.c (m32r_rtx_costs): Likewise.
* config/m68k/m68k.c (m68k_rtx_costs): Likewise.
* config/mcore/mcore.c (mcore_rtx_costs): Likewise.
* config/mep/mep.c (mep_rtx_cost): Likewise.
* config/microblaze/microblaze.c (microblaze_rtx_costs): Likewise.
* config/mips/mips.c (mips_rtx_costs): Likewise.
* config/mmix/mmix.c (mmix_rtx_costs): Likewise.
* config/mn10300/mn10300.c (mn10300_rtx_costs): Likewise.
* config/msp430/msp430.c (msp430_rtx_costs): Likewise.
* config/nds32/nds32-cost.c (nds32_rtx_costs_impl): Likewise.
* config/nds32/nds32-protos.h (nds32_rtx_costs_impl): Likewise.
* config/nds32/nds32.c (nds32_rtx_costs): Likewise.
* config/nios2/nios2.c (nios2_rtx_costs): Likewise.
* config/pa/pa.c (hppa_rtx_costs): Likewise.
* config/pdp11/pdp11.c (pdp11_rtx_costs): Likewise.
* config/rl78/rl78.c (rl78_rtx_costs): Likewise.
* config/rs6000/rs6000.c (rs6000_rtx_costs): Likewise.
* config/s390/s390.c (s390_rtx_costs): Likewise.
* config/sh/sh.c (sh_rtx_costs): Likewise.
* config/sparc/sparc.c (sparc_rtx_costs): Likewise.
* config/spu/spu.c (spu_rtx_costs): Likewise.
* config/stormy16/stormy16.c (xstormy16_rtx_costs): Likewise.
* config/tilegx/tilegx.c (tilegx_rtx_costs): Likewise.
* config/tilepro/tilepro.c (tilepro_rtx_costs): Likewise.
* config/v850/v850.c (v850_rtx_costs): Likewise.
* config/vax/vax.c (vax_rtx_costs): Likewise.
* config/visium/visium.c (visium_rtx_costs): Likewise.
* config/xtensa/xtensa.c (xtensa_rtx_costs): Likewise.
* config/aarch64/aarch64.c (aarch64_rtx_mult_cost): Change type of
"code" param, and pass as outer_code to first rtx_cost call. Pass
mode to rtx_cost calls.
(aarch64_address_cost, aarch64_if_then_else_costs): Update rtx_cost
calls.
(aarch64_rtx_costs_wrapper): Update.
* config/arm/arm.c (arm_rtx_costs_1, arm_size_rtx_costs,
arm_unspec_cost, arm_new_rtx_costs, arm_slowmul_rtx_costs): Update
rtx_cost calls.
* config/avr/avr.c (avr_final_prescan_insn): Update set_src_cost
and rtx_cost calls.
(avr_operand_rtx_cost): Similarly.
(avr_rtx_costs_1): Correct mode passed to avr_operand_rtx_cost
for subexpressions of ZERO_EXTEND, SIGN_EXTEND and COMPARE.
* config/mips/mips.c (mips_stack_address_p): Comment typo.
(mips_binary_cost): Update rtx_cost and set_src_cost calls.
(mips_rtx_costs): Use GET_MODE (x) to detect const_int.
* config/mn10300/mn10300.c (mn10300_address_cost): Pass Pmode to
rtx_cost.
(mn10300_rtx_costs): Correct mode passed to mn10300_address_cost.
* config/rs6000/rs6000.c (rs6000_debug_rtx_costs): Update.
* config/sh/sh.c (and_xor_ior_costs): Update rtx_cost call.
* doc/tm.texi: Regenerate.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@225532 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/c6x/c6x.c')
-rw-r--r-- | gcc/config/c6x/c6x.c | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/gcc/config/c6x/c6x.c b/gcc/config/c6x/c6x.c index de49d8b33b9..936161c3d16 100644 --- a/gcc/config/c6x/c6x.c +++ b/gcc/config/c6x/c6x.c @@ -6045,11 +6045,12 @@ shift_p (rtx x, enum rtx_code code, int amount) scanned. In either case, *TOTAL contains the cost result. */ static bool -c6x_rtx_costs (rtx x, int code, int outer_code, int opno, int *total, +c6x_rtx_costs (rtx x, machine_mode mode, int outer_code, int opno, int *total, bool speed) { int cost2 = COSTS_N_INSNS (1); rtx op0, op1; + int code = GET_CODE (x); switch (code) { @@ -6078,12 +6079,12 @@ c6x_rtx_costs (rtx x, int code, int outer_code, int opno, int *total, case TRUNCATE: /* Recognize a mult_highpart operation. */ - if ((GET_MODE (x) == HImode || GET_MODE (x) == SImode) + if ((mode == HImode || mode == SImode) && GET_CODE (XEXP (x, 0)) == LSHIFTRT - && GET_MODE (XEXP (x, 0)) == GET_MODE_2XWIDER_MODE (GET_MODE (x)) + && GET_MODE (XEXP (x, 0)) == GET_MODE_2XWIDER_MODE (mode) && GET_CODE (XEXP (XEXP (x, 0), 0)) == MULT && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT - && INTVAL (XEXP (XEXP (x, 0), 1)) == GET_MODE_BITSIZE (GET_MODE (x))) + && INTVAL (XEXP (XEXP (x, 0), 1)) == GET_MODE_BITSIZE (mode)) { rtx mul = XEXP (XEXP (x, 0), 0); rtx op0 = XEXP (mul, 0); @@ -6093,15 +6094,16 @@ c6x_rtx_costs (rtx x, int code, int outer_code, int opno, int *total, if ((code0 == code1 && (code0 == SIGN_EXTEND || code0 == ZERO_EXTEND)) - || (GET_MODE (x) == HImode + || (mode == HImode && code0 == ZERO_EXTEND && code1 == SIGN_EXTEND)) { - if (GET_MODE (x) == HImode) + if (mode == HImode) *total = COSTS_N_INSNS (2); else *total = COSTS_N_INSNS (12); - *total += rtx_cost (XEXP (op0, 0), code0, 0, speed); - *total += rtx_cost (XEXP (op1, 0), code1, 0, speed); + mode = GET_MODE (XEXP (op0, 0)); + *total += rtx_cost (XEXP (op0, 0), mode, code0, 0, speed); + *total += rtx_cost (XEXP (op1, 0), mode, code1, 0, speed); return true; } } @@ -6110,7 +6112,7 @@ c6x_rtx_costs (rtx x, int code, int outer_code, int opno, int *total, case ASHIFT: case ASHIFTRT: case LSHIFTRT: - if (GET_MODE (x) == DImode) + if (mode == DImode) *total = COSTS_N_INSNS (CONSTANT_P (XEXP (x, 1)) ? 4 : 15); else *total = COSTS_N_INSNS (1); @@ -6121,16 +6123,16 @@ c6x_rtx_costs (rtx x, int code, int outer_code, int opno, int *total, *total = COSTS_N_INSNS (1); op0 = code == PLUS ? XEXP (x, 0) : XEXP (x, 1); op1 = code == PLUS ? XEXP (x, 1) : XEXP (x, 0); - if (GET_MODE_SIZE (GET_MODE (x)) <= UNITS_PER_WORD - && INTEGRAL_MODE_P (GET_MODE (x)) + if (GET_MODE_SIZE (mode) <= UNITS_PER_WORD + && INTEGRAL_MODE_P (mode) && GET_CODE (op0) == MULT && GET_CODE (XEXP (op0, 1)) == CONST_INT && (INTVAL (XEXP (op0, 1)) == 2 || INTVAL (XEXP (op0, 1)) == 4 || (code == PLUS && INTVAL (XEXP (op0, 1)) == 8))) { - *total += rtx_cost (XEXP (op0, 0), ASHIFT, 0, speed); - *total += rtx_cost (op1, (enum rtx_code) code, 1, speed); + *total += rtx_cost (XEXP (op0, 0), mode, ASHIFT, 0, speed); + *total += rtx_cost (op1, mode, (enum rtx_code) code, 1, speed); return true; } return false; @@ -6138,21 +6140,21 @@ c6x_rtx_costs (rtx x, int code, int outer_code, int opno, int *total, case MULT: op0 = XEXP (x, 0); op1 = XEXP (x, 1); - if (GET_MODE (x) == DFmode) + if (mode == DFmode) { if (TARGET_FP) *total = COSTS_N_INSNS (speed ? 10 : 1); else *total = COSTS_N_INSNS (speed ? 200 : 4); } - else if (GET_MODE (x) == SFmode) + else if (mode == SFmode) { if (TARGET_FP) *total = COSTS_N_INSNS (speed ? 4 : 1); else *total = COSTS_N_INSNS (speed ? 100 : 4); } - else if (GET_MODE (x) == DImode) + else if (mode == DImode) { if (TARGET_MPY32 && GET_CODE (op0) == GET_CODE (op1) @@ -6167,7 +6169,7 @@ c6x_rtx_costs (rtx x, int code, int outer_code, int opno, int *total, /* Maybe improve this laster. */ *total = COSTS_N_INSNS (20); } - else if (GET_MODE (x) == SImode) + else if (mode == SImode) { if (((GET_CODE (op0) == ZERO_EXTEND || GET_CODE (op0) == SIGN_EXTEND @@ -6195,15 +6197,15 @@ c6x_rtx_costs (rtx x, int code, int outer_code, int opno, int *total, else *total = COSTS_N_INSNS (6); } - else if (GET_MODE (x) == HImode) + else if (mode == HImode) *total = COSTS_N_INSNS (speed ? 2 : 1); if (GET_CODE (op0) != REG && (GET_CODE (op0) != SUBREG || GET_CODE (SUBREG_REG (op0)) != REG)) - *total += rtx_cost (op0, MULT, 0, speed); + *total += rtx_cost (op0, mode, MULT, 0, speed); if (op1 && GET_CODE (op1) != REG && (GET_CODE (op1) != SUBREG || GET_CODE (SUBREG_REG (op1)) != REG)) - *total += rtx_cost (op1, MULT, 1, speed); + *total += rtx_cost (op1, mode, MULT, 1, speed); return true; case UDIV: @@ -6221,7 +6223,7 @@ c6x_rtx_costs (rtx x, int code, int outer_code, int opno, int *total, && XEXP (op0, 1) == const0_rtx && rtx_equal_p (XEXP (x, 1), XEXP (op0, 0))) { - *total = rtx_cost (XEXP (x, 1), (enum rtx_code) outer_code, + *total = rtx_cost (XEXP (x, 1), VOIDmode, (enum rtx_code) outer_code, opno, speed); return false; } |