aboutsummaryrefslogtreecommitdiff
path: root/gcc/target.def
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2019-11-16 10:40:23 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2019-11-16 10:40:23 +0000
commitbcc7e346bf9b5dc77797ea949d6adc740deb30ca (patch)
tree5423a73f6ef55339cc766316b3d0e9113cf70129 /gcc/target.def
parentf884cd2fea62eebe71b422e1c97e550958dd42ae (diff)
downloadgcc-bcc7e346bf9b5dc77797ea949d6adc740deb30ca.zip
gcc-bcc7e346bf9b5dc77797ea949d6adc740deb30ca.tar.gz
gcc-bcc7e346bf9b5dc77797ea949d6adc740deb30ca.tar.bz2
Optionally pick the cheapest loop_vec_info
This patch adds a mode in which the vectoriser tries each available base vector mode and picks the one with the lowest cost. The new behaviour is selected by autovectorize_vector_modes. The patch keeps the current behaviour of preferring a VF of loop->simdlen over any larger or smaller VF, regardless of costs or target preferences. 2019-11-16 Richard Sandiford <richard.sandiford@arm.com> gcc/ * target.h (VECT_COMPARE_COSTS): New constant. * target.def (autovectorize_vector_modes): Return a bitmask of flags. * doc/tm.texi: Regenerate. * targhooks.h (default_autovectorize_vector_modes): Update accordingly. * targhooks.c (default_autovectorize_vector_modes): Likewise. * config/aarch64/aarch64.c (aarch64_autovectorize_vector_modes): Likewise. * config/arc/arc.c (arc_autovectorize_vector_modes): Likewise. * config/arm/arm.c (arm_autovectorize_vector_modes): Likewise. * config/i386/i386.c (ix86_autovectorize_vector_modes): Likewise. * config/mips/mips.c (mips_autovectorize_vector_modes): Likewise. * tree-vectorizer.h (_loop_vec_info::vec_outside_cost) (_loop_vec_info::vec_inside_cost): New member variables. * tree-vect-loop.c (_loop_vec_info::_loop_vec_info): Initialize them. (vect_better_loop_vinfo_p, vect_joust_loop_vinfos): New functions. (vect_analyze_loop): When autovectorize_vector_modes returns VECT_COMPARE_COSTS, try vectorizing the loop with each available vector mode and picking the one with the lowest cost. (vect_estimate_min_profitable_iters): Record the computed costs in the loop_vec_info. From-SVN: r278336
Diffstat (limited to 'gcc/target.def')
-rw-r--r--gcc/target.def14
1 files changed, 12 insertions, 2 deletions
diff --git a/gcc/target.def b/gcc/target.def
index d220f8f..e705c5d 100644
--- a/gcc/target.def
+++ b/gcc/target.def
@@ -1925,10 +1925,20 @@ element mode.\n\
If @var{all} is true, add suitable vector modes even when they are generally\n\
not expected to be worthwhile.\n\
\n\
+The hook returns a bitmask of flags that control how the modes in\n\
+@var{modes} are used. The flags are:\n\
+@table @code\n\
+@item VECT_COMPARE_COSTS\n\
+Tells the loop vectorizer to try all the provided modes and pick the one\n\
+with the lowest cost. By default the vectorizer will choose the first\n\
+mode that works.\n\
+@end table\n\
+\n\
The hook does not need to do anything if the vector returned by\n\
@code{TARGET_VECTORIZE_PREFERRED_SIMD_MODE} is the only one relevant\n\
-for autovectorization. The default implementation does nothing.",
- void,
+for autovectorization. The default implementation adds no modes and\n\
+returns 0.",
+ unsigned int,
(vector_modes *modes, bool all),
default_autovectorize_vector_modes)