aboutsummaryrefslogtreecommitdiff
path: root/gcc/config
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/config
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/config')
-rw-r--r--gcc/config/aarch64/aarch64.c4
-rw-r--r--gcc/config/arc/arc.c3
-rw-r--r--gcc/config/arm/arm.c5
-rw-r--r--gcc/config/i386/i386.c4
-rw-r--r--gcc/config/mips/mips.c3
5 files changed, 13 insertions, 6 deletions
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index ec0643d..e2251a2 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -15935,7 +15935,7 @@ aarch64_preferred_simd_mode (scalar_mode mode)
/* Return a list of possible vector sizes for the vectorizer
to iterate over. */
-static void
+static unsigned int
aarch64_autovectorize_vector_modes (vector_modes *modes, bool)
{
if (TARGET_SVE)
@@ -15961,6 +15961,8 @@ aarch64_autovectorize_vector_modes (vector_modes *modes, bool)
TODO: We could similarly support limited forms of V2QImode and V2HImode
for this case. */
modes->safe_push (V2SImode);
+
+ return 0;
}
/* Implement TARGET_MANGLE_TYPE. */
diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
index f48f102..115500e 100644
--- a/gcc/config/arc/arc.c
+++ b/gcc/config/arc/arc.c
@@ -609,7 +609,7 @@ arc_preferred_simd_mode (scalar_mode mode)
/* Implements target hook
TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_MODES. */
-static void
+static unsigned int
arc_autovectorize_vector_modes (vector_modes *modes, bool)
{
if (TARGET_PLUS_QMACW)
@@ -617,6 +617,7 @@ arc_autovectorize_vector_modes (vector_modes *modes, bool)
modes->quick_push (V4HImode);
modes->quick_push (V2HImode);
}
+ return 0;
}
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 70a20f7..1fd30c23 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -288,7 +288,7 @@ static bool arm_builtin_support_vector_misalignment (machine_mode mode,
static void arm_conditional_register_usage (void);
static enum flt_eval_method arm_excess_precision (enum excess_precision_type);
static reg_class_t arm_preferred_rename_class (reg_class_t rclass);
-static void arm_autovectorize_vector_modes (vector_modes *, bool);
+static unsigned int arm_autovectorize_vector_modes (vector_modes *, bool);
static int arm_default_branch_cost (bool, bool);
static int arm_cortex_a5_branch_cost (bool, bool);
static int arm_cortex_m_branch_cost (bool, bool);
@@ -29015,7 +29015,7 @@ arm_vector_alignment (const_tree type)
return align;
}
-static void
+static unsigned int
arm_autovectorize_vector_modes (vector_modes *modes, bool)
{
if (!TARGET_NEON_VECTORIZE_DOUBLE)
@@ -29023,6 +29023,7 @@ arm_autovectorize_vector_modes (vector_modes *modes, bool)
modes->safe_push (V16QImode);
modes->safe_push (V8QImode);
}
+ return 0;
}
static bool
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index c406be3..bb5dc14 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -21384,7 +21384,7 @@ ix86_preferred_simd_mode (scalar_mode mode)
vectors. If AVX512F is enabled then try vectorizing with 512bit,
256bit and 128bit vectors. */
-static void
+static unsigned int
ix86_autovectorize_vector_modes (vector_modes *modes, bool all)
{
if (TARGET_AVX512F && !TARGET_PREFER_AVX256)
@@ -21414,6 +21414,8 @@ ix86_autovectorize_vector_modes (vector_modes *modes, bool all)
if (TARGET_MMX_WITH_SSE)
modes->safe_push (V8QImode);
+
+ return 0;
}
/* Implemenation of targetm.vectorize.get_mask_mode. */
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 30017e3..6341216 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -13455,11 +13455,12 @@ mips_preferred_simd_mode (scalar_mode mode)
/* Implement TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_MODES. */
-static void
+static unsigned int
mips_autovectorize_vector_modes (vector_modes *modes, bool)
{
if (ISA_HAS_MSA)
modes->safe_push (V16QImode);
+ return 0;
}
/* Implement TARGET_INIT_LIBFUNCS. */