Pragma equivalent
#pragma options [no]strict
#pragma
option_override (function_name, "opt (suboption_list)")
Purpose
Ensures that optimizations done by default
at the -O3 and higher optimization
levels, and, optionally
at -O2, do not alter the semantics of a
program.
This option is intended
for situations where the changes in program execution in optimized
programs produce different results from unoptimized programs.
Syntax
>>- -q--+-nostrict------------------------------------+--------><
'-strict--+---------------------------------+-'
| .- :-----------------------. |
| V | |
'-=----+-all------------------+-+-'
+-none-----------------+
+-precision------------+
+-noprecision----------+
+-exceptions-----------+
+-noexceptions---------+
+-ieeefp---------------+
+-noieeefp-------------+
+-nans-----------------+
+-nonans---------------+
+-infinities-----------+
+-noinfinities---------+
+-subnormals-----------+
+-nosubnormals---------+
+-zerosigns------------+
+-nozerosigns----------+
+-operationprecision---+
+-nooperationprecision-+
+-vectorprecision------+
+-novectorprecision----+
+-order----------------+
+-noorder--------------+
+-association----------+
+-noassociation--------+
+-reductionorder-------+
+-noreductionorder-----+
+-guards---------------+
+-noguards-------------+
+-library--------------+
'-nolibrary------------'
Defaults
- -qstrict or -qstrict=all is the default when the -qnoopt or -O0 optimization
level is in effect
- -qstrict or -qstrict=all is the default when the -O2 or -O optimization
level is in effect
- -qnostrict or -qstrict=none is the default when
the -O3 or higher optimization
level is in effect
Parameters
The -qstrict suboptions
include the following:
- all | none
- all disables all semantics-changing transformations, including
those controlled by the ieeefp, order, library, precision, and exceptions suboptions. none enables
these transformations.
- precision | noprecision
- precision disables all transformations that are likely
to affect floating-point precision, including those controlled by
the subnormals, operationprecision, vectorprecision, association, reductionorder,
and library suboptions. noprecision enables these transformations.
- exceptions | noexceptions
- exceptions disables all transformations likely to affect
exceptions or be affected by them, including those controlled by the nans, infinities, subnormals, guards, and library suboptions. noexceptions enables
these transformations.
- ieeefp | noieeefp
- ieeefp disables transformations that affect IEEE floating-point
compliance, including those controlled by the nans, infinities, subnormals, zerosigns, vectorprecision,
and operationprecision suboptions. noieeefp enables
these transformations.
- nans | nonans
- nans disables transformations that may produce incorrect
results in the presence of, or that may incorrectly produce IEEE floating-point
NaN (not-a-number) values. nonans enables these transformations.
- infinities | noinfinities
- infinities disables transformations that may produce incorrect
results in the presence of, or that may incorrectly produce floating-point
infinities. noinfinities enables these transformations.
- subnormals | nosubnormals
- subnormals disables transformations that may produce incorrect
results in the presence of, or that may incorrectly produce IEEE floating-point
subnormals (formerly known as denorms). nosubnormals enables
these transformations.
- zerosigns | nozerosigns
- zerosigns disables transformations that may affect or be
affected by whether the sign of a floating-point zero is correct. nozerosigns enables
these transformations.
- operationprecision | nooperationprecision
- operationprecision disables transformations that produce
approximate results for individual floating-point operations. nooperationprecision enables
these transformations.
- vectorprecision | novectorprecision
- vectorprecision disables vectorization in loops
where it might produce different results in vectorized iterations
than in nonvectorized residue iterations. vectorprecision ensures
that every loop iteration of identical floating-point operations on
identical data produces identical results.
novectorprecision enables
vectorization even when different iterations might produce different
results from the same inputs.
- order | noorder
- order disables all code reordering between multiple operations
that may affect results or exceptions, including those controlled
by the association, reductionorder, and guards suboptions. noorder enables
code reordering.
- association | noassociation
- association disables reordering operations within an expression. noassociation enables
reordering operations.
- reductionorder | noreductionorder
- reductionorder disables parallelizing floating-point reductions. noreductionorder enables
parallelizing these reductions.
- guards | noguards
- guards disables moving operations past guards (that is,
past if,
out of loops, or past function calls that might end
the program or throw
an exception) which control whether the operation should be executed. noguards enables
moving operations past guards.
- library | nolibrary
- library disables transformations that affect floating-point
library functions; for example, transformations that replace floating-point
library functions with other library functions or with constants. nolibrary enables
these transformations.
Usage
The all, precision, exceptions, ieeefp,
and order suboptions and their negative forms are group suboptions
that affect multiple, individual suboptions. For many situations,
the group suboptions will give sufficient granular control over transformations.
Group suboptions act as if either the positive or the no form of every
suboption of the group is specified. Where necessary, individual
suboptions within a group (like subnormals or operationprecision within
the precision group) provide control of specific transformations
within that group.
With
-qnostrict or
-qstrict=none in
effect, the following optimizations are turned on:
- Code that may cause an exception may be rearranged. The corresponding
exception might happen at a different point in execution or might
not occur at all. (The compiler still tries to minimize such situations.)
- Floating-point operations may not preserve the sign of a zero
value. (To make certain that this sign is preserved, you also need
to specify -qfloat=rrm, -qfloat=nomaf,
or -qfloat=strictnmaf.)
- Floating-point expressions may be reassociated. For example, (2.0*3.1)*4.2 might
become 2.0*(3.1*4.2) if that is faster,
even though the result might not be identical.
- The fltint and rsqrt suboptions
of the -qfloat option are turned on. You
can turn them off again by also using the -qstrict option
or the nofltint and norsqrt suboptions
of -qfloat. With lower-level or no optimization
specified, these suboptions are turned off by default.
Specifying various suboptions of
-qstrict[=suboptions] or
-qnostrict combinations
sets the following suboptions:
- -qstrict or -qstrict=all sets -qfloat=nofltint:norsqrt:rngchk. -qnostrict or -qstrict=none sets -qfloat=fltint:rsqrt:norngchk.
- -qstrict=operationprecision or -qstrict=exceptions sets -qfloat=nofltint.
Specifying both -qstrict=nooperationprecision and -qstrict=noexceptions sets -qfloat=fltint.
- -qstrict=infinities, -qstrict=operationprecision,
or -qstrict=exceptions sets -qfloat=norsqrt.
- -qstrict=noinfinities:nooperationprecision:noexceptions sets -qfloat=rsqrt.
- -qstrict=nans, -qstrict=infinities, -qstrict=zerosigns,
or -qstrict=exceptions sets -qfloat=rngchk. Specifying
all of -qstrict=nonans:nozerosigns:noexceptions or -qstrict=noinfinities:nozerosigns:noexceptions,
or any group suboptions that imply all of them, sets -qfloat=norngchk.
Note: For details about the relationship between
-qstrict suboptions
and their
-qfloat counterparts, see
-qfloat.
To
override any of these settings, specify the appropriate -qfloat suboptions
after the -qstrict option on the command line.
Examples
To compile
myprogram.c so
that the aggressive optimization of
-O3 are turned off,
range checking is turned off (-qfloat=fltint), and
division by the result of a square root is replaced by multiplying
by the reciprocal (
-qfloat=rsqrt), enter:
xlc myprogram.c -O3 -qstrict -qfloat=fltint:rsqrt
To enable all
transformations except those affecting precision, specify:
xlc myprogram.c -qstrict=none:precision
To
disable all transformations except those involving
NaNs and
infinities, specify:
xlc myprogram.c -qstrict=all:nonans:noinfinities