Product Version: Intel(R) Visual Fortran Compiler XE 15.0.0.070
Cause:
The vectorization report generated when using Visual Fortran Compiler's flags and optimization options
( -O2 -fpe:0 -Qopt-report:2 ) states that loop was not vectorized due to Floating-Point exception handling .
Example:
An example below will generate the following remark in optimization report:
subroutine foo (a, l, n) implicit none integer, intent(in) :: n double precision, intent(inout) :: a(n) integer :: l(n) integer :: i do i=1,n l(i) = mod(a(i), 1.0) end do end subroutine foo
Report from: Loop nest, Vector & Auto-parallelization optimizations [loop, vec, par]
LOOP BEGIN f15537.f90(8,8)
remark #15537: loop was not vectorized: implied FP exception model prevents usage of SVML library needed for truncation or integer divide/remainder. Consider changing compiler flags and/or directives in the source to enable fast FP model and to mask FP exceptions
LOOP END
Resolution:
Masking FP exceptions -fpe:1 and setting a threshold for the vectorization of loops to 0 -Qvec-threshold:0 will get the loop vectorized:
LOOP BEGIN f15537.f90(8,8) remark #15300: LOOP WAS VECTORIZED LOOP END
See also:
Requirements for Vectorizable Loops
Vectorization and Optimization Reports