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

Performance and optimization
Vectorization
Chapter 6168
Vectorization
When vectorization is enabled, the optimizer replaces eligible loops with calls to specially tuned routines in
the math library. When you compile with the +Ovectorize option, the optimizer vectorizes wherever it
determines that it is safe and feasible to do so. However, you can use directives to limit vectorization. As an
alternative to the optimizers automatic vectorization, you can make explicit calls to the Basic Linear
Algebra Subroutine (BLAS) library to perform common vector and matrix operations.
The following sections describe how to use the vectorizing capabilities of the optimizer.
Using the +Ovectorize option
To enable vectorization, you must compile the program at optimization level 3 or higher and specify the
+Ovectorize option, as in the following example command line:
f90 +O3 +Ovectorize prog.f90
When vectorization is enabled, the optimizer uses a pattern-matching algorithm to identify program loops as
eligible for vectorization. If the optimizer can also determine that:
Vectorization will produce the same results as the original loop
There are no other optimizations that will yield better performance
the optimizer replaces the loop by a call to one of the math library routines listed in Table 6-5.
Table 6-5 Vector routines called by +Ovectorize
Vector routine Description
daxpy Add a scalar multiple of a vector to a vector, using
double-precision operands.
ddot Compute the dot product of two double-precision vectors.
memcpy See the memory(1) man page.
memmove See the memory(1) man page.
memset See the memory(1) man page.
saxpy Add a scalar multiple of a vector to a vector, using
single-precision operands.
sdot Compute the dot product of two single-precision vectors.