Next: , Previous: Pragma Loop_Invariant, Up: Implementation Defined Pragmas


2.100 Pragma Loop_Optimize

Syntax:

    pragma Loop_Optimize (OPTIMIZATION_HINT {, OPTIMIZATION_HINT});
    
    OPTIMIZATION_HINT ::= Ivdep | No_Unroll | Unroll | No_Vector | Vector

This pragma must appear immediately within a loop statement. It allows the programmer to specify optimization hints for the enclosing loop. The hints are not mutually exclusive and can be freely mixed, but not all combinations will yield a sensible outcome.

There are five supported optimization hints for a loop:

These hints do not remove the need to pass the appropriate switches to the compiler in order to enable the relevant optimizations, that is to say `-funroll-loops' for unrolling and `-ftree-vectorize' for vectorization.