diff options
Diffstat (limited to 'gcc/config/arm/arm.c')
-rw-r--r-- | gcc/config/arm/arm.c | 69 |
1 files changed, 60 insertions, 9 deletions
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 0fc3d67cea7..1020ddc80fe 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -250,6 +250,8 @@ static bool arm_builtin_support_vector_misalignment (enum machine_mode mode, bool is_packed); static void arm_conditional_register_usage (void); static reg_class_t arm_preferred_rename_class (reg_class_t rclass); +static int arm_default_unroll_times(void); +static int arm_cortex_m_unroll_times(void); static int arm_default_branch_cost (bool, bool); static int arm_cortex_v7m_branch_cost (bool, bool); @@ -858,7 +860,8 @@ const struct tune_params arm_slowmul_tune = 3, /* Constant limit. */ ARM_PREFETCH_NOT_BENEFICIAL, true, /* Prefer constant pool. */ - arm_default_branch_cost + arm_default_branch_cost, + arm_default_unroll_times }; const struct tune_params arm_fastmul_tune = @@ -868,7 +871,8 @@ const struct tune_params arm_fastmul_tune = 1, /* Constant limit. */ ARM_PREFETCH_NOT_BENEFICIAL, true, /* Prefer constant pool. */ - arm_default_branch_cost + arm_default_branch_cost, + arm_default_unroll_times }; const struct tune_params arm_xscale_tune = @@ -878,7 +882,8 @@ const struct tune_params arm_xscale_tune = 2, /* Constant limit. */ ARM_PREFETCH_NOT_BENEFICIAL, true, /* Prefer constant pool. */ - arm_default_branch_cost + arm_default_branch_cost, + arm_default_unroll_times }; const struct tune_params arm_9e_tune = @@ -888,7 +893,8 @@ const struct tune_params arm_9e_tune = 1, /* Constant limit. */ ARM_PREFETCH_NOT_BENEFICIAL, true, /* Prefer constant pool. */ - arm_default_branch_cost + arm_default_branch_cost, + arm_default_unroll_times }; const struct tune_params arm_v6t2_tune = @@ -898,7 +904,8 @@ const struct tune_params arm_v6t2_tune = 1, /* Constant limit. */ ARM_PREFETCH_NOT_BENEFICIAL, false, /* Prefer constant pool. */ - arm_default_branch_cost + arm_default_branch_cost, + arm_default_unroll_times }; /* Generic Cortex tuning. Use more specific tunings if appropriate. */ @@ -909,7 +916,8 @@ const struct tune_params arm_cortex_tune = 1, /* Constant limit. */ ARM_PREFETCH_NOT_BENEFICIAL, false, /* Prefer constant pool. */ - arm_default_branch_cost + arm_default_branch_cost, + arm_default_unroll_times }; const struct tune_params arm_cortex_a9_tune = @@ -919,7 +927,8 @@ const struct tune_params arm_cortex_a9_tune = 1, /* Constant limit. */ ARM_PREFETCH_BENEFICIAL(4,32,32), false, /* Prefer constant pool. */ - arm_default_branch_cost + arm_default_branch_cost, + arm_default_unroll_times }; /* Generic Cortex tuning. Use more specific tunings if appropriate. */ @@ -930,7 +939,20 @@ const struct tune_params arm_cortex_v7m_tune = 1, /* Constant limit. */ ARM_PREFETCH_NOT_BENEFICIAL, false, /* Prefer constant pool. */ - arm_cortex_v7m_branch_cost + arm_cortex_v7m_branch_cost, + arm_cortex_m_unroll_times +}; + +/* Generic Cortex tuning. Use more specific tunings if appropriate. */ +const struct tune_params arm_cortex_v6m_tune = +{ + arm_9e_rtx_costs, + NULL, + 1, /* Constant limit. */ + ARM_PREFETCH_NOT_BENEFICIAL, + false, /* Prefer constant pool. */ + arm_default_branch_cost, + arm_cortex_m_unroll_times }; const struct tune_params arm_fa726te_tune = @@ -940,7 +962,8 @@ const struct tune_params arm_fa726te_tune = 1, /* Constant limit. */ ARM_PREFETCH_NOT_BENEFICIAL, true, /* Prefer constant pool. */ - arm_default_branch_cost + arm_default_branch_cost, + arm_default_unroll_times }; @@ -2240,6 +2263,22 @@ arm_option_override (void) && current_tune->num_prefetch_slots > 0) flag_prefetch_loop_arrays = 1; + /* Enable loop unroll for all all M class cores. */ + if (optimize >=1 + && (arm_selected_cpu->core == cortexm0 || + arm_selected_cpu->core == cortexm1 || + arm_selected_cpu->core == cortexm3 || + arm_selected_cpu->core == cortexm4)) + { + flag_unroll_loops = 1; + + /* Set default loop unroll times. */ + maybe_set_param_value (PARAM_MAX_UNROLL_TIMES, + current_tune->max_unroll_times(), + global_options.x_param_values, + global_options_set.x_param_values); + } + /* Set up parameters to be used in prefetching algorithm. Do not override the defaults unless we are tuning for a core we have researched values for. */ if (current_tune->num_prefetch_slots > 0) @@ -8511,6 +8550,18 @@ arm_adjust_cost (rtx insn, rtx link, rtx dep, int cost) } static int +arm_default_unroll_times (void) +{ + return PARAM_VALUE (PARAM_MAX_UNROLL_TIMES); +} + +static int +arm_cortex_m_unroll_times (void) +{ + return 2; +} + +static int arm_default_branch_cost (bool speed_p, bool predictable_p ATTRIBUTE_UNUSED) { if (TARGET_32BIT) |