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.

MSP430FR6043: poor iqmathlib performance with TI compiler too?

Part Number: MSP430FR6043

Related to poor-iqmathlib-performance-with-gcc.

We tried the exact same IQmath test project with the TI compiler. Surprising result is that it’s 5.5 to 5.8 times faster! Also good news is that the IQmathLib.a links fine (doesn’t give any warnings like with GCC) and also the project works fine for bigger array test sizes (with GCC it was getting stuck at array size bigger than 247?).

But the disappointing result is the IQmath performance when compared to normal float operations: with TI-compiler is still quite similar, only 324ms vs 370ms!

Are we missing any needed configuration to improve its speed, or is it so that the IQmath lib doesn’t work well on MSP430FR6043?

Thank you,

Daniel

 

The test TI-project is attached (and the GCC too for reference).

test_TI.zip2248.test_GCC.zip

  • As per David finding floats were still used in the math test which hindered the timing measurement. After correction the new timings with TI-compiler are 0.16s vs 0.37s:

    The code corrected with David's suggestion is:

    // IQ20: range -2048 ... +2047.999999046, resolution 0.000000954
    static _iq20 xm[TEST_SIZE];
    static void math_test(void)
    {
        _iq20 f1 = _IQ20(2.103f);
        _iq20 f2 = _IQ20(1.135f);
        xm[0] = _IQ20(1.0f);
        for (uint16_t i = 2; i <= TEST_SIZE; i++) {
            if (xm[i - 2U] > _IQ20(1.0f)) {
                xm[i - 1U] = _IQ20div((_IQ20mpy(f1, _IQ20(i + 1U)) + _IQ20mpy(f2, _IQ20(i - 1U))), xm[i - 2U]);
            } else {
                xm[i - 1U] = _IQ20mpy((_IQ20mpy(f1, _IQ20(i + 1U)) + _IQ20mpy(f2, _IQ20(i - 1U))), xm[i - 2U]);
            }
        }
    }

**Attention** This is a public forum