Don't use permutes for single-element accesses (PR83753)
commit877e9e7026e52454e6f86fa2c6e52dae8e9894f8
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 10 Jan 2018 13:07:54 +0000 (10 13:07 +0000)
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 10 Jan 2018 13:07:54 +0000 (10 13:07 +0000)
tree62ede51cd79130de6eb2ad0e1b0127c441143c2b
parent5f071124fd1e38fe27251489974d1f33cadfaaf9
Don't use permutes for single-element accesses (PR83753)

After cunrolling the inner loop, the remaining loop in the testcase
has a single 32-bit access and a group of 64-bit accesses.  We first
try to vectorise at 128 bits (VF 4), but decide not to for cost reasons.
We then try with 64 bits (VF 2) instead.  This means that the group
of 64-bit accesses uses a single-element vector, which is deliberately
supported as of r251538.  We then try to create "permutes" for these
single-element vectors and fall foul of:

      for (i = 0; i < 6; i++)
sel[i] += exact_div (nelt, 2);

in vect_grouped_store_supported, since nelt==1.

Maybe we shouldn't even be trying to vectorise statements in the
single-element case, and instead just copy the scalar statement
for each member of the group.  But until then, this patch treats
non-strided grouped accesses as VMAT_CONTIGUOUS if no permutation
is necessary.

2018-01-10  Richard Sandiford  <richard.sandiford@linaro.org>

gcc/
PR tree-optimization/83753
* tree-vect-stmts.c (get_group_load_store_type): Use VMAT_CONTIGUOUS
for non-strided grouped accesses if the number of elements is 1.

gcc/testsuite/
PR tree-optimization/83753
* gcc.dg/torture/pr83753.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@256427 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr83753.c [new file with mode: 0644]
gcc/tree-vect-stmts.c