Handle more SLP constant and extern definitions for variable VF
authorRichard Sandiford <richard.sandiford@linaro.org>
Sat, 13 Jan 2018 17:58:14 +0000 (17:58 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Sat, 13 Jan 2018 17:58:14 +0000 (17:58 +0000)
commit018b2744fc7a4fe6fea1a078eae69c5465585668
tree33e1fa7adf115a1367ec68d2c663a6bb8aa9b72f
parent3ea518f6f63e66e48f2d41cfa41e1efae653a484
Handle more SLP constant and extern definitions for variable VF

This patch adds support for vectorising SLP definitions that are
constant or external (i.e. from outside the loop) when the vectorisation
factor isn't known at compile time.  It can only handle cases where the
number of SLP statements is a power of 2.

2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
    Alan Hayward  <alan.hayward@arm.com>
    David Sherwood  <david.sherwood@arm.com>

gcc/
* tree-vect-slp.c: Include gimple-fold.h and internal-fn.h
(can_duplicate_and_interleave_p): New function.
(vect_get_and_check_slp_defs): Take the vector of statements
rather than just the current one.  Remove excess parentheses.
Restriction rejectinon of vect_constant_def and vect_external_def
for variable-length vectors to boolean types, or types for which
can_duplicate_and_interleave_p is false.
(vect_build_slp_tree_2): Update call to vect_get_and_check_slp_defs.
(duplicate_and_interleave): New function.
(vect_get_constant_vectors): Use gimple_build_vector for
constant-length vectors and suitable variable-length constant
vectors.  Use duplicate_and_interleave for other variable-length
vectors.  Don't defer the update when inserting new statements.

gcc/testsuite/
* gcc.dg/vect/no-scevccp-slp-30.c: Don't XFAIL for vect_variable_length
&& vect_load_lanes
* gcc.dg/vect/slp-1.c: Likewise.
* gcc.dg/vect/slp-10.c: Likewise.
* gcc.dg/vect/slp-12b.c: Likewise.
* gcc.dg/vect/slp-12c.c: Likewise.
* gcc.dg/vect/slp-17.c: Likewise.
* gcc.dg/vect/slp-19b.c: Likewise.
* gcc.dg/vect/slp-20.c: Likewise.
* gcc.dg/vect/slp-21.c: Likewise.
* gcc.dg/vect/slp-22.c: Likewise.
* gcc.dg/vect/slp-23.c: Likewise.
* gcc.dg/vect/slp-24-big-array.c: Likewise.
* gcc.dg/vect/slp-24.c: Likewise.
* gcc.dg/vect/slp-28.c: Likewise.
* gcc.dg/vect/slp-39.c: Likewise.
* gcc.dg/vect/slp-6.c: Likewise.
* gcc.dg/vect/slp-7.c: Likewise.
* gcc.dg/vect/slp-cond-1.c: Likewise.
* gcc.dg/vect/slp-cond-2-big-array.c: Likewise.
* gcc.dg/vect/slp-cond-2.c: Likewise.
* gcc.dg/vect/slp-multitypes-1.c: Likewise.
* gcc.dg/vect/slp-multitypes-8.c: Likewise.
* gcc.dg/vect/slp-multitypes-9.c: Likewise.
* gcc.dg/vect/slp-multitypes-10.c: Likewise.
* gcc.dg/vect/slp-multitypes-12.c: Likewise.
* gcc.dg/vect/slp-perm-6.c: Likewise.
* gcc.dg/vect/slp-widen-mult-half.c: Likewise.
* gcc.dg/vect/vect-live-slp-1.c: Likewise.
* gcc.dg/vect/vect-live-slp-2.c: Likewise.
* gcc.dg/vect/pr33953.c: Don't XFAIL for vect_variable_length.
* gcc.dg/vect/slp-12a.c: Likewise.
* gcc.dg/vect/slp-14.c: Likewise.
* gcc.dg/vect/slp-15.c: Likewise.
* gcc.dg/vect/slp-multitypes-2.c: Likewise.
* gcc.dg/vect/slp-multitypes-4.c: Likewise.
* gcc.dg/vect/slp-multitypes-5.c: Likewise.
* gcc.target/aarch64/sve/slp_1.c: New test.
* gcc.target/aarch64/sve/slp_1_run.c: Likewise.
* gcc.target/aarch64/sve/slp_2.c: Likewise.
* gcc.target/aarch64/sve/slp_2_run.c: Likewise.
* gcc.target/aarch64/sve/slp_3.c: Likewise.
* gcc.target/aarch64/sve/slp_3_run.c: Likewise.
* gcc.target/aarch64/sve/slp_4.c: Likewise.
* gcc.target/aarch64/sve/slp_4_run.c: Likewise.

Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r256622
47 files changed:
gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/vect/no-scevccp-slp-30.c
gcc/testsuite/gcc.dg/vect/pr33953.c
gcc/testsuite/gcc.dg/vect/slp-1.c
gcc/testsuite/gcc.dg/vect/slp-10.c
gcc/testsuite/gcc.dg/vect/slp-12a.c
gcc/testsuite/gcc.dg/vect/slp-12b.c
gcc/testsuite/gcc.dg/vect/slp-12c.c
gcc/testsuite/gcc.dg/vect/slp-14.c
gcc/testsuite/gcc.dg/vect/slp-15.c
gcc/testsuite/gcc.dg/vect/slp-17.c
gcc/testsuite/gcc.dg/vect/slp-19b.c
gcc/testsuite/gcc.dg/vect/slp-20.c
gcc/testsuite/gcc.dg/vect/slp-21.c
gcc/testsuite/gcc.dg/vect/slp-22.c
gcc/testsuite/gcc.dg/vect/slp-23.c
gcc/testsuite/gcc.dg/vect/slp-24-big-array.c
gcc/testsuite/gcc.dg/vect/slp-24.c
gcc/testsuite/gcc.dg/vect/slp-28.c
gcc/testsuite/gcc.dg/vect/slp-39.c
gcc/testsuite/gcc.dg/vect/slp-6.c
gcc/testsuite/gcc.dg/vect/slp-7.c
gcc/testsuite/gcc.dg/vect/slp-cond-1.c
gcc/testsuite/gcc.dg/vect/slp-cond-2-big-array.c
gcc/testsuite/gcc.dg/vect/slp-cond-2.c
gcc/testsuite/gcc.dg/vect/slp-multitypes-1.c
gcc/testsuite/gcc.dg/vect/slp-multitypes-10.c
gcc/testsuite/gcc.dg/vect/slp-multitypes-12.c
gcc/testsuite/gcc.dg/vect/slp-multitypes-2.c
gcc/testsuite/gcc.dg/vect/slp-multitypes-4.c
gcc/testsuite/gcc.dg/vect/slp-multitypes-5.c
gcc/testsuite/gcc.dg/vect/slp-multitypes-8.c
gcc/testsuite/gcc.dg/vect/slp-multitypes-9.c
gcc/testsuite/gcc.dg/vect/slp-perm-6.c
gcc/testsuite/gcc.dg/vect/slp-widen-mult-half.c
gcc/testsuite/gcc.dg/vect/vect-live-slp-1.c
gcc/testsuite/gcc.dg/vect/vect-live-slp-2.c
gcc/testsuite/gcc.target/aarch64/sve/slp_1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/slp_1_run.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/slp_2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/slp_2_run.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/slp_3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/slp_3_run.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/slp_4.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/slp_4_run.c [new file with mode: 0644]
gcc/tree-vect-slp.c