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.

Compiler/TMS320C6657: Loops not pipelined due to containing calls to math library functions

Part Number: TMS320C6657
Other Parts Discussed in Thread: MATHLIB

Tool/software: TI C/C++ Compiler

I have many loops in my code that are disqualified for pipelining due to containing calls to functions in math.h, such as sin(), cos(), sqrt(), pow(), etc.

Is there anything I can do for these loops to be pipelined?

Here is an example of a loop that is disqualified:

for (k = 0; k < AEC_FFT_SIZE_2+1; k++)
{
     arg = factor*k;
     cfr_fft[k] = (float) cos(arg);
}

 I would really appreciate any advice.

  • Negin said:
    Is there anything I can do for these loops to be pipelined?

    Unfortunately, no.

    One solution to consider is inlining the function.  But that only works for smaller functions that have little to no control flow (if, else, loops, etc.) .  That is not the case for the math functions like cos.

    Thanks and regards,

    -George

  • How much accuracy do you need? You might consider making your own in-lineable function with a lookup table and interpolation.

  • Hello!

    When your loop is merely computing cosine, as was already suggested one may develop his own pipelineble approximation. Alternatively, MATHLIB is equipped with vectored trigonometric functions, they just suit your example code.

    Hope this helps.