AnsweredAssumed Answered

powf() function in Redlib using double precision instructions

Question asked by Stefano Pietrosanti on May 1, 2019
Latest reply on May 3, 2019 by Stefano Pietrosanti



I'm working on an LPC4357 with MCUXpresso v10.2.1, using Redlib and the single precision floating point unit.


The code I'm working on makes extensive use of powf(), but unfortunately it is causing problems because the current implementation of this function uses double precision instructions, e.g.:


1a00b4ce:   bl      0x1a00be70 <__aeabi_f2d>
1a00b4d2:   add     r3, pc, #484    ; (adr r3, 0x1a00b6b8 <powf+648>)
1a00b4d4:   ldrd    r2, r3, [r3]
1a00b4d8:   mov     r7, r1
1a00b4da:   mov     r6, r0
1a00b4dc:   bl      0x1a00bdbc <__aeabi_dcmple>


This means that the computation doesn't go through the FPU, creating unacceptable delays.


I can't switch to Newlib easily as the system is already in production.

Does anyone know of any fix or workaround?