Bug 58135 - [x86] Missed opportunities for partial SLP
Summary: [x86] Missed opportunities for partial SLP
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.9.0
: P3 normal
Target Milestone: ---
Assignee: vekumar
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-12 11:59 UTC by Yuri Rumyantsev
Modified: 2016-05-23 09:59 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2015-12-10 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yuri Rumyantsev 2013-08-12 11:59:55 UTC
If we consider the following simple test-case 

int a[100];
void foo()
{
  a[0] = a[1] = a[2] = a[3] = 0;
}
SLP vectorization of basic block takes place:

gcc -S -O3 -m32  t.c -ftree-vectorizer-verbose=1      
 
t.c:4: note: Vectorized basic-block

but if we add at least one more assignment it won't be vectorized:

a[0] = a[1] = a[2] = a[3] = a[4] = 0;

t11.c:4: note: Build SLP failed: unrolling required in basic block SLP

It is clear that gcc can do partial BB vectorization, i.e. vectorize the first 4 assignments only.
Comment 1 Richard Biener 2015-12-10 13:58:51 UTC
Should be handled via the code we already have for splitting groups into vector-sized pieces.
Comment 2 Richard Biener 2015-12-10 13:59:46 UTC
which would kind-of automagically work if we just delay that "unrolling" check
(that's of course somewhat expensive).

There are more group splitting improvement possibilities.
Comment 3 vekumar 2016-05-23 09:49:26 UTC
Author: vekumar
Date: Mon May 23 09:48:54 2016
New Revision: 236582

URL: https://gcc.gnu.org/viewcvs?rev=236582&root=gcc&view=rev
Log:
Fix PR58135.

2016-05-23  Venkataramanan Kumar  <venkataramanan.kumar@amd.com>

	PR tree-optimization/58135
	* tree-vect-slp.c: When group size is not multiple
	of vector size, allow splitting of store group at
	vector boundary.

2016-05-23  Venkataramanan Kumar  <venkataramanan.kumar@amd.com>

	* gcc.dg/vect/bb-slp-19.c:  Remove XFAIL.
	* gcc.dg/vect/pr58135.c:  Add new.
	* gfortran.dg/pr46519-1.f: Adjust test case.


Added:
    trunk/gcc/testsuite/gcc.dg/vect/pr58135.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/vect/bb-slp-19.c
    trunk/gcc/testsuite/gfortran.dg/pr46519-1.f
    trunk/gcc/tree-vect-slp.c
Comment 4 vekumar 2016-05-23 09:59:48 UTC
Fixed the PR.
ref: https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=236582

2016-05-23  Venkataramanan Kumar  <venkataramanan.kumar@amd.com>

	PR tree-optimization/58135
	* tree-vect-slp.c: When group size is not multiple
	of vector size, allow splitting of store group at
	vector boundary.

2016-05-23  Venkataramanan Kumar  <venkataramanan.kumar@amd.com>

	* gcc.dg/vect/bb-slp-19.c:  Remove XFAIL.
	* gcc.dg/vect/pr58135.c:  Add new.
	* gfortran.dg/pr46519-1.f: Adjust test case