aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/arm/arm.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/config/arm/arm.c')
-rw-r--r--gcc/config/arm/arm.c360
1 files changed, 194 insertions, 166 deletions
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index a7ce0c7..1862507 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -181,7 +181,7 @@ static bool arm_slowmul_rtx_costs (rtx, enum rtx_code, enum rtx_code, int *, boo
static bool arm_fastmul_rtx_costs (rtx, enum rtx_code, enum rtx_code, int *, bool);
static bool arm_xscale_rtx_costs (rtx, enum rtx_code, enum rtx_code, int *, bool);
static bool arm_9e_rtx_costs (rtx, enum rtx_code, enum rtx_code, int *, bool);
-static bool arm_rtx_costs (rtx, int, int, int, int *, bool);
+static bool arm_rtx_costs (rtx, machine_mode, int, int, int *, bool);
static int arm_address_cost (rtx, machine_mode, addr_space_t, bool);
static int arm_register_move_cost (machine_mode, reg_class_t, reg_class_t);
static int arm_memory_move_cost (machine_mode, reg_class_t, bool);
@@ -8318,7 +8318,7 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
if (REG_P (XEXP (x, 1)))
*total = COSTS_N_INSNS (1); /* Need to subtract from 32 */
else if (!CONST_INT_P (XEXP (x, 1)))
- *total = rtx_cost (XEXP (x, 1), code, 1, speed);
+ *total = rtx_cost (XEXP (x, 1), mode, code, 1, speed);
/* Fall through */
case ROTATERT:
@@ -8330,7 +8330,7 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
/* Fall through */
case ASHIFT: case LSHIFTRT: case ASHIFTRT:
- *total += rtx_cost (XEXP (x, 0), code, 0, speed);
+ *total += rtx_cost (XEXP (x, 0), mode, code, 0, speed);
if (mode == DImode)
{
*total += COSTS_N_INSNS (3);
@@ -8353,14 +8353,14 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
if (CONST_INT_P (XEXP (x, 0))
&& const_ok_for_arm (INTVAL (XEXP (x, 0))))
{
- *total += rtx_cost (XEXP (x, 1), code, 1, speed);
+ *total += rtx_cost (XEXP (x, 1), mode, code, 1, speed);
return true;
}
if (CONST_INT_P (XEXP (x, 1))
&& const_ok_for_arm (INTVAL (XEXP (x, 1))))
{
- *total += rtx_cost (XEXP (x, 0), code, 0, speed);
+ *total += rtx_cost (XEXP (x, 0), mode, code, 0, speed);
return true;
}
@@ -8377,14 +8377,14 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
if (CONST_DOUBLE_P (XEXP (x, 0))
&& arm_const_double_rtx (XEXP (x, 0)))
{
- *total += rtx_cost (XEXP (x, 1), code, 1, speed);
+ *total += rtx_cost (XEXP (x, 1), mode, code, 1, speed);
return true;
}
if (CONST_DOUBLE_P (XEXP (x, 1))
&& arm_const_double_rtx (XEXP (x, 1)))
{
- *total += rtx_cost (XEXP (x, 0), code, 0, speed);
+ *total += rtx_cost (XEXP (x, 0), mode, code, 0, speed);
return true;
}
@@ -8398,7 +8398,7 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
if (CONST_INT_P (XEXP (x, 0))
&& const_ok_for_arm (INTVAL (XEXP (x, 0))))
{
- *total += rtx_cost (XEXP (x, 1), code, 1, speed);
+ *total += rtx_cost (XEXP (x, 1), mode, code, 1, speed);
return true;
}
@@ -8407,8 +8407,8 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
|| subcode == LSHIFTRT
|| subcode == ROTATE || subcode == ROTATERT)
{
- *total += rtx_cost (XEXP (x, 0), code, 0, speed);
- *total += rtx_cost (XEXP (XEXP (x, 1), 0), subcode, 0, speed);
+ *total += rtx_cost (XEXP (x, 0), mode, code, 0, speed);
+ *total += rtx_cost (XEXP (XEXP (x, 1), 0), mode, subcode, 0, speed);
return true;
}
@@ -8416,23 +8416,24 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
if (GET_CODE (XEXP (x, 0)) == MULT
&& power_of_two_operand (XEXP (XEXP (x, 0), 1), SImode))
{
- *total += rtx_cost (XEXP (XEXP (x, 0), 0), code, 0, speed);
- *total += rtx_cost (XEXP (x, 1), code, 1, speed);
+ *total += rtx_cost (XEXP (XEXP (x, 0), 0), mode, code, 0, speed);
+ *total += rtx_cost (XEXP (x, 1), mode, code, 1, speed);
return true;
}
if (subcode == MULT
&& power_of_two_operand (XEXP (XEXP (x, 1), 1), SImode))
{
- *total += rtx_cost (XEXP (x, 0), code, 0, speed);
- *total += rtx_cost (XEXP (XEXP (x, 1), 0), subcode, 0, speed);
+ *total += rtx_cost (XEXP (x, 0), mode, code, 0, speed);
+ *total += rtx_cost (XEXP (XEXP (x, 1), 0), mode, subcode, 0, speed);
return true;
}
if (GET_RTX_CLASS (GET_CODE (XEXP (x, 1))) == RTX_COMPARE
|| GET_RTX_CLASS (GET_CODE (XEXP (x, 1))) == RTX_COMM_COMPARE)
{
- *total = COSTS_N_INSNS (1) + rtx_cost (XEXP (x, 0), code, 0, speed);
+ *total = COSTS_N_INSNS (1) + rtx_cost (XEXP (x, 0), mode, code,
+ 0, speed);
if (REG_P (XEXP (XEXP (x, 1), 0))
&& REGNO (XEXP (XEXP (x, 1), 0)) != CC_REGNUM)
*total += COSTS_N_INSNS (1);
@@ -8448,9 +8449,9 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
|| GET_CODE (XEXP (x, 0)) == SIGN_EXTEND))
{
*total = COSTS_N_INSNS (1);
- *total += rtx_cost (XEXP (XEXP (x, 0), 0), GET_CODE (XEXP (x, 0)),
- 0, speed);
- *total += rtx_cost (XEXP (x, 1), code, 1, speed);
+ *total += rtx_cost (XEXP (XEXP (x, 0), 0), VOIDmode,
+ GET_CODE (XEXP (x, 0)), 0, speed);
+ *total += rtx_cost (XEXP (x, 1), mode, code, 1, speed);
return true;
}
@@ -8474,7 +8475,7 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
if (CONST_DOUBLE_P (XEXP (x, 1))
&& arm_const_double_rtx (XEXP (x, 1)))
{
- *total += rtx_cost (XEXP (x, 0), code, 0, speed);
+ *total += rtx_cost (XEXP (x, 0), mode, code, 0, speed);
return true;
}
@@ -8488,7 +8489,8 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
if (GET_RTX_CLASS (GET_CODE (XEXP (x, 0))) == RTX_COMPARE
|| GET_RTX_CLASS (GET_CODE (XEXP (x, 0))) == RTX_COMM_COMPARE)
{
- *total = COSTS_N_INSNS (1) + rtx_cost (XEXP (x, 1), code, 1, speed);
+ *total = COSTS_N_INSNS (1) + rtx_cost (XEXP (x, 1), mode, code,
+ 1, speed);
if (REG_P (XEXP (XEXP (x, 0), 0))
&& REGNO (XEXP (XEXP (x, 0), 0)) != CC_REGNUM)
*total += COSTS_N_INSNS (1);
@@ -8515,7 +8517,7 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
if (CONST_INT_P (XEXP (x, 1))
&& const_ok_for_op (INTVAL (XEXP (x, 1)), code))
{
- *total += rtx_cost (XEXP (x, 0), code, 0, speed);
+ *total += rtx_cost (XEXP (x, 0), mode, code, 0, speed);
return true;
}
@@ -8526,7 +8528,7 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
if (CONST_INT_P (XEXP (x, 1))
&& const_ok_for_op (INTVAL (XEXP (x, 1)), code))
{
- *total += rtx_cost (XEXP (x, 0), code, 0, speed);
+ *total += rtx_cost (XEXP (x, 0), mode, code, 0, speed);
return true;
}
subcode = GET_CODE (XEXP (x, 0));
@@ -8534,16 +8536,16 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
|| subcode == LSHIFTRT
|| subcode == ROTATE || subcode == ROTATERT)
{
- *total += rtx_cost (XEXP (x, 1), code, 1, speed);
- *total += rtx_cost (XEXP (XEXP (x, 0), 0), subcode, 0, speed);
+ *total += rtx_cost (XEXP (x, 1), mode, code, 1, speed);
+ *total += rtx_cost (XEXP (XEXP (x, 0), 0), mode, subcode, 0, speed);
return true;
}
if (subcode == MULT
&& power_of_two_operand (XEXP (XEXP (x, 0), 1), SImode))
{
- *total += rtx_cost (XEXP (x, 1), code, 1, speed);
- *total += rtx_cost (XEXP (XEXP (x, 0), 0), subcode, 0, speed);
+ *total += rtx_cost (XEXP (x, 1), mode, code, 1, speed);
+ *total += rtx_cost (XEXP (XEXP (x, 0), 0), mode, subcode, 0, speed);
return true;
}
@@ -8569,7 +8571,8 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
&& (GET_CODE (XEXP (XEXP (XEXP (x, 0), 0), 0)) == ZERO_EXTEND
|| GET_CODE (XEXP (XEXP (XEXP (x, 0), 0), 0)) == SIGN_EXTEND))
{
- *total = rtx_cost (XEXP (XEXP (x, 0), 0), LSHIFTRT, 0, speed);
+ *total = rtx_cost (XEXP (XEXP (x, 0), 0), VOIDmode, LSHIFTRT,
+ 0, speed);
return true;
}
*total = COSTS_N_INSNS (2); /* Plus the cost of the MULT */
@@ -8601,11 +8604,13 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
|| (subcode == MULT
&& power_of_two_operand (XEXP (XEXP (x, 0), 1), SImode)))
{
- *total += rtx_cost (XEXP (XEXP (x, 0), 0), subcode, 0, speed);
+ *total += rtx_cost (XEXP (XEXP (x, 0), 0), mode, subcode,
+ 0, speed);
/* Register shifts cost an extra cycle. */
if (!CONST_INT_P (XEXP (XEXP (x, 0), 1)))
*total += COSTS_N_INSNS (1) + rtx_cost (XEXP (XEXP (x, 0), 1),
- subcode, 1, speed);
+ mode, subcode,
+ 1, speed);
return true;
}
}
@@ -8626,14 +8631,15 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
&& REG_P (XEXP (operand, 0))
&& REGNO (XEXP (operand, 0)) == CC_REGNUM))
*total += COSTS_N_INSNS (1);
- *total += (rtx_cost (XEXP (x, 1), code, 1, speed)
- + rtx_cost (XEXP (x, 2), code, 2, speed));
+ *total += rtx_cost (XEXP (x, 1), VOIDmode, code, 1, speed);
+ *total += rtx_cost (XEXP (x, 2), VOIDmode, code, 2, speed);
return true;
case NE:
if (mode == SImode && XEXP (x, 1) == const0_rtx)
{
- *total = COSTS_N_INSNS (2) + rtx_cost (XEXP (x, 0), code, 0, speed);
+ *total = COSTS_N_INSNS (2) + rtx_cost (XEXP (x, 0), mode, code,
+ 0, speed);
return true;
}
goto scc_insn;
@@ -8642,7 +8648,8 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
if ((!REG_P (XEXP (x, 0)) || REGNO (XEXP (x, 0)) != CC_REGNUM)
&& mode == SImode && XEXP (x, 1) == const0_rtx)
{
- *total = COSTS_N_INSNS (2) + rtx_cost (XEXP (x, 0), code, 0, speed);
+ *total = COSTS_N_INSNS (2) + rtx_cost (XEXP (x, 0), mode, code,
+ 0, speed);
return true;
}
goto scc_insn;
@@ -8651,7 +8658,8 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
if ((!REG_P (XEXP (x, 0)) || REGNO (XEXP (x, 0)) != CC_REGNUM)
&& mode == SImode && XEXP (x, 1) == const0_rtx)
{
- *total = COSTS_N_INSNS (1) + rtx_cost (XEXP (x, 0), code, 0, speed);
+ *total = COSTS_N_INSNS (1) + rtx_cost (XEXP (x, 0), mode, code,
+ 0, speed);
return true;
}
goto scc_insn;
@@ -8692,7 +8700,7 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
if (CONST_INT_P (XEXP (x, 1))
&& const_ok_for_op (INTVAL (XEXP (x, 1)), code))
{
- *total += rtx_cost (XEXP (x, 0), code, 0, speed);
+ *total += rtx_cost (XEXP (x, 0), VOIDmode, code, 0, speed);
return true;
}
@@ -8701,16 +8709,18 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
|| subcode == LSHIFTRT
|| subcode == ROTATE || subcode == ROTATERT)
{
- *total += rtx_cost (XEXP (x, 1), code, 1, speed);
- *total += rtx_cost (XEXP (XEXP (x, 0), 0), subcode, 0, speed);
+ mode = GET_MODE (XEXP (x, 0));
+ *total += rtx_cost (XEXP (x, 1), mode, code, 1, speed);
+ *total += rtx_cost (XEXP (XEXP (x, 0), 0), mode, subcode, 0, speed);
return true;
}
if (subcode == MULT
&& power_of_two_operand (XEXP (XEXP (x, 0), 1), SImode))
{
- *total += rtx_cost (XEXP (x, 1), code, 1, speed);
- *total += rtx_cost (XEXP (XEXP (x, 0), 0), subcode, 0, speed);
+ mode = GET_MODE (XEXP (x, 0));
+ *total += rtx_cost (XEXP (x, 1), mode, code, 1, speed);
+ *total += rtx_cost (XEXP (XEXP (x, 0), 0), mode, subcode, 0, speed);
return true;
}
@@ -8720,10 +8730,10 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
case UMAX:
case SMIN:
case SMAX:
- *total = COSTS_N_INSNS (2) + rtx_cost (XEXP (x, 0), code, 0, speed);
+ *total = COSTS_N_INSNS (2) + rtx_cost (XEXP (x, 0), mode, code, 0, speed);
if (!CONST_INT_P (XEXP (x, 1))
|| !const_ok_for_arm (INTVAL (XEXP (x, 1))))
- *total += rtx_cost (XEXP (x, 1), code, 1, speed);
+ *total += rtx_cost (XEXP (x, 1), mode, code, 1, speed);
return true;
case ABS:
@@ -8800,7 +8810,8 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
case ZERO_EXTRACT:
case SIGN_EXTRACT:
- *total = COSTS_N_INSNS (1) + rtx_cost (XEXP (x, 0), code, 0, speed);
+ mode = GET_MODE (XEXP (x, 0));
+ *total = COSTS_N_INSNS (1) + rtx_cost (XEXP (x, 0), mode, code, 0, speed);
return true;
case CONST_INT:
@@ -8825,7 +8836,7 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
case LO_SUM:
*total = COSTS_N_INSNS (1);
- *total += rtx_cost (XEXP (x, 0), code, 0, speed);
+ *total += rtx_cost (XEXP (x, 0), mode, code, 0, speed);
return true;
case CONST_DOUBLE:
@@ -8843,7 +8854,8 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
if (TARGET_NEON && MEM_P (SET_DEST (x))
&& GET_CODE (SET_SRC (x)) == VEC_SELECT)
{
- *total = rtx_cost (SET_DEST (x), code, 0, speed);
+ mode = GET_MODE (SET_DEST (x));
+ *total = rtx_cost (SET_DEST (x), mode, code, 0, speed);
if (!neon_vector_mem_operand (SET_DEST (x), 2, true))
*total += COSTS_N_INSNS (1);
return true;
@@ -8854,7 +8866,8 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
&& MEM_P (XEXP (XEXP (SET_SRC (x), 0), 0)))
{
rtx mem = XEXP (XEXP (SET_SRC (x), 0), 0);
- *total = rtx_cost (mem, code, 0, speed);
+ mode = GET_MODE (SET_DEST (x));
+ *total = rtx_cost (mem, mode, code, 0, speed);
if (!neon_vector_mem_operand (mem, 2, true))
*total += COSTS_N_INSNS (1);
return true;
@@ -9077,7 +9090,8 @@ arm_size_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
case ROTATE:
if (mode == SImode && REG_P (XEXP (x, 1)))
{
- *total = COSTS_N_INSNS (2) + rtx_cost (XEXP (x, 0), code, 0, false);
+ *total = COSTS_N_INSNS (2) + rtx_cost (XEXP (x, 0), mode, code,
+ 0, false);
return true;
}
/* Fall through */
@@ -9087,15 +9101,17 @@ arm_size_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
case ASHIFTRT:
if (mode == DImode && CONST_INT_P (XEXP (x, 1)))
{
- *total = COSTS_N_INSNS (3) + rtx_cost (XEXP (x, 0), code, 0, false);
+ *total = COSTS_N_INSNS (3) + rtx_cost (XEXP (x, 0), mode, code,
+ 0, false);
return true;
}
else if (mode == SImode)
{
- *total = COSTS_N_INSNS (1) + rtx_cost (XEXP (x, 0), code, 0, false);
+ *total = COSTS_N_INSNS (1) + rtx_cost (XEXP (x, 0), mode, code,
+ 0, false);
/* Slightly disparage register shifts, but not by much. */
if (!CONST_INT_P (XEXP (x, 1)))
- *total += 1 + rtx_cost (XEXP (x, 1), code, 1, false);
+ *total += 1 + rtx_cost (XEXP (x, 1), mode, code, 1, false);
return true;
}
@@ -9147,8 +9163,8 @@ arm_size_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
&& power_of_two_operand (XEXP (XEXP (x, 0), 1), SImode))
{
*total = COSTS_N_INSNS (TARGET_THUMB2 ? 2 : 1);
- *total += rtx_cost (XEXP (XEXP (x, 0), 0), code, 0, false);
- *total += rtx_cost (XEXP (x, 1), code, 1, false);
+ *total += rtx_cost (XEXP (XEXP (x, 0), 0), mode, code, 0, false);
+ *total += rtx_cost (XEXP (x, 1), mode, code, 1, false);
return true;
}
@@ -9326,7 +9342,7 @@ arm_unspec_cost (rtx x, enum rtx_code /* outer_code */, bool speed_p, int *cost)
*cost += (ARM_NUM_REGS (GET_MODE (x)) * extra_cost->ldst.store
+ extra_cost->ldst.store_unaligned);
- *cost += rtx_cost (XVECEXP (x, 0, 0), UNSPEC, 0, speed_p);
+ *cost += rtx_cost (XVECEXP (x, 0, 0), VOIDmode, UNSPEC, 0, speed_p);
#ifdef NOT_YET
*cost += arm_address_cost (XEXP (XVECEXP (x, 0, 0), 0), GET_MODE (x),
ADDR_SPACE_GENERIC, speed_p);
@@ -9365,15 +9381,18 @@ arm_unspec_cost (rtx x, enum rtx_code /* outer_code */, bool speed_p, int *cost)
if (shift_reg) \
{ \
if (speed_p) \
- *cost += extra_cost->alu.arith_shift_reg; \
- *cost += rtx_cost (shift_reg, ASHIFT, 1, speed_p); \
+ *cost += extra_cost->alu.arith_shift_reg; \
+ *cost += rtx_cost (shift_reg, GET_MODE (shift_reg), \
+ ASHIFT, 1, speed_p); \
} \
else if (speed_p) \
- *cost += extra_cost->alu.arith_shift; \
+ *cost += extra_cost->alu.arith_shift; \
\
- *cost += (rtx_cost (shift_op, ASHIFT, 0, speed_p) \
+ *cost += (rtx_cost (shift_op, GET_MODE (shift_op), \
+ ASHIFT, 0, speed_p) \
+ rtx_cost (XEXP (x, 1 - IDX), \
- OP, 1, speed_p)); \
+ GET_MODE (shift_op), \
+ OP, 1, speed_p)); \
return true; \
} \
} \
@@ -9437,7 +9456,8 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
{
/* Handle CONST_INT here, since the value doesn't have a mode
and we would otherwise be unable to work out the true cost. */
- *cost = rtx_cost (SET_DEST (x), SET, 0, speed_p);
+ *cost = rtx_cost (SET_DEST (x), GET_MODE (SET_DEST (x)), SET,
+ 0, speed_p);
outer_code = SET;
/* Slightly lower the cost of setting a core reg to a constant.
This helps break up chains and allows for better scheduling. */
@@ -9544,7 +9564,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
if (mode == SImode && REG_P (XEXP (x, 1)))
{
*cost = (COSTS_N_INSNS (2)
- + rtx_cost (XEXP (x, 0), code, 0, speed_p));
+ + rtx_cost (XEXP (x, 0), mode, code, 0, speed_p));
if (speed_p)
*cost += extra_cost->alu.shift_reg;
return true;
@@ -9557,7 +9577,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
if (mode == DImode && CONST_INT_P (XEXP (x, 1)))
{
*cost = (COSTS_N_INSNS (3)
- + rtx_cost (XEXP (x, 0), code, 0, speed_p));
+ + rtx_cost (XEXP (x, 0), mode, code, 0, speed_p));
if (speed_p)
*cost += 2 * extra_cost->alu.shift;
return true;
@@ -9565,11 +9585,11 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
else if (mode == SImode)
{
*cost = (COSTS_N_INSNS (1)
- + rtx_cost (XEXP (x, 0), code, 0, speed_p));
+ + rtx_cost (XEXP (x, 0), mode, code, 0, speed_p));
/* Slightly disparage register shifts at -Os, but not by much. */
if (!CONST_INT_P (XEXP (x, 1)))
*cost += (speed_p ? extra_cost->alu.shift_reg : 1
- + rtx_cost (XEXP (x, 1), code, 1, speed_p));
+ + rtx_cost (XEXP (x, 1), mode, code, 1, speed_p));
return true;
}
else if (GET_MODE_CLASS (mode) == MODE_INT
@@ -9578,12 +9598,12 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
if (code == ASHIFT)
{
*cost = (COSTS_N_INSNS (1)
- + rtx_cost (XEXP (x, 0), code, 0, speed_p));
+ + rtx_cost (XEXP (x, 0), mode, code, 0, speed_p));
/* Slightly disparage register shifts at -Os, but not by
much. */
if (!CONST_INT_P (XEXP (x, 1)))
*cost += (speed_p ? extra_cost->alu.shift_reg : 1
- + rtx_cost (XEXP (x, 1), code, 1, speed_p));
+ + rtx_cost (XEXP (x, 1), mode, code, 1, speed_p));
}
else if (code == LSHIFTRT || code == ASHIFTRT)
{
@@ -9593,12 +9613,12 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
*cost = COSTS_N_INSNS (1);
if (speed_p)
*cost += extra_cost->alu.bfx;
- *cost += rtx_cost (XEXP (x, 0), code, 0, speed_p);
+ *cost += rtx_cost (XEXP (x, 0), mode, code, 0, speed_p);
}
else
{
*cost = COSTS_N_INSNS (2);
- *cost += rtx_cost (XEXP (x, 0), code, 0, speed_p);
+ *cost += rtx_cost (XEXP (x, 0), mode, code, 0, speed_p);
if (speed_p)
{
if (CONST_INT_P (XEXP (x, 1)))
@@ -9615,7 +9635,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
else /* Rotates. */
{
*cost = COSTS_N_INSNS (3 + !CONST_INT_P (XEXP (x, 1)));
- *cost += rtx_cost (XEXP (x, 0), code, 0, speed_p);
+ *cost += rtx_cost (XEXP (x, 0), mode, code, 0, speed_p);
if (speed_p)
{
if (CONST_INT_P (XEXP (x, 1)))
@@ -9705,9 +9725,9 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
if (GET_CODE (mul_op0) == NEG)
mul_op0 = XEXP (mul_op0, 0);
- *cost += (rtx_cost (mul_op0, code, 0, speed_p)
- + rtx_cost (mul_op1, code, 0, speed_p)
- + rtx_cost (sub_op, code, 0, speed_p));
+ *cost += (rtx_cost (mul_op0, mode, code, 0, speed_p)
+ + rtx_cost (mul_op1, mode, code, 0, speed_p)
+ + rtx_cost (sub_op, mode, code, 0, speed_p));
return true;
}
@@ -9740,13 +9760,13 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
{
if (speed_p)
*cost += extra_cost->alu.arith_shift_reg;
- *cost += rtx_cost (shift_by_reg, code, 0, speed_p);
+ *cost += rtx_cost (shift_by_reg, mode, code, 0, speed_p);
}
else if (speed_p)
*cost += extra_cost->alu.arith_shift;
- *cost += (rtx_cost (shift_op, code, 0, speed_p)
- + rtx_cost (non_shift_op, code, 0, speed_p));
+ *cost += rtx_cost (shift_op, mode, code, 0, speed_p);
+ *cost += rtx_cost (non_shift_op, mode, code, 0, speed_p);
return true;
}
@@ -9756,9 +9776,9 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
/* MLS. */
if (speed_p)
*cost += extra_cost->mult[0].add;
- *cost += (rtx_cost (XEXP (x, 0), MINUS, 0, speed_p)
- + rtx_cost (XEXP (XEXP (x, 1), 0), MULT, 0, speed_p)
- + rtx_cost (XEXP (XEXP (x, 1), 1), MULT, 1, speed_p));
+ *cost += rtx_cost (XEXP (x, 0), mode, MINUS, 0, speed_p);
+ *cost += rtx_cost (XEXP (XEXP (x, 1), 0), mode, MULT, 0, speed_p);
+ *cost += rtx_cost (XEXP (XEXP (x, 1), 1), mode, MULT, 1, speed_p);
return true;
}
@@ -9770,7 +9790,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
*cost = COSTS_N_INSNS (insns);
if (speed_p)
*cost += insns * extra_cost->alu.arith;
- *cost += rtx_cost (XEXP (x, 1), code, 1, speed_p);
+ *cost += rtx_cost (XEXP (x, 1), mode, code, 1, speed_p);
return true;
}
else if (speed_p)
@@ -9798,7 +9818,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
if (CONST_INT_P (XEXP (x, 0)))
{
- *cost += rtx_cost (XEXP (x, 1), code, 1, speed_p);
+ *cost += rtx_cost (XEXP (x, 1), mode, code, 1, speed_p);
return true;
}
@@ -9817,10 +9837,11 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
*cost += 2 * extra_cost->alu.arith;
if (GET_CODE (op1) == ZERO_EXTEND)
- *cost += rtx_cost (XEXP (op1, 0), ZERO_EXTEND, 0, speed_p);
+ *cost += rtx_cost (XEXP (op1, 0), VOIDmode, ZERO_EXTEND,
+ 0, speed_p);
else
- *cost += rtx_cost (op1, MINUS, 1, speed_p);
- *cost += rtx_cost (XEXP (XEXP (x, 0), 0), ZERO_EXTEND,
+ *cost += rtx_cost (op1, mode, MINUS, 1, speed_p);
+ *cost += rtx_cost (XEXP (XEXP (x, 0), 0), VOIDmode, ZERO_EXTEND,
0, speed_p);
return true;
}
@@ -9828,9 +9849,9 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
{
if (speed_p)
*cost += extra_cost->alu.arith + extra_cost->alu.arith_shift;
- *cost += (rtx_cost (XEXP (XEXP (x, 0), 0), SIGN_EXTEND,
+ *cost += (rtx_cost (XEXP (XEXP (x, 0), 0), VOIDmode, SIGN_EXTEND,
0, speed_p)
- + rtx_cost (XEXP (x, 1), MINUS, 1, speed_p));
+ + rtx_cost (XEXP (x, 1), mode, MINUS, 1, speed_p));
return true;
}
else if (GET_CODE (XEXP (x, 1)) == ZERO_EXTEND
@@ -9841,8 +9862,8 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
+ (GET_CODE (XEXP (x, 1)) == ZERO_EXTEND
? extra_cost->alu.arith
: extra_cost->alu.arith_shift));
- *cost += (rtx_cost (XEXP (x, 0), MINUS, 0, speed_p)
- + rtx_cost (XEXP (XEXP (x, 1), 0),
+ *cost += (rtx_cost (XEXP (x, 0), mode, MINUS, 0, speed_p)
+ + rtx_cost (XEXP (XEXP (x, 1), 0), VOIDmode,
GET_CODE (XEXP (x, 1)), 0, speed_p));
return true;
}
@@ -9873,9 +9894,9 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
mul_op1 = XEXP (XEXP (x, 0), 1);
add_op = XEXP (x, 1);
- *cost += (rtx_cost (mul_op0, code, 0, speed_p)
- + rtx_cost (mul_op1, code, 0, speed_p)
- + rtx_cost (add_op, code, 0, speed_p));
+ *cost += (rtx_cost (mul_op0, mode, code, 0, speed_p)
+ + rtx_cost (mul_op1, mode, code, 0, speed_p)
+ + rtx_cost (add_op, mode, code, 0, speed_p));
return true;
}
@@ -9912,7 +9933,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
*cost += insns * extra_cost->alu.arith;
/* Slightly penalize a narrow operation as the result may
need widening. */
- *cost += 1 + rtx_cost (XEXP (x, 0), PLUS, 0, speed_p);
+ *cost += 1 + rtx_cost (XEXP (x, 0), mode, PLUS, 0, speed_p);
return true;
}
@@ -9937,9 +9958,9 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
/* UXTA[BH] or SXTA[BH]. */
if (speed_p)
*cost += extra_cost->alu.extend_arith;
- *cost += (rtx_cost (XEXP (XEXP (x, 0), 0), ZERO_EXTEND, 0,
- speed_p)
- + rtx_cost (XEXP (x, 1), PLUS, 0, speed_p));
+ *cost += (rtx_cost (XEXP (XEXP (x, 0), 0), VOIDmode, ZERO_EXTEND,
+ 0, speed_p)
+ + rtx_cost (XEXP (x, 1), mode, PLUS, 0, speed_p));
return true;
}
@@ -9951,13 +9972,13 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
{
if (speed_p)
*cost += extra_cost->alu.arith_shift_reg;
- *cost += rtx_cost (shift_reg, ASHIFT, 1, speed_p);
+ *cost += rtx_cost (shift_reg, mode, ASHIFT, 1, speed_p);
}
else if (speed_p)
*cost += extra_cost->alu.arith_shift;
- *cost += (rtx_cost (shift_op, ASHIFT, 0, speed_p)
- + rtx_cost (XEXP (x, 1), PLUS, 1, speed_p));
+ *cost += (rtx_cost (shift_op, mode, ASHIFT, 0, speed_p)
+ + rtx_cost (XEXP (x, 1), mode, PLUS, 1, speed_p));
return true;
}
if (GET_CODE (XEXP (x, 0)) == MULT)
@@ -9984,19 +10005,19 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
/* SMLA[BT][BT]. */
if (speed_p)
*cost += extra_cost->mult[0].extend_add;
- *cost += (rtx_cost (XEXP (XEXP (mul_op, 0), 0),
+ *cost += (rtx_cost (XEXP (XEXP (mul_op, 0), 0), mode,
SIGN_EXTEND, 0, speed_p)
- + rtx_cost (XEXP (XEXP (mul_op, 1), 0),
+ + rtx_cost (XEXP (XEXP (mul_op, 1), 0), mode,
SIGN_EXTEND, 0, speed_p)
- + rtx_cost (XEXP (x, 1), PLUS, 1, speed_p));
+ + rtx_cost (XEXP (x, 1), mode, PLUS, 1, speed_p));
return true;
}
if (speed_p)
*cost += extra_cost->mult[0].add;
- *cost += (rtx_cost (XEXP (mul_op, 0), MULT, 0, speed_p)
- + rtx_cost (XEXP (mul_op, 1), MULT, 1, speed_p)
- + rtx_cost (XEXP (x, 1), PLUS, 1, speed_p));
+ *cost += (rtx_cost (XEXP (mul_op, 0), mode, MULT, 0, speed_p)
+ + rtx_cost (XEXP (mul_op, 1), mode, MULT, 1, speed_p)
+ + rtx_cost (XEXP (x, 1), mode, PLUS, 1, speed_p));
return true;
}
if (CONST_INT_P (XEXP (x, 1)))
@@ -10007,7 +10028,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
*cost = COSTS_N_INSNS (insns);
if (speed_p)
*cost += insns * extra_cost->alu.arith;
- *cost += rtx_cost (XEXP (x, 0), PLUS, 0, speed_p);
+ *cost += rtx_cost (XEXP (x, 0), mode, PLUS, 0, speed_p);
return true;
}
else if (speed_p)
@@ -10028,11 +10049,11 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
*cost = COSTS_N_INSNS (1);
if (speed_p)
*cost += extra_cost->mult[1].extend_add;
- *cost += (rtx_cost (XEXP (XEXP (XEXP (x, 0), 0), 0),
+ *cost += (rtx_cost (XEXP (XEXP (XEXP (x, 0), 0), 0), mode,
ZERO_EXTEND, 0, speed_p)
- + rtx_cost (XEXP (XEXP (XEXP (x, 0), 1), 0),
+ + rtx_cost (XEXP (XEXP (XEXP (x, 0), 1), 0), mode,
ZERO_EXTEND, 0, speed_p)
- + rtx_cost (XEXP (x, 1), PLUS, 1, speed_p));
+ + rtx_cost (XEXP (x, 1), mode, PLUS, 1, speed_p));
return true;
}
@@ -10047,9 +10068,9 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
? extra_cost->alu.arith
: extra_cost->alu.arith_shift));
- *cost += (rtx_cost (XEXP (XEXP (x, 0), 0), ZERO_EXTEND, 0,
- speed_p)
- + rtx_cost (XEXP (x, 1), PLUS, 1, speed_p));
+ *cost += (rtx_cost (XEXP (XEXP (x, 0), 0), VOIDmode, ZERO_EXTEND,
+ 0, speed_p)
+ + rtx_cost (XEXP (x, 1), mode, PLUS, 1, speed_p));
return true;
}
@@ -10093,13 +10114,13 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
{
if (speed_p)
*cost += extra_cost->alu.log_shift_reg;
- *cost += rtx_cost (shift_reg, ASHIFT, 1, speed_p);
+ *cost += rtx_cost (shift_reg, mode, ASHIFT, 1, speed_p);
}
else if (speed_p)
*cost += extra_cost->alu.log_shift;
- *cost += (rtx_cost (shift_op, ASHIFT, 0, speed_p)
- + rtx_cost (XEXP (x, 1), code, 1, speed_p));
+ *cost += (rtx_cost (shift_op, mode, ASHIFT, 0, speed_p)
+ + rtx_cost (XEXP (x, 1), mode, code, 1, speed_p));
return true;
}
@@ -10112,14 +10133,14 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
*cost = COSTS_N_INSNS (insns);
if (speed_p)
*cost += insns * extra_cost->alu.logical;
- *cost += rtx_cost (op0, code, 0, speed_p);
+ *cost += rtx_cost (op0, mode, code, 0, speed_p);
return true;
}
if (speed_p)
*cost += extra_cost->alu.logical;
- *cost += (rtx_cost (op0, code, 0, speed_p)
- + rtx_cost (XEXP (x, 1), code, 1, speed_p));
+ *cost += (rtx_cost (op0, mode, code, 0, speed_p)
+ + rtx_cost (XEXP (x, 1), mode, code, 1, speed_p));
return true;
}
@@ -10140,8 +10161,9 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
if (speed_p)
*cost += 2 * extra_cost->alu.logical;
- *cost += (rtx_cost (XEXP (op0, 0), ZERO_EXTEND, 0, speed_p)
- + rtx_cost (XEXP (x, 1), code, 0, speed_p));
+ *cost += (rtx_cost (XEXP (op0, 0), VOIDmode, ZERO_EXTEND,
+ 0, speed_p)
+ + rtx_cost (XEXP (x, 1), mode, code, 0, speed_p));
return true;
}
else if (GET_CODE (op0) == SIGN_EXTEND)
@@ -10149,8 +10171,9 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
if (speed_p)
*cost += extra_cost->alu.logical + extra_cost->alu.log_shift;
- *cost += (rtx_cost (XEXP (op0, 0), SIGN_EXTEND, 0, speed_p)
- + rtx_cost (XEXP (x, 1), code, 0, speed_p));
+ *cost += (rtx_cost (XEXP (op0, 0), VOIDmode, SIGN_EXTEND,
+ 0, speed_p)
+ + rtx_cost (XEXP (x, 1), mode, code, 0, speed_p));
return true;
}
@@ -10178,8 +10201,8 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
if (speed_p)
*cost += extra_cost->fp[mode != SFmode].mult;
- *cost += (rtx_cost (op0, MULT, 0, speed_p)
- + rtx_cost (XEXP (x, 1), MULT, 1, speed_p));
+ *cost += (rtx_cost (op0, mode, MULT, 0, speed_p)
+ + rtx_cost (XEXP (x, 1), mode, MULT, 1, speed_p));
return true;
}
else if (GET_MODE_CLASS (mode) == MODE_FLOAT)
@@ -10209,8 +10232,8 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
/* SMUL[TB][TB]. */
if (speed_p)
*cost += extra_cost->mult[0].extend;
- *cost += (rtx_cost (XEXP (x, 0), SIGN_EXTEND, 0, speed_p)
- + rtx_cost (XEXP (x, 1), SIGN_EXTEND, 0, speed_p));
+ *cost += rtx_cost (XEXP (x, 0), mode, SIGN_EXTEND, 0, speed_p);
+ *cost += rtx_cost (XEXP (x, 1), mode, SIGN_EXTEND, 1, speed_p);
return true;
}
if (speed_p)
@@ -10229,9 +10252,9 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
*cost = COSTS_N_INSNS (1);
if (speed_p)
*cost += extra_cost->mult[1].extend;
- *cost += (rtx_cost (XEXP (XEXP (x, 0), 0),
+ *cost += (rtx_cost (XEXP (XEXP (x, 0), 0), VOIDmode,
ZERO_EXTEND, 0, speed_p)
- + rtx_cost (XEXP (XEXP (x, 1), 0),
+ + rtx_cost (XEXP (XEXP (x, 1), 0), VOIDmode,
ZERO_EXTEND, 0, speed_p));
return true;
}
@@ -10269,7 +10292,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
if (speed_p)
*cost += (extra_cost->alu.log_shift
+ extra_cost->alu.arith_shift);
- *cost += rtx_cost (XEXP (XEXP (x, 0), 0), ABS, 0, speed_p);
+ *cost += rtx_cost (XEXP (XEXP (x, 0), 0), mode, ABS, 0, speed_p);
return true;
}
@@ -10284,11 +10307,12 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
&& REGNO (XEXP (XEXP (x, 0), 0)) == CC_REGNUM
&& XEXP (XEXP (x, 0), 1) == const0_rtx))
{
+ mode = GET_MODE (XEXP (XEXP (x, 0), 0));
*cost += (COSTS_N_INSNS (1)
- + rtx_cost (XEXP (XEXP (x, 0), 0), COMPARE, 0,
- speed_p)
- + rtx_cost (XEXP (XEXP (x, 0), 1), COMPARE, 1,
- speed_p));
+ + rtx_cost (XEXP (XEXP (x, 0), 0), mode, COMPARE,
+ 0, speed_p)
+ + rtx_cost (XEXP (XEXP (x, 0), 1), mode, COMPARE,
+ 1, speed_p));
if (speed_p)
*cost += extra_cost->alu.arith;
}
@@ -10337,11 +10361,11 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
{
if (speed_p)
*cost += extra_cost->alu.log_shift_reg;
- *cost += rtx_cost (shift_reg, ASHIFT, 1, speed_p);
+ *cost += rtx_cost (shift_reg, mode, ASHIFT, 1, speed_p);
}
else if (speed_p)
*cost += extra_cost->alu.log_shift;
- *cost += rtx_cost (shift_op, ASHIFT, 0, speed_p);
+ *cost += rtx_cost (shift_op, mode, ASHIFT, 0, speed_p);
return true;
}
@@ -10367,10 +10391,10 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
*cost = COSTS_N_INSNS (4);
return true;
}
- int op1cost = rtx_cost (XEXP (x, 1), SET, 1, speed_p);
- int op2cost = rtx_cost (XEXP (x, 2), SET, 1, speed_p);
+ int op1cost = rtx_cost (XEXP (x, 1), mode, SET, 1, speed_p);
+ int op2cost = rtx_cost (XEXP (x, 2), mode, SET, 1, speed_p);
- *cost = rtx_cost (XEXP (x, 0), IF_THEN_ELSE, 0, speed_p);
+ *cost = rtx_cost (XEXP (x, 0), mode, IF_THEN_ELSE, 0, speed_p);
/* Assume that if one arm of the if_then_else is a register,
that it will be tied with the result and eliminate the
conditional insn. */
@@ -10413,7 +10437,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
if (XEXP (x, 1) == CONST0_RTX (op0mode))
{
- *cost += rtx_cost (XEXP (x, 0), code, 0, speed_p);
+ *cost += rtx_cost (XEXP (x, 0), op0mode, code, 0, speed_p);
return true;
}
@@ -10444,7 +10468,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
|| (GET_CODE (XEXP (x, 0)) == SUBREG
&& REG_P (SUBREG_REG (XEXP (x, 0))))))
{
- *cost = rtx_cost (XEXP (x, 0), COMPARE, 0, speed_p);
+ *cost = rtx_cost (XEXP (x, 0), op0mode, COMPARE, 0, speed_p);
/* Multiply operations that set the flags are often
significantly more expensive. */
@@ -10469,14 +10493,15 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
*cost = COSTS_N_INSNS (1);
if (shift_reg != NULL)
{
- *cost += rtx_cost (shift_reg, ASHIFT, 1, speed_p);
+ *cost += rtx_cost (shift_reg, op0mode, ASHIFT,
+ 1, speed_p);
if (speed_p)
*cost += extra_cost->alu.arith_shift_reg;
}
else if (speed_p)
*cost += extra_cost->alu.arith_shift;
- *cost += (rtx_cost (shift_op, ASHIFT, 0, speed_p)
- + rtx_cost (XEXP (x, 1), COMPARE, 1, speed_p));
+ *cost += rtx_cost (shift_op, op0mode, ASHIFT, 0, speed_p);
+ *cost += rtx_cost (XEXP (x, 1), op0mode, COMPARE, 1, speed_p);
return true;
}
@@ -10486,7 +10511,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
if (CONST_INT_P (XEXP (x, 1))
&& const_ok_for_op (INTVAL (XEXP (x, 1)), COMPARE))
{
- *cost += rtx_cost (XEXP (x, 0), COMPARE, 0, speed_p);
+ *cost += rtx_cost (XEXP (x, 0), op0mode, COMPARE, 0, speed_p);
return true;
}
return false;
@@ -10579,7 +10604,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
*cost = COSTS_N_INSNS (3);
break;
}
- *cost += rtx_cost (XEXP (x, 0), code, 0, speed_p);
+ *cost += rtx_cost (XEXP (x, 0), mode, code, 0, speed_p);
return true;
}
else
@@ -10588,7 +10613,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
if (CONST_INT_P (XEXP (x, 1))
&& const_ok_for_op (INTVAL (XEXP (x, 1)), COMPARE))
{
- *cost += rtx_cost (XEXP (x, 0), code, 0, speed_p);
+ *cost += rtx_cost (XEXP (x, 0), mode, code, 0, speed_p);
return true;
}
@@ -10639,7 +10664,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
if ((arm_arch4 || GET_MODE (XEXP (x, 0)) == SImode)
&& MEM_P (XEXP (x, 0)))
{
- *cost = rtx_cost (XEXP (x, 0), code, 0, speed_p);
+ *cost = rtx_cost (XEXP (x, 0), VOIDmode, code, 0, speed_p);
if (mode == DImode)
*cost += COSTS_N_INSNS (1);
@@ -10663,7 +10688,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
{
/* We have SXTB/SXTH. */
*cost = COSTS_N_INSNS (1);
- *cost += rtx_cost (XEXP (x, 0), code, 0, speed_p);
+ *cost += rtx_cost (XEXP (x, 0), VOIDmode, code, 0, speed_p);
if (speed_p)
*cost += extra_cost->alu.extend;
}
@@ -10671,7 +10696,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
{
/* Needs two shifts. */
*cost = COSTS_N_INSNS (2);
- *cost += rtx_cost (XEXP (x, 0), code, 0, speed_p);
+ *cost += rtx_cost (XEXP (x, 0), VOIDmode, code, 0, speed_p);
if (speed_p)
*cost += 2 * extra_cost->alu.shift;
}
@@ -10692,7 +10717,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
|| GET_MODE (XEXP (x, 0)) == QImode)
&& MEM_P (XEXP (x, 0)))
{
- *cost = rtx_cost (XEXP (x, 0), code, 0, speed_p);
+ *cost = rtx_cost (XEXP (x, 0), VOIDmode, code, 0, speed_p);
if (mode == DImode)
*cost += COSTS_N_INSNS (1); /* No speed penalty. */
@@ -10716,7 +10741,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
{
/* We have UXTB/UXTH. */
*cost = COSTS_N_INSNS (1);
- *cost += rtx_cost (XEXP (x, 0), code, 0, speed_p);
+ *cost += rtx_cost (XEXP (x, 0), VOIDmode, code, 0, speed_p);
if (speed_p)
*cost += extra_cost->alu.extend;
}
@@ -10727,7 +10752,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
shift may merge with a subsequent insn as a shifter
op. */
*cost = COSTS_N_INSNS (2);
- *cost += rtx_cost (XEXP (x, 0), code, 0, speed_p);
+ *cost += rtx_cost (XEXP (x, 0), VOIDmode, code, 0, speed_p);
if (speed_p)
*cost += 2 * extra_cost->alu.shift;
}
@@ -10871,7 +10896,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
*cost = COSTS_N_INSNS (1);
if (speed_p)
*cost += extra_cost->alu.log_shift;
- *cost += rtx_cost (XEXP (x, 0), code, 0, speed_p);
+ *cost += rtx_cost (XEXP (x, 0), mode, code, 0, speed_p);
return true;
}
/* Fall through. */
@@ -10895,10 +10920,10 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
*cost = COSTS_N_INSNS (1);
if (speed_p)
*cost += extra_cost->mult[1].extend;
- *cost += (rtx_cost (XEXP (XEXP (XEXP (x, 0), 0), 0), ZERO_EXTEND, 0,
- speed_p)
- + rtx_cost (XEXP (XEXP (XEXP (x, 0), 0), 1), ZERO_EXTEND,
- 0, speed_p));
+ *cost += (rtx_cost (XEXP (XEXP (XEXP (x, 0), 0), 0), VOIDmode,
+ ZERO_EXTEND, 0, speed_p)
+ + rtx_cost (XEXP (XEXP (XEXP (x, 0), 0), 1), VOIDmode,
+ ZERO_EXTEND, 0, speed_p));
return true;
}
*cost = LIBCALL_COST (1);
@@ -10926,14 +10951,14 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
*cost = COSTS_N_INSNS (1);
if (speed_p)
*cost += extra_cost->alu.bfx;
- *cost += rtx_cost (XEXP (x, 0), code, 0, speed_p);
+ *cost += rtx_cost (XEXP (x, 0), mode, code, 0, speed_p);
return true;
}
/* Without UBFX/SBFX, need to resort to shift operations. */
*cost = COSTS_N_INSNS (2);
if (speed_p)
*cost += 2 * extra_cost->alu.shift;
- *cost += rtx_cost (XEXP (x, 0), ASHIFT, 0, speed_p);
+ *cost += rtx_cost (XEXP (x, 0), mode, ASHIFT, 0, speed_p);
return true;
case FLOAT_EXTEND:
@@ -10951,7 +10976,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
if (speed_p)
*cost += extra_cost->fp[0].widen;
}
- *cost += rtx_cost (XEXP (x, 0), code, 0, speed_p);
+ *cost += rtx_cost (XEXP (x, 0), VOIDmode, code, 0, speed_p);
return true;
}
@@ -10964,7 +10989,7 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
*cost = COSTS_N_INSNS (1);
if (speed_p)
*cost += extra_cost->fp[mode == DFmode].narrow;
- *cost += rtx_cost (XEXP (x, 0), code, 0, speed_p);
+ *cost += rtx_cost (XEXP (x, 0), VOIDmode, code, 0, speed_p);
return true;
/* Vector modes? */
}
@@ -10988,9 +11013,9 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
if (GET_CODE (op2) == NEG)
op2 = XEXP (op2, 0);
- *cost += rtx_cost (op0, FMA, 0, speed_p);
- *cost += rtx_cost (op1, FMA, 1, speed_p);
- *cost += rtx_cost (op2, FMA, 2, speed_p);
+ *cost += rtx_cost (op0, mode, FMA, 0, speed_p);
+ *cost += rtx_cost (op1, mode, FMA, 1, speed_p);
+ *cost += rtx_cost (op2, mode, FMA, 2, speed_p);
if (speed_p)
*cost += extra_cost->fp[mode ==DFmode].fma;
@@ -11008,13 +11033,15 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
if (GET_MODE_CLASS (mode) == MODE_INT)
{
*cost = COSTS_N_INSNS (1);
+ mode = GET_MODE (XEXP (x, 0));
if (speed_p)
- *cost += extra_cost->fp[GET_MODE (XEXP (x, 0)) == DFmode].toint;
+ *cost += extra_cost->fp[mode == DFmode].toint;
/* Strip of the 'cost' of rounding towards zero. */
if (GET_CODE (XEXP (x, 0)) == FIX)
- *cost += rtx_cost (XEXP (XEXP (x, 0), 0), code, 0, speed_p);
+ *cost += rtx_cost (XEXP (XEXP (x, 0), 0), mode, code,
+ 0, speed_p);
else
- *cost += rtx_cost (XEXP (x, 0), code, 0, speed_p);
+ *cost += rtx_cost (XEXP (x, 0), mode, code, 0, speed_p);
/* ??? Increase the cost to deal with transferring from
FP -> CORE registers? */
return true;
@@ -11074,10 +11101,11 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
/* RTX costs when optimizing for size. */
static bool
-arm_rtx_costs (rtx x, int code, int outer_code, int opno ATTRIBUTE_UNUSED,
- int *total, bool speed)
+arm_rtx_costs (rtx x, machine_mode mode ATTRIBUTE_UNUSED, int outer_code,
+ int opno ATTRIBUTE_UNUSED, int *total, bool speed)
{
bool result;
+ int code = GET_CODE (x);
if (TARGET_OLD_RTX_COSTS
|| (!current_tune->insn_extra_cost && !TARGET_NEW_GENERIC_COSTS))
@@ -11158,7 +11186,7 @@ arm_slowmul_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
}
*total = COSTS_N_INSNS (cost);
- *total += rtx_cost (XEXP (x, 0), code, 0, speed);
+ *total += rtx_cost (XEXP (x, 0), mode, code, 0, speed);
return true;
}