+2017-11-23 Charles Baylis <charles.baylis@linaro.org>
+
+ * config/arm/arm-protos.h (enum arm_addr_mode_op): New.
+ (struct addr_mode_cost_table): New.
+ (struct tune_params): Add field addr_mode_costs.
+ * config/arm/arm.c (generic_addr_mode_costs): New.
+ (arm_slowmul_tune): Initialise addr_mode_costs field.
+ (arm_fastmul_tune): Likewise.
+ (arm_strongarm_tune): Likewise.
+ (arm_xscale_tune): Likewise.
+ (arm_9e_tune): Likewise.
+ (arm_marvell_pj4_tune): Likewise.
+ (arm_v6t2_tune): Likewise.
+ (arm_cortex_tune): Likewise.
+ (arm_cortex_a8_tune): Likewise.
+ (arm_cortex_a7_tune): Likewise.
+ (arm_cortex_a15_tune): Likewise.
+ (arm_cortex_a35_tune): Likewise.
+ (arm_cortex_a53_tune): Likewise.
+ (arm_cortex_a57_tune): Likewise.
+ (arm_exynosm1_tune): Likewise.
+ (arm_xgene1_tune): Likewise.
+ (arm_cortex_a5_tune): Likewise.
+ (arm_cortex_a9_tune): Likewise.
+ (arm_cortex_a12_tune): Likewise.
+ (arm_cortex_a73_tune): Likewise.
+ (arm_v7m_tune): Likewise.
+ (arm_cortex_m7_tune): Likewise.
+ (arm_v6m_tune): Likewise.
+ (arm_fa726te_tune): Likewise.
+ (arm_mem_costs): Use table lookup to calculate cost of addressing
+ mode.
+
2017-11-23 Charles Baylis <charles.baylis@linaro.org>
* config/arm/arm.c (arm_mem_costs): New function.
}
};
+const struct addr_mode_cost_table generic_addr_mode_costs =
+{
+ /* int. */
+ {
+ COSTS_N_INSNS (0), /* AMO_DEFAULT. */
+ COSTS_N_INSNS (0), /* AMO_NO_WB. */
+ COSTS_N_INSNS (0) /* AMO_WB. */
+ },
+ /* float. */
+ {
+ COSTS_N_INSNS (0), /* AMO_DEFAULT. */
+ COSTS_N_INSNS (0), /* AMO_NO_WB. */
+ COSTS_N_INSNS (0) /* AMO_WB. */
+ },
+ /* vector. */
+ {
+ COSTS_N_INSNS (0), /* AMO_DEFAULT. */
+ COSTS_N_INSNS (0), /* AMO_NO_WB. */
+ COSTS_N_INSNS (0) /* AMO_WB. */
+ }
+};
+
const struct tune_params arm_slowmul_tune =
{
&generic_extra_costs, /* Insn extra costs. */
+ &generic_addr_mode_costs, /* Addressing mode costs. */
NULL, /* Sched adj cost. */
arm_default_branch_cost,
&arm_default_vec_cost,
const struct tune_params arm_fastmul_tune =
{
&generic_extra_costs, /* Insn extra costs. */
+ &generic_addr_mode_costs, /* Addressing mode costs. */
NULL, /* Sched adj cost. */
arm_default_branch_cost,
&arm_default_vec_cost,
const struct tune_params arm_strongarm_tune =
{
&generic_extra_costs, /* Insn extra costs. */
+ &generic_addr_mode_costs, /* Addressing mode costs. */
NULL, /* Sched adj cost. */
arm_default_branch_cost,
&arm_default_vec_cost,
const struct tune_params arm_xscale_tune =
{
&generic_extra_costs, /* Insn extra costs. */
+ &generic_addr_mode_costs, /* Addressing mode costs. */
xscale_sched_adjust_cost,
arm_default_branch_cost,
&arm_default_vec_cost,
const struct tune_params arm_9e_tune =
{
&generic_extra_costs, /* Insn extra costs. */
+ &generic_addr_mode_costs, /* Addressing mode costs. */
NULL, /* Sched adj cost. */
arm_default_branch_cost,
&arm_default_vec_cost,
const struct tune_params arm_marvell_pj4_tune =
{
&generic_extra_costs, /* Insn extra costs. */
+ &generic_addr_mode_costs, /* Addressing mode costs. */
NULL, /* Sched adj cost. */
arm_default_branch_cost,
&arm_default_vec_cost,
const struct tune_params arm_v6t2_tune =
{
&generic_extra_costs, /* Insn extra costs. */
+ &generic_addr_mode_costs, /* Addressing mode costs. */
NULL, /* Sched adj cost. */
arm_default_branch_cost,
&arm_default_vec_cost,
const struct tune_params arm_cortex_tune =
{
&generic_extra_costs,
+ &generic_addr_mode_costs, /* Addressing mode costs. */
NULL, /* Sched adj cost. */
arm_default_branch_cost,
&arm_default_vec_cost,
const struct tune_params arm_cortex_a8_tune =
{
&cortexa8_extra_costs,
+ &generic_addr_mode_costs, /* Addressing mode costs. */
NULL, /* Sched adj cost. */
arm_default_branch_cost,
&arm_default_vec_cost,
const struct tune_params arm_cortex_a7_tune =
{
&cortexa7_extra_costs,
+ &generic_addr_mode_costs, /* Addressing mode costs. */
NULL, /* Sched adj cost. */
arm_default_branch_cost,
&arm_default_vec_cost,
const struct tune_params arm_cortex_a15_tune =
{
&cortexa15_extra_costs,
+ &generic_addr_mode_costs, /* Addressing mode costs. */
NULL, /* Sched adj cost. */
arm_default_branch_cost,
&arm_default_vec_cost,
const struct tune_params arm_cortex_a35_tune =
{
&cortexa53_extra_costs,
+ &generic_addr_mode_costs, /* Addressing mode costs. */
NULL, /* Sched adj cost. */
arm_default_branch_cost,
&arm_default_vec_cost,
const struct tune_params arm_cortex_a53_tune =
{
&cortexa53_extra_costs,
+ &generic_addr_mode_costs, /* Addressing mode costs. */
NULL, /* Sched adj cost. */
arm_default_branch_cost,
&arm_default_vec_cost,
const struct tune_params arm_cortex_a57_tune =
{
&cortexa57_extra_costs,
+ &generic_addr_mode_costs, /* addressing mode costs */
NULL, /* Sched adj cost. */
arm_default_branch_cost,
&arm_default_vec_cost,
const struct tune_params arm_exynosm1_tune =
{
&exynosm1_extra_costs,
+ &generic_addr_mode_costs, /* Addressing mode costs. */
NULL, /* Sched adj cost. */
arm_default_branch_cost,
&arm_default_vec_cost,
const struct tune_params arm_xgene1_tune =
{
&xgene1_extra_costs,
+ &generic_addr_mode_costs, /* Addressing mode costs. */
NULL, /* Sched adj cost. */
arm_default_branch_cost,
&arm_default_vec_cost,
const struct tune_params arm_cortex_a5_tune =
{
&cortexa5_extra_costs,
+ &generic_addr_mode_costs, /* Addressing mode costs. */
NULL, /* Sched adj cost. */
arm_cortex_a5_branch_cost,
&arm_default_vec_cost,
const struct tune_params arm_cortex_a9_tune =
{
&cortexa9_extra_costs,
+ &generic_addr_mode_costs, /* Addressing mode costs. */
cortex_a9_sched_adjust_cost,
arm_default_branch_cost,
&arm_default_vec_cost,
const struct tune_params arm_cortex_a12_tune =
{
&cortexa12_extra_costs,
+ &generic_addr_mode_costs, /* Addressing mode costs. */
NULL, /* Sched adj cost. */
arm_default_branch_cost,
&arm_default_vec_cost, /* Vectorizer costs. */
const struct tune_params arm_cortex_a73_tune =
{
&cortexa57_extra_costs,
+ &generic_addr_mode_costs, /* Addressing mode costs. */
NULL, /* Sched adj cost. */
arm_default_branch_cost,
&arm_default_vec_cost, /* Vectorizer costs. */
const struct tune_params arm_v7m_tune =
{
&v7m_extra_costs,
+ &generic_addr_mode_costs, /* Addressing mode costs. */
NULL, /* Sched adj cost. */
arm_cortex_m_branch_cost,
&arm_default_vec_cost,
const struct tune_params arm_cortex_m7_tune =
{
&v7m_extra_costs,
+ &generic_addr_mode_costs, /* Addressing mode costs. */
NULL, /* Sched adj cost. */
arm_cortex_m7_branch_cost,
&arm_default_vec_cost,
const struct tune_params arm_v6m_tune =
{
&generic_extra_costs, /* Insn extra costs. */
+ &generic_addr_mode_costs, /* Addressing mode costs. */
NULL, /* Sched adj cost. */
arm_default_branch_cost,
&arm_default_vec_cost, /* Vectorizer costs. */
const struct tune_params arm_fa726te_tune =
{
&generic_extra_costs, /* Insn extra costs. */
+ &generic_addr_mode_costs, /* Addressing mode costs. */
fa726te_sched_adjust_cost,
arm_default_branch_cost,
&arm_default_vec_cost,
below. See arm.md:calculate_pic_address. */
*cost += COSTS_N_INSNS (1);
+ /* Calculate cost of the addressing mode. */
+ if (speed_p)
+ {
+ arm_addr_mode_op op_type;
+ switch (GET_CODE (XEXP (x, 0)))
+ {
+ default:
+ case REG:
+ op_type = AMO_DEFAULT;
+ break;
+ case MINUS:
+ /* MINUS does not appear in RTL, but the architecture supports it,
+ so handle this case defensively. */
+ /* fall through */
+ case PLUS:
+ op_type = AMO_NO_WB;
+ break;
+ case PRE_INC:
+ case PRE_DEC:
+ case POST_INC:
+ case POST_DEC:
+ case PRE_MODIFY:
+ case POST_MODIFY:
+ op_type = AMO_WB;
+ break;
+ }
+
+ if (VECTOR_MODE_P (mode))
+ *cost += current_tune->addr_mode_costs->vector[op_type];
+ else if (FLOAT_MODE_P (mode))
+ *cost += current_tune->addr_mode_costs->fp[op_type];
+ else
+ *cost += current_tune->addr_mode_costs->integer[op_type];
+ }
+
/* Calculate cost of memory access. */
if (speed_p)
{