diff options
author | Ian Bolton <ian.bolton@arm.com> | 2010-11-26 13:21:32 +0000 |
---|---|---|
committer | Ian Bolton <ibolton@gcc.gnu.org> | 2010-11-26 13:21:32 +0000 |
commit | 911de8a3417489cc2fb9c5009a974a3e8a7bae92 (patch) | |
tree | dca4a3b79908c3d7ee8c9bcef378e46fb287cf55 /gcc | |
parent | 4d00efb6f42f48fee366ee15838756e1e37fb645 (diff) | |
download | gcc-911de8a3417489cc2fb9c5009a974a3e8a7bae92.zip gcc-911de8a3417489cc2fb9c5009a974a3e8a7bae92.tar.gz gcc-911de8a3417489cc2fb9c5009a974a3e8a7bae92.tar.bz2 |
arm.c (arm_option_override): enable loop array prefetching at -O3 for suitable targets, and configure params.
2010-11-26 Ian Bolton <ian.bolton@arm.com>
* config/arm/arm.c (arm_option_override): enable loop array
prefetching at -O3 for suitable targets, and configure params.
* config/arm/arm-protos.h (struct tune_params): Add fields for
configuring loop array prefetching.
From-SVN: r167175
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/config/arm/arm-protos.h | 3 | ||||
-rw-r--r-- | gcc/config/arm/arm.c | 48 |
3 files changed, 53 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d3f4f41..cc26014 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2010-11-26 Ian Bolton <ian.bolton@arm.com> + + * config/arm/arm.c (arm_option_override): enable loop array + prefetching at -O3 for suitable targets, and configure params. + * config/arm/arm-protos.h (struct tune_params): Add fields for + configuring loop array prefetching. + 2010-11-26 Christian Borntraeger <borntraeger@de.ibm.com> * config/s390/2817.md (z196_crack): Add z196_g3 as possible slot. diff --git a/gcc/config/arm/arm-protos.h b/gcc/config/arm/arm-protos.h index 1b1fe12..53923bd 100644 --- a/gcc/config/arm/arm-protos.h +++ b/gcc/config/arm/arm-protos.h @@ -218,6 +218,9 @@ struct tune_params bool (*rtx_costs) (rtx, RTX_CODE, RTX_CODE, int *, bool); bool (*sched_adjust_cost) (rtx, rtx, rtx, int *); int constant_limit; + int num_prefetch_slots; + int l1_cache_size; + int l1_cache_line_size; }; extern const struct tune_params *current_tune; diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index ef42e45..f9fbb19 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -835,39 +835,51 @@ struct processors const struct tune_params *const tune; }; + +#define ARM_PREFETCH_NOT_BENEFICIAL 0, -1, -1 +#define ARM_PREFETCH_BENEFICIAL(prefetch_slots,l1_size,l1_line_size) \ + prefetch_slots, \ + l1_size, \ + l1_line_size + const struct tune_params arm_slowmul_tune = { arm_slowmul_rtx_costs, NULL, - 3 + 3, + ARM_PREFETCH_NOT_BENEFICIAL }; const struct tune_params arm_fastmul_tune = { arm_fastmul_rtx_costs, NULL, - 1 + 1, + ARM_PREFETCH_NOT_BENEFICIAL }; const struct tune_params arm_xscale_tune = { arm_xscale_rtx_costs, xscale_sched_adjust_cost, - 2 + 2, + ARM_PREFETCH_NOT_BENEFICIAL }; const struct tune_params arm_9e_tune = { arm_9e_rtx_costs, NULL, - 1 + 1, + ARM_PREFETCH_NOT_BENEFICIAL }; const struct tune_params arm_cortex_a9_tune = { arm_9e_rtx_costs, cortex_a9_sched_adjust_cost, - 1 + 1, + ARM_PREFETCH_BENEFICIAL(4,32,32) }; @@ -1983,6 +1995,32 @@ arm_option_override (void) if (TARGET_AAPCS_BASED && flag_strict_volatile_bitfields < 0) flag_strict_volatile_bitfields = 1; + /* Enable sw prefetching at -O3 for CPUS that have prefetch, and we have deemed + it beneficial (signified by setting num_prefetch_slots to 1 or more.) */ + if (flag_prefetch_loop_arrays < 0 + && HAVE_prefetch + && optimize >= 3 + && current_tune->num_prefetch_slots > 0) + flag_prefetch_loop_arrays = 1; + + /* 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) + maybe_set_param_value (PARAM_SIMULTANEOUS_PREFETCHES, + current_tune->num_prefetch_slots, + global_options.x_param_values, + global_options_set.x_param_values); + if (current_tune->l1_cache_line_size >= 0) + maybe_set_param_value (PARAM_L1_CACHE_LINE_SIZE, + current_tune->l1_cache_line_size, + global_options.x_param_values, + global_options_set.x_param_values); + if (current_tune->l1_cache_size >= 0) + maybe_set_param_value (PARAM_L1_CACHE_SIZE, + current_tune->l1_cache_size, + global_options.x_param_values, + global_options_set.x_param_values); + /* Register global variables with the garbage collector. */ arm_add_gc_roots (); } |