Allow inner-loop reductions with variable-length vectors
commit331fbb0db9ffebfe7ac9ebee5ba26d826828ec7e
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 9 Aug 2018 16:03:25 +0000 (9 16:03 +0000)
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 9 Aug 2018 16:03:25 +0000 (9 16:03 +0000)
tree30024b7111392033a7f7ca3969997417773fc6fd
parentff7410b8445c19b7c4a84f0ec06d72af4263d37d
Allow inner-loop reductions with variable-length vectors

While working on PR 86871, I noticed we were being overly restrictive
when handling variable-length vectors.  For:

  for (i : ...)
    {
      res = ...;
      for (j : ...)
        res op= ...;
      a[i] = res;
    }

we don't need a reduction operation (although we do for double
reductions like:

  res = ...;
  for (i : ...)
    for (j : ...)
      res op= ...;
  a[i] = res;

which must still be rejected).

2018-08-08  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* tree-vect-loop.c (vectorizable_reduction): Allow inner-loop
reductions for variable-length vectors.

gcc/testsuite/
* gcc.target/aarch64/sve/reduc_8.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@263451 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/aarch64/sve/reduc_8.c [new file with mode: 0644]
gcc/tree-vect-loop.c