aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-data-refs.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2016-07-06 08:14:41 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2016-07-06 08:14:41 +0000
commit4fb8ba9d357297206678a3e3eacf9292148eafb5 (patch)
treebec6504ded7b6f968d307ecd48cfc8553e087464 /gcc/tree-vect-data-refs.c
parent134c85caeba541ff4fb4377fb12729073cbdfe41 (diff)
downloadgcc-4fb8ba9d357297206678a3e3eacf9292148eafb5.zip
gcc-4fb8ba9d357297206678a3e3eacf9292148eafb5.tar.gz
gcc-4fb8ba9d357297206678a3e3eacf9292148eafb5.tar.bz2
[5/7] Move the fix for PR65518
This patch moves the fix for PR65518 to the code that checks whether load-and-permute operations are supported. If the group size is greater than the vectorisation factor, it would still be possible to fall back to elementwise loads (as for strided groups) rather than fail vectorisation entirely. Tested on aarch64-linux-gnu and x86_64-linux-gnu. gcc/ * tree-vectorizer.h (vect_grouped_load_supported): Add a single_element_p parameter. * tree-vect-data-refs.c (vect_grouped_load_supported): Likewise. Check the PR65518 case here rather than in vectorizable_load. * tree-vect-loop.c (vect_analyze_loop_2): Update call accordignly. * tree-vect-stmts.c (vectorizable_load): Likewise. From-SVN: r238037
Diffstat (limited to 'gcc/tree-vect-data-refs.c')
-rw-r--r--gcc/tree-vect-data-refs.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c
index 71155c9..f2f0dc5 100644
--- a/gcc/tree-vect-data-refs.c
+++ b/gcc/tree-vect-data-refs.c
@@ -5144,14 +5144,31 @@ vect_setup_realignment (gimple *stmt, gimple_stmt_iterator *gsi,
/* Function vect_grouped_load_supported.
- Returns TRUE if even and odd permutations are supported,
- and FALSE otherwise. */
+ COUNT is the size of the load group (the number of statements plus the
+ number of gaps). SINGLE_ELEMENT_P is true if there is actually
+ only one statement, with a gap of COUNT - 1.
+
+ Returns true if a suitable permute exists. */
bool
-vect_grouped_load_supported (tree vectype, unsigned HOST_WIDE_INT count)
+vect_grouped_load_supported (tree vectype, bool single_element_p,
+ unsigned HOST_WIDE_INT count)
{
machine_mode mode = TYPE_MODE (vectype);
+ /* If this is single-element interleaving with an element distance
+ that leaves unused vector loads around punt - we at least create
+ very sub-optimal code in that case (and blow up memory,
+ see PR65518). */
+ if (single_element_p && count > TYPE_VECTOR_SUBPARTS (vectype))
+ {
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "single-element interleaving not supported "
+ "for not adjacent vector loads\n");
+ return false;
+ }
+
/* vect_permute_load_chain requires the group size to be equal to 3 or
be a power of two. */
if (count != 3 && exact_log2 (count) == -1)