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.