Fix reductions for fully-masked loops
authorRichard Sandiford <richard.sandiford@arm.com>
Fri, 25 Oct 2019 08:22:13 +0000 (08:22 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Fri, 25 Oct 2019 08:22:13 +0000 (08:22 +0000)
commit89d0345ad7b8d84045813972ee60557a6b511c57
tree679d68b4d491389b86c0d17c7a69516757266ecd
parentea133b14f48ed5730748a7e02e322fb07ccc2d85
Fix reductions for fully-masked loops

Now that vectorizable_operation vectorises most loop stmts involved
in a reduction, it needs to be aware of reductions in fully-masked loops.
The LOOP_VINFO_CAN_FULLY_MASK_P parts of vectorizable_reduction now only
apply to cases that use vect_transform_reduction.

This new way of doing things is definitely an improvement for SVE though,
since it means we can lift the old restriction of not using fully-masked
loops for reduction chains.

2019-10-25  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* tree-vect-loop.c (vectorizable_reduction): Restrict the
LOOP_VINFO_CAN_FULLY_MASK_P handling to cases that will be
handled by vect_transform_reduction.  Allow fully-masked loops
to be used with reduction chains.
* tree-vect-stmts.c (vectorizable_operation): Handle reduction
operations in fully-masked loops.
(vectorizable_condition): Reject EXTRACT_LAST_REDUCTION
operations in fully-masked loops.

gcc/testsuite/
* gcc.dg/vect/pr65947-1.c: No longer expect doubled dump lines
for FOLD_EXTRACT_LAST reductions.
* gcc.dg/vect/pr65947-2.c: Likewise.
* gcc.dg/vect/pr65947-3.c: Likewise.
* gcc.dg/vect/pr65947-4.c: Likewise.
* gcc.dg/vect/pr65947-5.c: Likewise.
* gcc.dg/vect/pr65947-6.c: Likewise.
* gcc.dg/vect/pr65947-9.c: Likewise.
* gcc.dg/vect/pr65947-10.c: Likewise.
* gcc.dg/vect/pr65947-12.c: Likewise.
* gcc.dg/vect/pr65947-13.c: Likewise.
* gcc.dg/vect/pr65947-14.c: Likewise.
* gcc.dg/vect/pr80631-1.c: Likewise.
* gcc.dg/vect/pr80631-2.c: Likewise.
* gcc.dg/vect/vect-cond-reduc-3.c: Likewise.
* gcc.dg/vect/vect-cond-reduc-4.c: Likewise.

From-SVN: r277438
19 files changed:
gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/vect/pr65947-1.c
gcc/testsuite/gcc.dg/vect/pr65947-10.c
gcc/testsuite/gcc.dg/vect/pr65947-12.c
gcc/testsuite/gcc.dg/vect/pr65947-13.c
gcc/testsuite/gcc.dg/vect/pr65947-14.c
gcc/testsuite/gcc.dg/vect/pr65947-2.c
gcc/testsuite/gcc.dg/vect/pr65947-3.c
gcc/testsuite/gcc.dg/vect/pr65947-4.c
gcc/testsuite/gcc.dg/vect/pr65947-5.c
gcc/testsuite/gcc.dg/vect/pr65947-6.c
gcc/testsuite/gcc.dg/vect/pr65947-9.c
gcc/testsuite/gcc.dg/vect/pr80631-1.c
gcc/testsuite/gcc.dg/vect/pr80631-2.c
gcc/testsuite/gcc.dg/vect/vect-cond-reduc-3.c
gcc/testsuite/gcc.dg/vect/vect-cond-reduc-4.c
gcc/tree-vect-loop.c
gcc/tree-vect-stmts.c