aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2017-06-16 09:30:52 +0000
committerMaxim Kuvyrkov <mkuvyrkov@gcc.gnu.org>2017-06-16 09:30:52 +0000
commit16b2cafd0088500dc098121ed6d1aa622f1dc8a5 (patch)
tree66c928fe285012cb89034dfe86d525108ff01ac2 /gcc
parent9d2c6e2eb72324b10160ce1117a8ab600be94bad (diff)
downloadgcc-16b2cafd0088500dc098121ed6d1aa622f1dc8a5.zip
gcc-16b2cafd0088500dc098121ed6d1aa622f1dc8a5.tar.gz
gcc-16b2cafd0088500dc098121ed6d1aa622f1dc8a5.tar.bz2
Enable -fprefetch-loop-arrays at given optimization level.
* config/aarch64/aarch64.c (aarch64_override_options_internal): Set flag_prefetch_loop_arrays according to tuning data. Change-Id: Id41411e671e0a55dc7268e0ad0a4e8ff1421c90a From-SVN: r249241
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/config/aarch64/aarch64-protos.h1
-rw-r--r--gcc/config/aarch64/aarch64.c21
3 files changed, 23 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a78e736..0ed2ac1 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
2017-06-16 Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org>
+ * config/aarch64/aarch64.c (aarch64_override_options_internal):
+ Set flag_prefetch_loop_arrays according to tuning data.
+
+2017-06-16 Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org>
+
* config/aarch64/aarch64-protos.h (struct cpu_prefetch_tune):
New tune structure.
(struct tune_params): Use cpu_prefetch_tune instead of cache_line_size.
diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h
index bb06139..bfe44a7 100644
--- a/gcc/config/aarch64/aarch64-protos.h
+++ b/gcc/config/aarch64/aarch64-protos.h
@@ -210,6 +210,7 @@ struct cpu_prefetch_tune
const int l1_cache_size;
const int l1_cache_line_size;
const int l2_cache_size;
+ const int default_opt_level;
};
struct tune_params
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index e3296c0..324a0f1 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -532,7 +532,8 @@ static const cpu_prefetch_tune generic_prefetch_tune =
0, /* num_slots */
-1, /* l1_cache_size */
-1, /* l1_cache_line_size */
- -1 /* l2_cache_size */
+ -1, /* l2_cache_size */
+ -1 /* default_opt_level */
};
static const cpu_prefetch_tune exynosm1_prefetch_tune =
@@ -540,7 +541,8 @@ static const cpu_prefetch_tune exynosm1_prefetch_tune =
0, /* num_slots */
-1, /* l1_cache_size */
64, /* l1_cache_line_size */
- -1 /* l2_cache_size */
+ -1, /* l2_cache_size */
+ -1 /* default_opt_level */
};
static const cpu_prefetch_tune qdf24xx_prefetch_tune =
@@ -548,7 +550,8 @@ static const cpu_prefetch_tune qdf24xx_prefetch_tune =
0, /* num_slots */
-1, /* l1_cache_size */
64, /* l1_cache_line_size */
- -1 /* l2_cache_size */
+ -1, /* l2_cache_size */
+ -1 /* default_opt_level */
};
static const cpu_prefetch_tune thunderx2t99_prefetch_tune =
@@ -556,7 +559,8 @@ static const cpu_prefetch_tune thunderx2t99_prefetch_tune =
0, /* num_slots */
-1, /* l1_cache_size */
64, /* l1_cache_line_size */
- -1 /* l2_cache_size */
+ -1, /* l2_cache_size */
+ -1 /* default_opt_level */
};
static const struct tune_params generic_tunings =
@@ -8806,6 +8810,15 @@ aarch64_override_options_internal (struct gcc_options *opts)
opts->x_param_values,
global_options_set.x_param_values);
+ /* Enable sw prefetching at specified optimization level for
+ CPUS that have prefetch. Lower optimization level threshold by 1
+ when profiling is enabled. */
+ if (opts->x_flag_prefetch_loop_arrays < 0
+ && !opts->x_optimize_size
+ && aarch64_tune_params.prefetch->default_opt_level >= 0
+ && opts->x_optimize >= aarch64_tune_params.prefetch->default_opt_level)
+ opts->x_flag_prefetch_loop_arrays = 1;
+
aarch64_override_options_after_change_1 (opts);
}