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.

RTOS/EVMK2G: DSPLIB function for fmaxf, fminf

Part Number: EVMK2G

Tool/software: TI-RTOS

Hi,

I am working with the EVMK2G eval board, and trying to make some optimizations to our DSP code to use vectorized operations in hopes that it will take advantage of the SIMD operations on the DSP chip.

Do you have any suggestions for optimal ways of calling fmaxf or fminf for an entire array. For example, I have code like this:

for (i = 0; i < arrayLength; ++i) {
	newArray[i] = fmaxf(0.0f, array[i]);
	newArray[i] = fminf(127.0f, array[i]);
}

Hoping there is a function like the math functions in DSPLIB that would help me out.

Thanks a lot for your help!

Andrew

  • Hi Andrew,

    Can you share which SDK version are you using?

    Best Regards,
    Yordan
  • Hi Yordan, thanks for getting back so quickly.

    We are using the latest processor SDK for RTOS that is here, version v04.02:

    www.ti.com/.../processor-sdk-k2g

  • Andrew,

    Refer to TMS320C6000 Optimizing Compiler v8.2.x User's Guide Literature Number: SPRUI04B that is part of the C6000 Compiler guide for all C Intrinsic code that the C6000 compiler supports. While there are some min and max operations that are supported by the architecture, the floating point min and max operation is not supported in the Intrinsics.

    My recommendation would be to refer to the Application notes "Introduction to C6000 Optimization" that is provided here:
    www.ti.com/.../sprabf2.pdf

    This describes the compiler setting and loop modification techniques that will help with software pipeling of the loop. The other thing to try is to define the fmax and fminf function to be inline functions. There are several arithmetic, logarithmic and trignometric functions that we provide in the MATHLIB 3.0.1.1 that is part of the SDK where you can refer to see how these functions can be inlined and vectorized similar to those functions.

    Regards,
    Rahul