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.

CLA Optimization

Other Parts Discussed in Thread: CONTROLSUITE

I'm working with the CLA on a piccolo 28069. The calculations involve calling CLAsin and CLAcos. When compiling with any optimization level other than off, the sin's and cos's are not calculated correctly. Stepping through the assembly appeared to reveal that the compiler was trying to store a variable in MR3, and was not aware that CLAsin and cos were using MR3 and not restoring it. I am using compiler version 6.1.0. It would be nice if this optimization bug could be fixed, however, is there a way for me to enable optimization globally for the non-CLA portion of the program and turn it off for just the CLA code?

  • Hi Lee,

    Are you using CLAmath v300 or v400??. In the v400 functions MR3 is saved on entry to the function and restored on exit.

    If you are using v400 and MR3 is not being saved can you post the optimized disassembly; I can run that by the compiler guys to see whats going on.

  • Thanks, for the help and pointing me in the right direction. I am using v400. It turned out that the precompiled library was not up to date. I recompiled v400, since the source was provided, and it included the save MR3 feature. So everything is working now.

  • Hello Vishal,

    I have been using the CLA for the past year with the v400 CLAMath library. But I had been unable to set optimization to anything other than 0, while using cos and sin functions too. I had recently updated the control suite and after finding this thread online, I set CLA optimization to Local, and it seems to work fine.

    Is it now certain that the CLA C compiler will be entirely alright when optimization settings are used? Just to double check, could you let me know the version of libraries in which this error is not fixed, and the latest one? (I couldnt find the errata on the site).

    Thanks,

    Anandhi

  • Hi Anandhi,

    Anandhi Ramesh said:
    Is it now certain that the CLA C compiler will be entirely alright when optimization settings are used? Just to double check, could you let me know the version of libraries in which this error is not fixed, and the latest one? (I couldnt find the errata on the site).

    The sin and cosine routines themselves are assembly and will save/restore MR3 on entry/exit. I think the .lib got corrupted in some of the earlier controlSUITE releases. The current releases (v400) should have a working .lib. 

    I am releasing v4.00.01.00 in a few days - we are currently doing final reviews and tests.

  • Thanks Vishal. I had installed control suite 3.2.4 but it did not have the updated lib. So I also compiled the CLAMath standard and fpu32 libraries and now my code works fine for sin and cos calls.

    anandhi