You copied the Doc URL to your clipboard.

--reassociate_saturation, --no_reassociate_saturation

Enables and disables more aggressive optimization in loops that use saturating arithmetic.


Saturating addition is not associative. That is, (x+y)+z might not be equal to x+(y+z). For example, with a saturating maximum of 50, (40+20)-10 = 40 while 40+(20-10) = 50.

Some compiler optimizations rely on associativity, using re-association to rearrange expressions into a more efficient sequence.

The --no_reassociate_saturation option prohibits re-association of saturating addition, and therefore limits the level of optimization on saturating arithmetic.

The --reassociate_saturation option instructs the compiler to re-associate saturating additions, enabling the following optimizations:

  • Vectorization of saturating arithmetic when compiling with --vectorize.
  • Other optimizations might be performed when compiling without --vectorize, for example with -O3 -Otime.


Saturating addition is not associative, so enabling --reassociate_saturation could affect the result with a reduction in accuracy.


The default is --no_reassociate_saturation.


The following code contains the function L_mac, which performs saturating additions. Therefore the compiler does not vectorize this code unless --reassociate_saturation and --vectorize are specified.

#include <dspfns.h>
int f(short *a, short *b)
    int i;
    int r = 0;
    for (i = 0; i < 100; i++)
    return r;
Was this page helpful? Yes No