This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F28377D: --fp_mode "relaxed" meaning?

Part Number: TMS320F28377D

Hi there,

I have noticed that when I set --fp_mode to relaxed in the optimization settings, the code inside the interrupt executes much faster.

Could you please briefly explain the meaning of setting --fp_mode to "relaxed" rather than to "strict". Is there any issue or risk associated with setting --fp_mode to "relaxed"?

Thank you very much,

Leo

  • Hi Leandro,

    From section 2.3.3 of the C Compiler guide:

    "Relaxed floating-point mode causes double-precision floating-point computations and storage to be converted to integers where possible. This behavior does not conform with ISO, but it results in faster code, with some loss in accuracy. The following specific changes occur in relaxed
    mode:
    • Division by a constant is converted to inverse multiplication.
    • Certain C standard float functions--such as sqrt, sin, cos, atan, and
    atan2--are redirected to optimized inline functions where possible.
    • If the --tmu_support option is used to enable support for the
    Trigonometric Math Unit (TMU) and relaxed floating-point mode is
    enabled, RTS library calls are replaced with the corresponding TMU
    hardware instructions for the following floating-point operations:
    floating point division, sqrt, sin, cos, atan, and atan2. Note that
    there are algorithmic differences between the TMU hardware
    instructions and the library routines, so the results of operations
    may differ slightly."

    You can download the guide here:
    http://www.ti.com/lit/ug/spru514n/spru514n.pdf

    If you are using the "FastRTS" library you need to compile in relaxed mode. Again, this can speed up your code.

    Regards,

    Richard

  • Thank you Richard for the very comprehensive answer. It is very clear now.

    Cheers

    Leo