STDC FENV_ACCESS Pragma

#pragma STDC FENV_ACCESS ON

#pragma STDC FENV_ACCESS OFF

This pragma provides a means to inform the compiler when a program might access the floating-point environment to test flags or run under non-default modes. Use of the pragma allows certain optimizations that could subvert flag tests and mode changes such as global common sub expression elimination, code motion, and constant folding.

The pragma can be placed either outside external declarations or preceding all explicit declarations and statements inside a compound statement. When outside external declarations, the pragma takes effect from its occurrence until another FENV_ACCESS pragma is encountered or until the end of the translation unit. When inside a compound statement, the pragma is in effect from its occurrence until another FENV_ACCESS pragma is encountered within the nested compound statement or until the end of the compound statement. At the end of a compound statement, the state for the pragma is restored to its condition just before the compound statement.

If the pragma is used in any other context, the behavior is undefined. If part of a program tests flags or runs under non-default mode settings but was translated with the state for the FENV_ACCESS pragma off, then the behavior of the program is undefined.

Also see the ISO/IEC 9899 Standard.

UNROLL_FACTOR Pragma

#pragma UNROLL_FACTORn #pragma UNROLLn #pragma UNROLL (n)

This block-scoped pragma applies the unroll factor for a loop containing the current block. You can apply an unroll factor that you think is best for the given loop or apply no unroll factor to the loop. If this pragma is not specified, the compiler uses its own heuristics to determine the best unroll factor for the inner loop.

A user specified unroll factor will override the default unroll factor applied by the compiler.

Specifying n=1 will prevent the compiler from unrolling the loop.

Specifying n=0 allows the compiler to use its own heuristics to apply the unroll factor.

Note that this option has no effect on loop unroll-and-jam.

NOTE: UNROLL_FACTOR pragma will be ignored if it is placed in a loop other than the innermost loop. The UNROLL pragma must be immediately followed with a loop statement and will be ignored if it is not an innermost loop.

OMP ATOMIC Pragma

#pragma omp atomic expression-stmt

where expression-stmtmust have one of the following forms:

x binop = expr

x++

++x

x--

--x

Here, x is an lvalue expression with scalar type and expr is an expression with scalar type that does not reference the object designated by x.

110 Pragma Directives and Attributes

Page 110
Image 110
HP C/aC++ for PA-RISC Software manual Stdc Fenvaccess Pragma, Unrollfactor Pragma, OMP Atomic Pragma