aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/aarch64/aarch64.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2015-07-08 12:32:27 +0930
committerAlan Modra <amodra@gcc.gnu.org>2015-07-08 12:32:27 +0930
commite548c9df071ecdb6f333601191a9396f2c17d1a7 (patch)
tree53f49dedf673ef5042d1e6f2ea443c7106b2c8ce /gcc/config/aarch64/aarch64.c
parentc7131fb2b58ab692af97125b7432393ffb426d53 (diff)
downloadgcc-e548c9df071ecdb6f333601191a9396f2c17d1a7.zip
gcc-e548c9df071ecdb6f333601191a9396f2c17d1a7.tar.gz
gcc-e548c9df071ecdb6f333601191a9396f2c17d1a7.tar.bz2
target.def (rtx_costs): Remove "code" param, add "mode".
* 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. From-SVN: r225532
Diffstat (limited to 'gcc/config/aarch64/aarch64.c')
-rw-r--r--gcc/config/aarch64/aarch64.c158
1 files changed, 79 insertions, 79 deletions
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index f7a9f3e..cb00ad3 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -5326,7 +5326,7 @@ aarch64_shift_p (enum rtx_code code)
operands where needed. */
static int
-aarch64_rtx_mult_cost (rtx x, int code, int outer, bool speed)
+aarch64_rtx_mult_cost (rtx x, enum rtx_code code, int outer, bool speed)
{
rtx op0, op1;
const struct cpu_cost_table *extra_cost
@@ -5377,7 +5377,7 @@ aarch64_rtx_mult_cost (rtx x, int code, int outer, bool speed)
if (is_extend)
op0 = aarch64_strip_extend (op0);
- cost += rtx_cost (op0, GET_CODE (op0), 0, speed);
+ cost += rtx_cost (op0, VOIDmode, code, 0, speed);
return cost;
}
@@ -5397,8 +5397,8 @@ aarch64_rtx_mult_cost (rtx x, int code, int outer, bool speed)
|| (GET_CODE (op0) == SIGN_EXTEND
&& GET_CODE (op1) == SIGN_EXTEND))
{
- cost += rtx_cost (XEXP (op0, 0), MULT, 0, speed)
- + rtx_cost (XEXP (op1, 0), MULT, 1, speed);
+ cost += rtx_cost (XEXP (op0, 0), VOIDmode, MULT, 0, speed);
+ cost += rtx_cost (XEXP (op1, 0), VOIDmode, MULT, 1, speed);
if (speed)
{
@@ -5415,8 +5415,8 @@ aarch64_rtx_mult_cost (rtx x, int code, int outer, bool speed)
/* This is either an integer multiply or a MADD. In both cases
we want to recurse and cost the operands. */
- cost += rtx_cost (op0, MULT, 0, speed)
- + rtx_cost (op1, MULT, 1, speed);
+ cost += rtx_cost (op0, mode, MULT, 0, speed);
+ cost += rtx_cost (op1, mode, MULT, 1, speed);
if (speed)
{
@@ -5449,8 +5449,8 @@ aarch64_rtx_mult_cost (rtx x, int code, int outer, bool speed)
cost += extra_cost->fp[mode == DFmode].mult;
}
- cost += rtx_cost (op0, MULT, 0, speed)
- + rtx_cost (op1, MULT, 1, speed);
+ cost += rtx_cost (op0, mode, MULT, 0, speed);
+ cost += rtx_cost (op1, mode, MULT, 1, speed);
return cost;
}
}
@@ -5474,7 +5474,7 @@ aarch64_address_cost (rtx x,
/* This is a CONST or SYMBOL ref which will be split
in a different way depending on the code model in use.
Cost it through the generic infrastructure. */
- int cost_symbol_ref = rtx_cost (x, MEM, 1, speed);
+ int cost_symbol_ref = rtx_cost (x, Pmode, MEM, 1, speed);
/* Divide through by the cost of one instruction to
bring it to the same units as the address costs. */
cost_symbol_ref /= COSTS_N_INSNS (1);
@@ -5697,11 +5697,11 @@ aarch64_if_then_else_costs (rtx op0, rtx op1, rtx op2, int *cost, bool speed)
/* TBZ/TBNZ/CBZ/CBNZ. */
if (GET_CODE (inner) == ZERO_EXTRACT)
/* TBZ/TBNZ. */
- *cost += rtx_cost (XEXP (inner, 0), ZERO_EXTRACT,
- 0, speed);
- else
- /* CBZ/CBNZ. */
- *cost += rtx_cost (inner, cmpcode, 0, speed);
+ *cost += rtx_cost (XEXP (inner, 0), VOIDmode,
+ ZERO_EXTRACT, 0, speed);
+ else
+ /* CBZ/CBNZ. */
+ *cost += rtx_cost (inner, VOIDmode, cmpcode, 0, speed);
return true;
}
@@ -5725,8 +5725,8 @@ aarch64_if_then_else_costs (rtx op0, rtx op1, rtx op2, int *cost, bool speed)
|| (GET_CODE (op1) == PLUS && XEXP (op1, 1) == const1_rtx))
op1 = XEXP (op1, 0);
- *cost += rtx_cost (op1, IF_THEN_ELSE, 1, speed);
- *cost += rtx_cost (op2, IF_THEN_ELSE, 2, speed);
+ *cost += rtx_cost (op1, VOIDmode, IF_THEN_ELSE, 1, speed);
+ *cost += rtx_cost (op2, VOIDmode, IF_THEN_ELSE, 2, speed);
return true;
}
@@ -5737,13 +5737,13 @@ aarch64_if_then_else_costs (rtx op0, rtx op1, rtx op2, int *cost, bool speed)
/* Calculate the cost of calculating X, storing it in *COST. Result
is true if the total cost of the operation has now been calculated. */
static bool
-aarch64_rtx_costs (rtx x, int code, int outer ATTRIBUTE_UNUSED,
+aarch64_rtx_costs (rtx x, machine_mode mode, int outer ATTRIBUTE_UNUSED,
int param ATTRIBUTE_UNUSED, int *cost, bool speed)
{
rtx op0, op1, op2;
const struct cpu_cost_table *extra_cost
= aarch64_tune_params.insn_extra_cost;
- machine_mode mode = GET_MODE (x);
+ int code = GET_CODE (x);
/* By default, assume that everything has equivalent cost to the
cheapest instruction. Any additional costs are applied as a delta
@@ -5778,12 +5778,12 @@ aarch64_rtx_costs (rtx x, int code, int outer ATTRIBUTE_UNUSED,
0, speed));
}
- *cost += rtx_cost (op1, SET, 1, speed);
+ *cost += rtx_cost (op1, mode, SET, 1, speed);
return true;
case SUBREG:
if (! REG_P (SUBREG_REG (op0)))
- *cost += rtx_cost (SUBREG_REG (op0), SET, 0, speed);
+ *cost += rtx_cost (SUBREG_REG (op0), VOIDmode, SET, 0, speed);
/* Fall through. */
case REG:
@@ -5805,7 +5805,7 @@ aarch64_rtx_costs (rtx x, int code, int outer ATTRIBUTE_UNUSED,
}
else
/* Cost is just the cost of the RHS of the set. */
- *cost += rtx_cost (op1, SET, 1, speed);
+ *cost += rtx_cost (op1, mode, SET, 1, speed);
return true;
case ZERO_EXTRACT:
@@ -5831,7 +5831,7 @@ aarch64_rtx_costs (rtx x, int code, int outer ATTRIBUTE_UNUSED,
/* BFM. */
if (speed)
*cost += extra_cost->alu.bfi;
- *cost += rtx_cost (op1, (enum rtx_code) code, 1, speed);
+ *cost += rtx_cost (op1, VOIDmode, (enum rtx_code) code, 1, speed);
}
return true;
@@ -5929,23 +5929,23 @@ aarch64_rtx_costs (rtx x, int code, int outer ATTRIBUTE_UNUSED,
return false;
}
- if (GET_MODE_CLASS (GET_MODE (x)) == MODE_INT)
- {
+ if (GET_MODE_CLASS (mode) == MODE_INT)
+ {
if (GET_RTX_CLASS (GET_CODE (op0)) == RTX_COMPARE
|| GET_RTX_CLASS (GET_CODE (op0)) == RTX_COMM_COMPARE)
{
/* CSETM. */
- *cost += rtx_cost (XEXP (op0, 0), NEG, 0, speed);
+ *cost += rtx_cost (XEXP (op0, 0), VOIDmode, NEG, 0, speed);
return true;
}
/* Cost this as SUB wzr, X. */
- op0 = CONST0_RTX (GET_MODE (x));
+ op0 = CONST0_RTX (mode);
op1 = XEXP (x, 0);
goto cost_minus;
}
- if (GET_MODE_CLASS (GET_MODE (x)) == MODE_FLOAT)
+ if (GET_MODE_CLASS (mode) == MODE_FLOAT)
{
/* Support (neg(fma...)) as a single instruction only if
sign of zeros is unimportant. This matches the decision
@@ -5953,7 +5953,7 @@ aarch64_rtx_costs (rtx x, int code, int outer ATTRIBUTE_UNUSED,
if (GET_CODE (op0) == FMA && !HONOR_SIGNED_ZEROS (GET_MODE (op0)))
{
/* FNMADD. */
- *cost = rtx_cost (op0, NEG, 0, speed);
+ *cost = rtx_cost (op0, mode, NEG, 0, speed);
return true;
}
if (speed)
@@ -5984,6 +5984,7 @@ aarch64_rtx_costs (rtx x, int code, int outer ATTRIBUTE_UNUSED,
&& GET_CODE (op0) == AND)
{
x = op0;
+ mode = GET_MODE (op0);
goto cost_logic;
}
@@ -5993,9 +5994,10 @@ aarch64_rtx_costs (rtx x, int code, int outer ATTRIBUTE_UNUSED,
needs encoding in the cost tables. */
/* CC_ZESWPmode supports zero extend for free. */
- if (GET_MODE (x) == CC_ZESWPmode && GET_CODE (op0) == ZERO_EXTEND)
+ if (mode == CC_ZESWPmode && GET_CODE (op0) == ZERO_EXTEND)
op0 = XEXP (op0, 0);
+ mode = GET_MODE (op0);
/* ANDS. */
if (GET_CODE (op0) == AND)
{
@@ -6023,8 +6025,8 @@ aarch64_rtx_costs (rtx x, int code, int outer ATTRIBUTE_UNUSED,
if (speed)
*cost += extra_cost->alu.arith;
- *cost += rtx_cost (op0, COMPARE, 0, speed);
- *cost += rtx_cost (XEXP (op1, 0), NEG, 1, speed);
+ *cost += rtx_cost (op0, mode, COMPARE, 0, speed);
+ *cost += rtx_cost (XEXP (op1, 0), mode, NEG, 1, speed);
return true;
}
@@ -6051,7 +6053,7 @@ aarch64_rtx_costs (rtx x, int code, int outer ATTRIBUTE_UNUSED,
if (CONST_DOUBLE_P (op1) && aarch64_float_const_zero_rtx_p (op1))
{
- *cost += rtx_cost (op0, COMPARE, 0, speed);
+ *cost += rtx_cost (op0, VOIDmode, COMPARE, 0, speed);
/* FCMP supports constant 0.0 for no extra cost. */
return true;
}
@@ -6080,7 +6082,7 @@ aarch64_rtx_costs (rtx x, int code, int outer ATTRIBUTE_UNUSED,
op1 = XEXP (x, 1);
cost_minus:
- *cost += rtx_cost (op0, MINUS, 0, speed);
+ *cost += rtx_cost (op0, mode, MINUS, 0, speed);
/* Detect valid immediates. */
if ((GET_MODE_CLASS (mode) == MODE_INT
@@ -6101,9 +6103,8 @@ cost_minus:
if (speed)
*cost += extra_cost->alu.extend_arith;
- *cost += rtx_cost (XEXP (XEXP (op1, 0), 0),
- (enum rtx_code) GET_CODE (op1),
- 0, speed);
+ *cost += rtx_cost (XEXP (XEXP (op1, 0), 0), VOIDmode,
+ (enum rtx_code) GET_CODE (op1), 0, speed);
return true;
}
@@ -6120,7 +6121,7 @@ cost_minus:
return true;
}
- *cost += rtx_cost (new_op1, MINUS, 1, speed);
+ *cost += rtx_cost (new_op1, VOIDmode, MINUS, 1, speed);
if (speed)
{
@@ -6155,8 +6156,8 @@ cost_plus:
|| GET_RTX_CLASS (GET_CODE (op0)) == RTX_COMM_COMPARE)
{
/* CSINC. */
- *cost += rtx_cost (XEXP (op0, 0), PLUS, 0, speed);
- *cost += rtx_cost (op1, PLUS, 1, speed);
+ *cost += rtx_cost (XEXP (op0, 0), mode, PLUS, 0, speed);
+ *cost += rtx_cost (op1, mode, PLUS, 1, speed);
return true;
}
@@ -6164,7 +6165,7 @@ cost_plus:
&& CONST_INT_P (op1)
&& aarch64_uimm12_shift (INTVAL (op1)))
{
- *cost += rtx_cost (op0, PLUS, 0, speed);
+ *cost += rtx_cost (op0, mode, PLUS, 0, speed);
if (speed)
/* ADD (immediate). */
@@ -6172,7 +6173,7 @@ cost_plus:
return true;
}
- *cost += rtx_cost (op1, PLUS, 1, speed);
+ *cost += rtx_cost (op1, mode, PLUS, 1, speed);
/* Look for ADD (extended register). */
if (aarch64_rtx_arith_op_extract_p (op0, mode))
@@ -6180,9 +6181,8 @@ cost_plus:
if (speed)
*cost += extra_cost->alu.extend_arith;
- *cost += rtx_cost (XEXP (XEXP (op0, 0), 0),
- (enum rtx_code) GET_CODE (op0),
- 0, speed);
+ *cost += rtx_cost (XEXP (XEXP (op0, 0), 0), VOIDmode,
+ (enum rtx_code) GET_CODE (op0), 0, speed);
return true;
}
@@ -6198,7 +6198,7 @@ cost_plus:
return true;
}
- *cost += rtx_cost (new_op0, PLUS, 0, speed);
+ *cost += rtx_cost (new_op0, VOIDmode, PLUS, 0, speed);
if (speed)
{
@@ -6250,8 +6250,8 @@ cost_plus:
if (aarch64_extr_rtx_p (x, &op0, &op1))
{
- *cost += rtx_cost (op0, IOR, 0, speed)
- + rtx_cost (op1, IOR, 1, speed);
+ *cost += rtx_cost (op0, mode, IOR, 0, speed);
+ *cost += rtx_cost (op1, mode, IOR, 1, speed);
if (speed)
*cost += extra_cost->alu.shift;
@@ -6279,20 +6279,20 @@ cost_plus:
INTVAL (op1)) != 0)
{
/* This is a UBFM/SBFM. */
- *cost += rtx_cost (XEXP (op0, 0), ZERO_EXTRACT, 0, speed);
+ *cost += rtx_cost (XEXP (op0, 0), mode, ZERO_EXTRACT, 0, speed);
if (speed)
*cost += extra_cost->alu.bfx;
return true;
}
- if (GET_MODE_CLASS (GET_MODE (x)) == MODE_INT)
+ if (GET_MODE_CLASS (mode) == MODE_INT)
{
/* We possibly get the immediate for free, this is not
modelled. */
if (CONST_INT_P (op1)
- && aarch64_bitmask_imm (INTVAL (op1), GET_MODE (x)))
+ && aarch64_bitmask_imm (INTVAL (op1), mode))
{
- *cost += rtx_cost (op0, (enum rtx_code) code, 0, speed);
+ *cost += rtx_cost (op0, mode, (enum rtx_code) code, 0, speed);
if (speed)
*cost += extra_cost->alu.logical;
@@ -6327,8 +6327,8 @@ cost_plus:
}
/* In both cases we want to cost both operands. */
- *cost += rtx_cost (new_op0, (enum rtx_code) code, 0, speed)
- + rtx_cost (op1, (enum rtx_code) code, 1, speed);
+ *cost += rtx_cost (new_op0, mode, (enum rtx_code) code, 0, speed);
+ *cost += rtx_cost (op1, mode, (enum rtx_code) code, 1, speed);
return true;
}
@@ -6349,7 +6349,7 @@ cost_plus:
/* MVN-shifted-reg. */
if (op0 != x)
{
- *cost += rtx_cost (op0, (enum rtx_code) code, 0, speed);
+ *cost += rtx_cost (op0, mode, (enum rtx_code) code, 0, speed);
if (speed)
*cost += extra_cost->alu.log_shift;
@@ -6365,8 +6365,8 @@ cost_plus:
rtx newop1 = XEXP (op0, 1);
rtx op0_stripped = aarch64_strip_shift (newop0);
- *cost += rtx_cost (newop1, (enum rtx_code) code, 1, speed)
- + rtx_cost (op0_stripped, XOR, 0, speed);
+ *cost += rtx_cost (newop1, mode, (enum rtx_code) code, 1, speed);
+ *cost += rtx_cost (op0_stripped, mode, XOR, 0, speed);
if (speed)
{
@@ -6399,7 +6399,7 @@ cost_plus:
&& GET_MODE (op0) == SImode
&& outer == SET)
{
- int op_cost = rtx_cost (XEXP (x, 0), ZERO_EXTEND, 0, speed);
+ int op_cost = rtx_cost (op0, VOIDmode, ZERO_EXTEND, 0, speed);
if (!op_cost && speed)
/* MOV. */
@@ -6410,10 +6410,10 @@ cost_plus:
return true;
}
- else if (MEM_P (XEXP (x, 0)))
+ else if (MEM_P (op0))
{
/* All loads can zero extend to any size for free. */
- *cost = rtx_cost (XEXP (x, 0), ZERO_EXTEND, param, speed);
+ *cost = rtx_cost (op0, VOIDmode, ZERO_EXTEND, param, speed);
return true;
}
@@ -6483,7 +6483,7 @@ cost_plus:
|| GET_CODE (op0) == SIGN_EXTEND)
op0 = XEXP (op0, 0);
- *cost += rtx_cost (op0, ASHIFT, 0, speed);
+ *cost += rtx_cost (op0, VOIDmode, ASHIFT, 0, speed);
return true;
}
else
@@ -6522,7 +6522,7 @@ cost_plus:
*cost += extra_cost->alu.shift;
}
- *cost += rtx_cost (op0, (enum rtx_code) code, 0, speed);
+ *cost += rtx_cost (op0, mode, (enum rtx_code) code, 0, speed);
return true;
}
else
@@ -6593,7 +6593,7 @@ cost_plus:
/* We can trust that the immediates used will be correct (there
are no by-register forms), so we need only cost op0. */
- *cost += rtx_cost (XEXP (x, 0), (enum rtx_code) code, 0, speed);
+ *cost += rtx_cost (XEXP (x, 0), VOIDmode, (enum rtx_code) code, 0, speed);
return true;
case MULT:
@@ -6608,13 +6608,13 @@ cost_plus:
{
if (VECTOR_MODE_P (mode))
*cost += extra_cost->vect.alu;
- else if (GET_MODE_CLASS (GET_MODE (x)) == MODE_INT)
- *cost += (extra_cost->mult[GET_MODE (x) == DImode].add
- + extra_cost->mult[GET_MODE (x) == DImode].idiv);
- else if (GET_MODE (x) == DFmode)
+ else if (GET_MODE_CLASS (mode) == MODE_INT)
+ *cost += (extra_cost->mult[mode == DImode].add
+ + extra_cost->mult[mode == DImode].idiv);
+ else if (mode == DFmode)
*cost += (extra_cost->fp[1].mult
+ extra_cost->fp[1].div);
- else if (GET_MODE (x) == SFmode)
+ else if (mode == SFmode)
*cost += (extra_cost->fp[0].mult
+ extra_cost->fp[0].div);
}
@@ -6697,9 +6697,9 @@ cost_plus:
/* If the remaining parameters are not registers,
get the cost to put them into registers. */
- *cost += rtx_cost (op0, FMA, 0, speed);
- *cost += rtx_cost (op1, FMA, 1, speed);
- *cost += rtx_cost (op2, FMA, 2, speed);
+ *cost += rtx_cost (op0, mode, FMA, 0, speed);
+ *cost += rtx_cost (op1, mode, FMA, 1, speed);
+ *cost += rtx_cost (op2, mode, FMA, 2, speed);
return true;
case FLOAT:
@@ -6758,7 +6758,7 @@ cost_plus:
else
*cost += extra_cost->fp[GET_MODE (x) == DFmode].toint;
}
- *cost += rtx_cost (x, (enum rtx_code) code, 0, speed);
+ *cost += rtx_cost (x, VOIDmode, (enum rtx_code) code, 0, speed);
return true;
case ABS:
@@ -6775,8 +6775,8 @@ cost_plus:
/* FABD, which is analogous to FADD. */
if (GET_CODE (op0) == MINUS)
{
- *cost += rtx_cost (XEXP (op0, 0), MINUS, 0, speed);
- + rtx_cost (XEXP (op0, 1), MINUS, 1, speed);
+ *cost += rtx_cost (XEXP (op0, 0), mode, MINUS, 0, speed);
+ *cost += rtx_cost (XEXP (op0, 1), mode, MINUS, 1, speed);
if (speed)
*cost += extra_cost->fp[mode == DFmode].addsub;
@@ -6857,10 +6857,10 @@ cost_plus:
/* UMULH/SMULH. */
if (speed)
*cost += extra_cost->mult[mode == DImode].extend;
- *cost += rtx_cost (XEXP (XEXP (XEXP (XEXP (x, 0), 0), 0), 0),
- MULT, 0, speed);
- *cost += rtx_cost (XEXP (XEXP (XEXP (XEXP (x, 0), 0), 1), 0),
- MULT, 1, speed);
+ *cost += rtx_cost (XEXP (XEXP (XEXP (XEXP (x, 0), 0), 0), 0),
+ mode, MULT, 0, speed);
+ *cost += rtx_cost (XEXP (XEXP (XEXP (XEXP (x, 0), 0), 1), 0),
+ mode, MULT, 1, speed);
return true;
}
@@ -6880,10 +6880,10 @@ cost_plus:
calculated for X. This cost is stored in *COST. Returns true
if the total cost of X was calculated. */
static bool
-aarch64_rtx_costs_wrapper (rtx x, int code, int outer,
+aarch64_rtx_costs_wrapper (rtx x, machine_mode mode, int outer,
int param, int *cost, bool speed)
{
- bool result = aarch64_rtx_costs (x, code, outer, param, cost, speed);
+ bool result = aarch64_rtx_costs (x, mode, outer, param, cost, speed);
if (dump_file && (dump_flags & TDF_DETAILS))
{