Avoid unnecessary peeling for gaps with LD3
authorRichard Sandiford <richard.sandiford@arm.com>
Tue, 24 May 2016 10:15:36 +0000 (10:15 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Tue, 24 May 2016 10:15:36 +0000 (10:15 +0000)
commitd3465d72bacd65663da8f8b4977f2936a799c3cd
tree15d92b71f80740174fee4dd8fb61fd75530eaef4
parent836dbb1a27f3e793ad32723aeb6630237887e6d5
Avoid unnecessary peeling for gaps with LD3

vectorizable_load forces peeling for gaps if the vectorisation factor
is not a multiple of the group size, since in that case we'd normally load
beyond the original scalar accesses but drop the excess elements as part
of a following permute:

          if (loop_vinfo
              && ! STMT_VINFO_STRIDED_P (stmt_info)
              && (GROUP_GAP (vinfo_for_stmt (first_stmt)) != 0
                  || (!slp && vf % GROUP_SIZE (vinfo_for_stmt (first_stmt)) != 0)))

This isn't necessary for LOAD_LANES though, since it loads only the
data needed and does the permute itself.

Tested on aarch64-linux-gnu and x86_64-linux-gnu.

gcc/
* tree-vect-stmts.c (vectorizable_load): Reorder checks so that
load_lanes/grouped_load classification comes first.  Don't check
whether the vectorization factor is a multiple of the group size
for load_lanes.

gcc/testsuite/
* gcc.dg/vect/vect-load-lanes-peeling-1.c: New test.

From-SVN: r236632
gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/vect/vect-load-lanes-peeling-1.c [new file with mode: 0644]
gcc/tree-vect-stmts.c