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.

TMS320F28069: CGT C2000 does not replace sqrt of literal at compile time

Part Number: TMS320F28069

Hello CGT C2000 support team,

I noticed that the compiler does not optimize the following at compile time:

sqrt(2)

Instead, the generated assembly shows that an actual runtime call to sqrt is made.

I guess that this behavior fundamentally makes sense, as sqrt() is just a function call, and the compiler cannot really be expected to know what a function will return.

However, it seems that it would make sense for the compiler to recognize certain standard math functions, and to evaluate constant expressions.

After all, it does recognize sqrt, sin, cos, atan and atan2 in the context of utilizing the TMU.

Are there any configurations that can be made to also enable the compiler to optimize constant expressions using those functions?

Thank you in advance,

Beat