General Compiler Directive: Overrides default heuristics for vectorization of DO loops. It can also affect certain optimizations.
!DIR$ VECTOR [clause[[,] clause]...]
!DIR$ NOVECTOR
clause |
Is an optional vectorization or optimizer clause. It can be one or more of the following:
|
The VECTOR and NOVECTOR directives control vectorization of the DO loop that directly follows the directive.
If the MASK_READWRITE clause is specified, the compiler generates masked loads and stores within all conditional branches in the loop. If the NOMASK_READWRITE clause is specified, the compiler generates unmasked loads and stores for increased performance.
The VECTOR directive 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.
Optimization Notice |
---|
Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice. Notice revision #20110804 |
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:
!DIR$ 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:
!DIR$ NOVECTOR
do i = 1, 100
a(i) = b(i) + c(i)
enddo