# falign-loops, Qalign-loops

Aligns loops to a power-of-two byte boundary. This feature is only available for ifort.

## Syntax

Linux: | -falign-loops[=n] -fno-align-loops

macOS: | -falign-loops[=n] -fno-align-loops

Windows: | /Qalign-loops[:n] /Qalign-loops-

## Arguments

n | Is the optional number of bytes for the minimum alignment boundary. It 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; this is the same as specifying the negative form of the option. If you do not specify n, the default alignment is 16 bytes.

## Default

-fno-align-loops or /Qalign-loops- | No special loop alignment is performed.

## Description

This option aligns loops to a power-of-two boundary. This alignment may improve performance.

It can be affected by the directives CODE_ALIGN and ATTRIBUTES CODE_ALIGN.

If code is compiled with the -falign-loops=m (Linux* and macOS) 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.

## IDE Equivalent

None

## Alternate Options

None

## Example

Consider the following code fragment in file `test_align_loops.f90`:

    DO J = 1, N
    …
    END DO

Compiling `test_align_loops.f90` with the -falign-loops (Linux and macOS) or /Qalign-loops (Windows) compiler option aligns the code that begins the DO J loop on a (default) 16-byte boundary. If you do not specify this compiler option, the alignment of the loop is implementation-dependent and may change from compilation to compilation.

Parent topic: Data Options

## See Also

falign-functions, Qfnalign compiler option
CODE_ALIGN directive
ATTRIBUTES CODE_ALIGN directive