HP Fortran Programmer Guide (766160-001, March 2014)

C$DIR IVDEP
Rules and behavior:
The IVDEPdirective is an assertion to the compiler’s optimizer about the order of memory
references inside a DOloop.
The IVDEPdirective tells the compiler to begin dependence analysis by assuming all
dependences occur in the same forward direction as their appearance in the normal scalar
execution order. This contrasts with normal compiler behavior, which is for the dependence
analysis to make no initial assumptions about the direction of a dependence.
The IVDEPdirective must precede the DOstatement for each DOloop it affects. No source code
lines, other than the following.
The IVDEPdirective is applied to a DOloop in which the user knows that dependences are
in lexical order. For example, if two memory references in the loop touch the same memory
location and one of them modifies the memory location, then the first reference to touch the
location has to be the one that appears earlier lexically in the program source code. This
assumes that the right-hand side of an assignment statement is earlier than the left-hand side.
The IVDEPdirective informs the compiler that the program would behave correctly if the
statements were executed in certain orders other than the sequential execution order, such
as executing the first statement or block to completion of all iterations, then the next statement
or block for all iterations, and so forth. The optimizer can use this information, along with
whatever else it can prove about the dependences, to choose other execution orders.
Example 3 EXAMPLE:
In the following example, the IVDEP directive provides more information about the
dependences within the loop, which may enable loop transformations to occur:
C$DIR IVDEP
DO I+1, N
A(INDARR(I)) = A(INDARR(I)) + B(I)
END DO
In this case, the scalar execution order follows:
Retrieve INDARR(I)
Use the result from Step 1 to retrieve A(INDARR(I));
Retrieve B(I);
Add the results from Steps 2 and 3 ;
Store the results from Step 4 into the location indicated by A(INDARR(I))from Step1.
IVDEPdirects the compiler to initially assume that when Steps 1 and 5 access a common
memory location, Step 1 always accesses the location first because Step 1 occurs earlier in
the execution sequence. This approach lets the compiler reorder instructions, as long as it
chooses an instruction schedule that maintains the relative order of the array references.
Relaxes the natural data type rules for alignment.+allow_unaligned
+asm compiles the named programs and leaves the assembler-language output in
corresponding files whose names have the extension. The assembler-language output produced
+[no]asm
by this option is not supported as input to the assembler. The default is +noasm. The -Soption
can be used to perform the same function as +asm.
+autodblincreases the default size of integer, logical, and real items to 8 bytes; see Table
2-3. It also increases the default size of double precision and complex items to 16 bytes.
This option does not increase the size of the following:
+[no]autodbl
Items of character type
Items declared with the BYTEstatement
Items declared with the DOUBLE COMPLEXstatement
Explicitly sized items
For example, the following are unaffected by +autodbl:
INTEGER(KIND=4)
INTEGER(4) J
REAL*8 D
22 Compiling and linking