HP Fortran Programmer's Guide (B3908-90031; September 2011)

Performance and optimization
Vectorization
Chapter 6 169
If your PA2.0 application uses very large arrays, compiling with both +Ovectorize and
+Odataprefetch may also increase performance. The math library contains special prefetching versions
of the vector routines that are called if you specify both options.
If you compile with the +Ovectorize and +Oinfo options, the optimizer will identify which loops it
vectorized. If you find that the extent of vectorization is not significant, you may want to consider some
other optimization, such as parallelization.
Controlling vectorization locally
When you compile with the +Ovectorize option, the optimizer considers all loops in the source file as
candidates for vectorization. The *$* [NO]VECTORIZE directive enables you to limit vectorization. You
use the *$* NOVECTORIZE form of the directive to disable vectorization and the *$* VECTORIZE form to
enable it. The directive applies to the beginning of the next loop and remains in effect for the rest of the
program unit or until superseded by a later directive. The directive is ignored if you do not compile with the
+Ovectorize option and specify an optimization of 3 or higher.
For example, if a file containing the following code segment were compiled with +Ovectorize, only one
loop would be considered as a candidate for vectorization:
! This is line 1 of the source file.
!*$* NOVECTORIZE
.
.
.
!*$* VECTORIZE
DO i = 1, 100
.
.
.
END DO
!*$* NOVECTORIZE
.
.
.
vec_damax Find the maximum absolute value in a double-precision
vector.
vec_dmult_add Multiply a scalar by a vector and add the result to the
result vector, using double-precision operands.
vec_dsum Sum the elements of a double-precision vector.
Table 6-5 Vector routines called by +Ovectorize (Continued)
Vector routine Description