+Ofltacc=level

The defined values for level are:

default Allows contractions, such as fused multiply- add (FMA), but disallows any other

floating-point optimization that can result in numerical differences.

limited Like default, but also allows floating-point optimizations which may affect the generation and propagation of infinities, NaNs, and the sign of zero.

relaxed In addition to the optimizations allowed by limited, permits optimizations, such as reordering of expressions, even if parenthesized, that may affect rounding error. This is the same as +Onofltacc.

strict Disallows any floating-point optimization that can result in numerical differences. This is the same as +Ofltacc.

All options except +Ofltacc=strict option allow the compiler to make transformations which are algebraically correct, but which may slightly affect the result of computations due to the inherent imperfection of computer floating-point arithmetic. For many programs, the results obtained with these options are adequately similar to those obtained without the optimization.

For applications in which round-off error has been carefully studied, and the order of computation carefully crafted to control error, these options may be unsatisfactory. To insure the same result as in unoptimized code, use +Ofltacc.

Example:

All the options, except +Ofltacc=strict, allow the compiler to replace a division by a multiplication using the reciprocal. For example, the following code:

for (int j=1;j<5;j++) a[j] = b[j] / x;

is transformed as follows (note that x is invariant in the loop):

x_inv = 1.0/x;

for (int j=1;j<5;j++) a[j] = b[j] * x_inv;

Since multiplication is considerably faster than division, the optimized program runs faster.

+Ofrequently_called

+Ofrequently_called=function1[,function2...]

The named functions are assumed to be frequently called. This option overrides any information in a profile database.

+Ofrequently_called:filename

The file indicated by filename contains a list of functions, separated by spaces or newlines. These functions are assumed to be frequently called. This option overrides any information in a profile database.

+O[no]initcheck

+O[no]initcheck

The initialization checking feature of the optimizer can be on or off:

When on (+Oinitcheck), the optimizer issues warning messages when it discovers uninitialized variables.

When off (+Onoinitcheck), the optimizer does not issue warning messages.

Use +Oinitcheck at optimization level 2 or above. If this option is used together with +check=uninit, uninitialized variables will remain uninitialized so that an error will be reported at runtime and trigger a program abort if the variables are accessed.

Code Optimizing Options 59

Page 59
Image 59
HP C/aC++ for PA-RISC Software manual +Ofrequentlycalled, +Onoinitcheck