Intel® Fortran Compiler 17.0 Developer Guide and Reference
General Compiler Directives: FMA tells the compiler to allow generation of fused multiply-add (FMA) instructions, also known as floating-point contractions. NOFMA disables the generation of FMA instructions.
!DIR$ FMA
!DIR$ NOFMA
These directives affect the current program unit but they also apply to subsequent program units in the source file, unless and until a program unit containing another FMA or NOFMA directive is encountered.
Once a NOFMA directive has been specified, it is in effect from that point forward. The setting impacts later routines in the source file. For example, consider that the following are in the same source file:
real function fms_mul2( a, b, c, d)
implicit none
real :: a, b, c, d
! the default !dir$ fma leads to fma generation:
! this is transformed into FMS(a,b,FMA(c,d,0))
!dir$ nofma
fms_mul2 = a*b - c*d ! no fma generation here
end function fms_mul2
real function fms_mul( a, b, c, d)
implicit none
real :: a, b, c, d
fms_mul = (a*b) - (c*d) ! no fma generation here
end function fms_mul
The NOFMA directive specified in fms_mul2 will also impact the routine fms_mul. You must explicitly specify the FMA directive to override the effect of the NOFMA directive.