Vectorizer fails to handle this: ----------------------------------------------------- extern "C" double sqrt(double);
#define NUMPOINTS 50000 static float points[NUMPOINTS][4]; static float opoints[NUMPOINTS][4]; static bool flags[NUMPOINTS]; void NormalizeVectors (void) { int i, r; float s, x, y, z; static float d = 0.0; d += 0.2; if (d > 4) d = 0.0; for (r=0; r<4; r++) { for (i=0; i<NUMPOINTS; i++) { x = points[i][0]; y = points[i][1]; z = points[i][2]; s = x * x + y * y + z * z; s = d / sqrt (s); opoints[i][0] = x * s; opoints[i][1] = y * s; opoints[i][2] = z * s; flags[i] = true; } } } ----------------------------------------------------- loop at bench.cc:79: not vectorized: unhandled data ref: d.0_36 = d loop at bench.cc:79: bad data references. This is a bit more complex than the other two I posted, I guess. Anyway, the first problem seems related to the static variable. -- Summary: vectorizer failed for vector normalization Product: gcc Version: 4.0.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: enhancement Priority: P2 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: giovannibajo at libero dot it CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18439