7.140 --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, and might enable optimizations when compiling with other options, such as -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.
#include <dspfns.h>
int f(short *a, short *b)
    int i;
    int r = 0;
    for (i = 0; i < 100; i++)
    return r;
Non-ConfidentialPDF file icon PDF versionARM DUI0375F
Copyright © 2007, 2008, 2011, 2012, 2014 ARM. All rights reserved.