2019-01-22 05:05 AM
Hello,
I have the following basic code calls every 20msec.
double test = 2.80009;
TESTA11_ON;
for (i=0; i < 500; i++)
{
test *= test;
}
TESTA11_OFF;
When I compile and link with or without the FPU I always have the same processing time and current consumption.
Here below are the two Truestudio configurations:
With FPU set in Assembler, Compiler and Linker target:
Without FPU set in Assembler, Compiler and Linker target:
What am I wrong?
Why does these options have no effect?
How can I force the FPU usage?
Best regards
Mich
2019-01-22 05:11 AM
Hi there,
Your first message used double which would require soft libraries, but then you changed to float...
In case it is really a float, maybe the code is being trashed because you are not doing something useful with the variable test, and the compiler is optimizing too much...
Could you give us more info on the compiler options ?
Edit: you seem to have changed back to double. The FPU on L4 is single precision only, aka float, not double. If you change the variable to float do you still see the issue. In any case, a look at the disassembly would tell you immediately if instructions with starting with the letter V are present.
2019-01-22 05:51 AM
The M4 FPU supports only double transfer instructions, but no double operation at all.
Use only float, and compare the timings.
BTW, "2.80009" is a double constant, not a float constant. Changing only the variable type will nonetheless involve a double->float conversion.
2019-01-22 05:59 AM
You are fully right.
No difference between with or without FPU on double variable.
Improvement x12 with FPU compared to without on float variable.