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

            Bug ID: 103903
           Summary: Loops handling r,g,b values are not vectorized to use
                    power of 2 vectors even if they can
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hubicka at gcc dot gnu.org
  Target Milestone: ---

This is another textcase comming from Firefox's LightPixel. I am not sure if
this is duplicate, but I think it is quite common in programs dealing with RGB
values.

To match the vectorized code we would need to move from SLP vectorizing the 3
parallel computations to vectorising the loop.

struct a {float r,g,b;};
struct a src[100000], dest[100000];

void
test ()
{
  int i;
  for (i=0;i<100000;i++)
  {
          dest[i].r/=src[i].g;
          dest[i].g/=src[i].g;
          dest[i].b/=src[i].b;
  }
}

is vectorized to do 3 operaitons at a time, while equivalent:

float src[300000], dest[300000];

void
test ()
{
  int i;
  for (i=0;i<300000;i++)
  {
          dest[i]/=src[i];
  }
}

runs faster.

Reply via email to