General Compiler Directive: Enables or disables vectorization of a DO loop.
cDEC$ VECTOR ALWAYS
cDEC$ NOVECTOR
c |
Is one of the following: C (or c), !, or *. (See Syntax Rules for Compiler Directives.) |
The VECTOR ALWAYS and NOVECTOR directives override the default behavior of the compiler. The VECTOR ALWAYS directive also overrides efficiency heuristics of the vectorizer, but it only works if the loop can actually be vectorized. You should use the IVDEP directive to ignore assumed dependences.
The directive VECTOR ALWAYS should be used with care. Overriding the efficiency heuristics of the compiler should only be done if you are absolutely sure the vectorization will improve performance.
The compiler normally does not vectorize DO loops that have a large number of non-unit stride references (compared to the number of unit stride references).
In the following example, vectorization would be disabled by default, but the directive overrides this behavior:
!DEC$ VECTOR ALWAYS
do i = 1, 100, 2
! two references with stride 2 follow
a(i) = b(i)
enddo
There may be cases where you want to explicitly avoid vectorization of a loop; for example, if vectorization would result in a performance regression rather than an improvement. In these cases, you can use the NOVECTOR directive to disable vectorization of the loop.
In the following example, vectorization would be performed by default, but the directive overrides this behavior:
!DEC$ NOVECTOR
do i = 1, 100
a(i) = b(i) + c(i)
enddo