diff options
author | Richard Sandiford <richard.sandiford@linaro.org> | 2017-09-14 16:30:54 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2017-09-14 16:30:54 +0000 |
commit | ca09abcb399bcb8cddbda68c75e702cc8989a6ca (patch) | |
tree | 3ba3014d56b97b588ffff4dc42c54a581319a315 /gcc/tree-vect-loop.c | |
parent | e8f142e28262a5048c6f40f4bfb6a612d3da55f0 (diff) | |
download | gcc-ca09abcb399bcb8cddbda68c75e702cc8989a6ca.zip gcc-ca09abcb399bcb8cddbda68c75e702cc8989a6ca.tar.gz gcc-ca09abcb399bcb8cddbda68c75e702cc8989a6ca.tar.bz2 |
Add a vect_worthwhile_without_simd_p helper routine
The vectoriser sometimes considers lowering "vector" operations into N
scalar word operations. This N needs to be fixed at compile time, so
the condition guarding it needs to change when variable-lengh vectors
are added. This patch puts the condition into a helper routine so that
there's only one place to update.
2017-09-14 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
gcc/
* tree-vectorizer.h (vect_min_worthwhile_factor): Delete.
(vect_worthwhile_without_simd_p): Declare.
* tree-vect-loop.c (vect_worthwhile_without_simd_p): New function.
(vectorizable_reduction): Use it.
* tree-vect-stmts.c (vectorizable_shift): Likewise.
(vectorizable_operation): Likewise.
Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r252765
Diffstat (limited to 'gcc/tree-vect-loop.c')
-rw-r--r-- | gcc/tree-vect-loop.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index af73013..f0eafc5 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -6030,8 +6030,7 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi, dump_printf (MSG_NOTE, "op not supported by target.\n"); if (GET_MODE_SIZE (vec_mode) != UNITS_PER_WORD - || LOOP_VINFO_VECT_FACTOR (loop_vinfo) - < vect_min_worthwhile_factor (code)) + || !vect_worthwhile_without_simd_p (loop_vinfo, code)) return false; if (dump_enabled_p ()) @@ -6040,8 +6039,7 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi, /* Worthwhile without SIMD support? */ if (!VECTOR_MODE_P (TYPE_MODE (vectype_in)) - && LOOP_VINFO_VECT_FACTOR (loop_vinfo) - < vect_min_worthwhile_factor (code)) + && !vect_worthwhile_without_simd_p (loop_vinfo, code)) { if (dump_enabled_p ()) dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, @@ -6492,6 +6490,18 @@ vect_min_worthwhile_factor (enum tree_code code) } } +/* Return true if VINFO indicates we are doing loop vectorization and if + it is worth decomposing CODE operations into scalar operations for + that loop's vectorization factor. */ + +bool +vect_worthwhile_without_simd_p (vec_info *vinfo, tree_code code) +{ + loop_vec_info loop_vinfo = dyn_cast <loop_vec_info> (vinfo); + return (loop_vinfo + && (LOOP_VINFO_VECT_FACTOR (loop_vinfo) + >= vect_min_worthwhile_factor (code))); +} /* Function vectorizable_induction |