Intel® Fortran Compiler 16.0 User and Reference Guide
General Compiler Directive: Provides heuristic information to the compiler optimizer.
!DIR$ ASSUME (scalar-Boolean-expression)
scalar-Boolean-expression |
Is any expression that evaluates to .TRUE. or .FALSE. at run-time. |
The scalar-Boolean-expression is presumed to be true and may be used by the optimizer to generate better code.
If the check assume option is specified and scalar-Boolean-expression does not evaluate to .TRUE. at run-time, an error message is displayed and execution is aborted.
In the example below, the compiler is told that A is aligned on a 32-byte boundary using the ASSUME_ALIGNED directive. The ASSUME directive says that the length of the first dimension of A is a multiple of 8. Therefore the optimizer knows that A(I,J+1) and A(I,J-1) are 0 mod 64 bytes away from A(I,J) and are therefore also aligned on 32-byte boundaries. This information helps the optimizer in generating efficiently vectorized code for these loops.
SUBROUTINE F (A, NX,NY,I1,I2,J1,J2) REAL (8) :: A (NX,NY) !DIR$ ASSUME_ALIGNED A:32 !DIR$ ASSUME (MOD(NX,8) .EQ. 0) ! ensure that the first array access in the loop is aligned !DIR$ ASSUME (MOD(I1,8) .EQ. 1) DO J=J1,J2 DO I=I1,I2 A(I,J) = A(I,J) + A(I,J+1) + A(I,J-1) ENDDO ENDDO END SUBROUTINE F