Allow the number of iterations to be smaller than VF

Programming / Compilers / GCC - rsandifo [138bc75d-0d04-0410-961f-82ee72b054a4] - 13 January 2018 17:59 EST

Fully-masked loops can be profitable even if the iteration count is smaller than the vectorisation factor. In this case we're effectively doing a complete unroll followed by SLP.

The documentation for min-vect-loop-bound says that the default value was 0, but actually the default and minimum were 1. We need it to be 0 for this case since the parameter counts a whole number of vector iterations.

2018-01-13 Richard Sandiford Alan Hayward David Sherwood

gcc/
- doc/sourcebuild.texi (vect_fully_masked): Document.
- params.def (PARAM_MIN_VECT_LOOP_BOUND): Change minimum and default value to 0.
- tree-vect-loop.c (vect_analyze_loop_costing): New function, split out from... (vect_analyze_loop_2): ...here. Don't check the vectorization factor against the number of loop iterations if the loop is fully-masked.

gcc/testsuite/
- lib/target-supports.exp (check_effective_target_vect_fully_masked): New proc.
- gcc.dg/vect/slp-3.c: Expect all loops to be vectorized if
vect_fully_masked.
- gcc.target/aarch64/sve/loop_add_4.c: New test.
- gcc.target/aarch64/sve/loop_add_4_run.c: Likewise.
- gcc.target/aarch64/sve/loop_add_5.c: Likewise.
- gcc.target/aarch64/sve/loop_add_5_run.c: Likewise.
- gcc.target/aarch64/sve/miniloop_1.c: Likewise.
- gcc.target/aarch64/sve/miniloop_2.c: Likewise.

2ea449b3372 Allow the number of iterations to be smaller than VF
gcc/ChangeLog | 13 ++
gcc/doc/sourcebuild.texi | 4 +
gcc/params.def | 2 +-
gcc/testsuite/ChangeLog | 15 ++
gcc/testsuite/gcc.dg/vect/slp-3.c | 6 +-
gcc/testsuite/gcc.target/aarch64/sve/loop_add_4.c | 96 ++++++++++++
.../gcc.target/aarch64/sve/loop_add_4_run.c | 30 ++++
gcc/testsuite/gcc.target/aarch64/sve/loop_add_5.c | 54 +++++++
.../gcc.target/aarch64/sve/loop_add_5_run.c | 5 +
gcc/testsuite/gcc.target/aarch64/sve/miniloop_1.c | 23 +++
gcc/testsuite/gcc.target/aarch64/sve/miniloop_2.c | 7 +
gcc/testsuite/lib/target-supports.exp | 6 +
gcc/tree-vect-loop.c | 174 ++++++++++++---------
13 files changed, 361 insertions(+), 74 deletions(-)

Upstream: gcc.gnu.org


  • Share