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

            Bug ID: 61403
           Summary: An opportunity for x86 gcc vectorizer (~40% gain)
           Product: gcc
           Version: 4.10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: evstupac at gmail dot com

Test normalizing 3D coordinates failed to vectorize

#include <math.h> 

struct XYZ 
{ 
  float x; 
  float y; 
  float z; 
}; 

void 
norm (struct XYZ *in, struct XYZ *out, int size) 
{ 
  int i; 
  for (i = 0; i < size; ++i) 
    { 
      float n = sqrt(in[i].x * in[i].x + in[i].y * in[i].y + in[i].z *
in[i].z); 
      out[i].x = in[i].x / n;
      out[i].y = in[i].y / n;
      out[i].z = in[i].z / n;
    } 
} 

gcc norm.c -Ofast -S -mssse3 -fdump-tree-vect-details

norm.c:14:3: note: type of def: 3. 
norm.c:14:3: note: no array mode for V4SF[3] 
norm.c:14:3: note: the size of the group of accesses is not a power of 2
norm.c:14:3: note: not vectorized: relevant stmt not supported: _19->x = _20;

Vectorization should give ~40% gain on x86

Reply via email to