Cause:
This vectorization diagnostic is emitted starting from 15.0 compiler. Re-association on floating point computation can alter the resulting value. Under precise floating point model, such reassociation is disallowed. Vector (or parallel) reduction, by nature, involves re-association. In this example, the for loop does a reduction operation. The compiler doesn't vectorize this loop when -fp-model precise is used since vectorization will change the order of operation.
Examples:
double foo(double *a, int N){ double x = 0; int i; for (i=0;i<N;i++){ x += a[i]; } return x; }
$ icpc test32.cc -c -qopt-report2 -fp-model precise -qopt-report-phase=vec -qopt-report-file=stderr
Begin optimization report for: foo(double *, int)
Report from: Vector optimizations [vec]
LOOP BEGIN at test32.cc(4,3)
remark #25460: No loop optimizations reported
remark #15331: loop was not vectorized: precise FP model implied by the command line or a directive prevents vectorization. Consider using fast FP model [ test32.cc(5,5) ]
LOOP END
LOOP BEGIN at test32.cc(4,3)
<Remainder>
LOOP END
<Remainder>
LOOP END
Resolution:
This loop can be vectorized using the compiler oprtion -fp-model fast instead of -fp-model precise.