This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/64031] New: Vectorization of max/min is not robust enough


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

            Bug ID: 64031
           Summary: Vectorization of max/min is not robust enough
           Product: gcc
           Version: 4.9.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jacques-henri.jourdan at inria dot Fr

The following code is sucessfully vectorized (using the minps instruction):

const int SIZE = 1<<15;

void test9(float * b)
{
  unsigned i;

  float *y =__builtin_assume_aligned(b, 16);

  for (i = 0; i < SIZE; i++)
  {
    float f = y[i];
    float f2 = f < f*f ? f : f*f;
    y[i] = f2;
  }
}

But not the following slightly modified version:

void test9(float * b)
{
  unsigned i;

  float *y =__builtin_assume_aligned(b, 16);

  for (i = 0; i < SIZE; i++)
  {
    float f = y[i];
    float f2 = f < f*f ? f : f*f;
    y[i] = f2*f2;
  }
}

Actually, it seems like vectorization of max/min operations fails as soon as
some computation is done with the result of this min/max operation.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]