https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71992

            Bug ID: 71992
           Summary: Missed BB SLP vectorization in GCC
           Product: gcc
           Version: tree-ssa
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vekumar at gcc dot gnu.org
  Target Milestone: ---

The below test case fails to vectorize.
gcc version 7.0.0 20160724 (experimental) (GCC)

gcc -Ofast -mavx -fvect-cost-model=unlimited slp.c -S -fdump-tree-slp-all

struct st
{
        double x;
        double y;
        double z;
        double p;
        double q;
}*obj;

double a,b,c;

void slp_test()
{

        obj->x = a*a+3.0;
        obj->y= b*b+c;
        obj->z= a+b*3.0;
        obj->p= a+b*3.0;
        obj->q =a+b+c;

}

LLVM is able to SLP vectorize looks like it is creating vector of [a,c]  and
[b*3.0,b*b] and does vector add.

GCC is not SLP vectorizing.  Group slitting also not working. I expected it to
get split and vectorize these statements.

  obj->z= a+b*3.0;
  obj->p= a+b*3.0;

Another case 

struct st
{
        double x;
        double y;
        double z;
        double p;
        double q;
}*obj;

double a,b,c;

void slp_test()
{

        obj->x = a*b;
        obj->y= b+c;
        obj->z= a+b*3.0;
        obj->p= a+b*3.0;
        obj->q =a+b+c;

}


LLVM forms vector [b*3.0,a+b] [a,c] and does vector addition.

Reply via email to