Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 11/07/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

CODE_ALIGN

General Compiler Directive: Specifies the byte alignment for a loop.

!DIR$ CODE_ALIGN [:n]

n

(Optional) A positive integer constant expression indicating the number of bytes for the minimum alignment boundary. Its value must be a power of 2 between 1 and 4096, such as 1, 2, 4, 8, 16, 32, 64, 128, and so on.

If you specify 1 for n, no alignment is performed. If you do not specify n, the default alignment is 16 bytes.

This directive must precede the loop or block of code to be aligned.

If code is compiled with the -falign-loops=m (Linux*) or /Qalign-loops:m (Windows*) option and a “CODE_ALIGN:n” directive precedes a loop, the loop is aligned on a MAX (m, n) byte boundary.

If a procedure has the “CODE_ALIGN:k” attribute and a “CODE_ALIGN:n” directive precedes a loop, then both the procedure and the loop are aligned on a MAX (k, n) byte boundary.

Example

Consider the following code fragment in file test_code_align.f90:

!DIR$ CODE_ALIGN
DO J = 1, N
…
END DO

Compiling test_code_align.f90 aligns the code that begins the DO J loop on a (default) 16-byte boundary. If you do not specify the CODE_ALIGN directive, the alignment of the loop is implementation-dependent and may change from compilation to compilation.