Tool/software: TI C/C++ Compiler
I am using the TI C6000 compiler 8.2.2 to perform some benchmarking of function. I have a function for ramp generator that is defined as shown here:
void RG_FXN(RAMPGEN rg) { /* Compute the angle rate */ rg.Angle += uIQmpy(rg.StepAngleMax,rg.Freq); /* Saturate the angle rate within (-1,1) */ if (rg.Angle>_IQ(1.0)) rg.Angle -= _IQ(1.0); else if (rg.Angle<_IQ(-1.0)) rg.Angle += _IQ(1.0); rg.Out=rg.Angle; return; }
If I compiler this with the following compiler setting of -O3, the output of the function is BNOP.S2 B3, 5 . Could you explain why the compiler shows this behavior.
Additional data point, if I build the code with O1, then the compiler generates the assembly code as shown here:
I would like to confirm that this is the expected behavior ? and if there is some way to avoid the compiler from optimizing the function out of the code in this manner.
Regards,
Rahul