On 11/22/2017 11:09 AM, Richard Sandiford wrote: > Richard Sandiford <richard.sandif...@linaro.org> writes: >> 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. > > Here's an updated version that applies on top of the recent removal > of REDUC_*_EXPR. > > Thanks, > Richard > > > 2017-11-22 Richard Sandiford <richard.sandif...@linaro.org> > Alan Hayward <alan.hayw...@arm.com> > David Sherwood <david.sherw...@arm.com> > > gcc/ > * tree.h (build_index_vector): Declare. > * tree.c (build_index_vector): New function. > * tree-vect-loop.c (get_initial_def_for_reduction): Treat the number > of units as polynomial, forcibly converting it to a constant if > vectorizable_reduction has already enforced the condition. > (get_initial_defs_for_reduction): Likewise. > (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. I assume you'll work with Richi to address any conflicts with his patch to allow the target to specify a preferred mode for final reductions using shifts or extractions.
OK. jeff