poly_int: vectorizable_reduction
authorRichard Sandiford <richard.sandiford@linaro.org>
Wed, 3 Jan 2018 07:15:47 +0000 (07:15 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Wed, 3 Jan 2018 07:15:47 +0000 (07:15 +0000)
commite54dd6d3a791536543d4769aa09508b89d882f37
treedb4448d26a9b2471ac93890a2efe92185d049fe5
parent9031b367ac87550552318f6516487c70f3ce9a99
poly_int: vectorizable_reduction

This patch makes vectorizable_reduction cope with variable-length vectors.
We can handle the simple case of an inner loop reduction for which
the target has native support for the epilogue operation.  For now we
punt on other cases, but patches after the main SVE submission allow
SLP and double reductions too.

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

gcc/
* tree.h (build_index_vector): Declare.
* tree.c (build_index_vector): New function.
* tree-vect-loop.c (get_initial_defs_for_reduction): Treat the number
of units as polynomial, forcibly converting it to a constant if
vectorizable_reduction has already enforced the condition.
(vect_create_epilog_for_reduction): Likewise.  Use build_index_vector
to create a {1,2,3,...} vector.
(vectorizable_reduction): Treat the number of units as polynomial.
Choose vectype_in based on the largest scalar element size rather
than the smallest number of units.  Enforce the restrictions
relied on above.

Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r256133
gcc/ChangeLog
gcc/tree-vect-loop.c
gcc/tree.c
gcc/tree.h