Performance Comparison between single-float and double

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User17897
Level 2
Level 2
I tested the computation performances for float and double on TriCore297, I obtained a strange result, they are so similar.
I let TC297 run dotproduct for float and double, and the length of vector are both 128, executed for 1000 times.
Then, I caculate cycle-count through IfxCpu_resetAndStartCounters and IfxCpu_stopCounters.
At last, I found their performance(cycle count) are very similar!
TC297 just have single-float co-operator, so, the single-float's compuation should be faster than double's computation.
It is so strange, Why?
Is there any one would tell me the reason?
0 Likes
4 Replies
User13290
Level 5
Level 5
First like received First solution authored

Hi Shaquille,

Did you look at the disassembly (tricore-objdump) to see if the disassembly for doubles indeed utilises the FPU, or if perhaps it still makes calls (for currently unknown reasons) to floating point libraries instead. Mind you, you write that the results are almost identical, which suggests that the project settings are effective, but perhaps with less change than you expected.

Best regards,

Henk-Piet Glas

Principal Technical Specialist
Embedded Software

0 Likes
User17897
Level 2
Level 2
My mistake, I forgot to turn off the option -fshort_double
Their difference is obvious after I removing this option
0 Likes
User13290
Level 5
Level 5
First like received First solution authored

Cheers Shaquille,

Thanks for letting us know. Happy developing.

Best regards,

Henk-Piet Glas

Principal Technical Specialist
Embedded Software

0 Likes
User18504
Level 3
Level 3
Could you share your result for floating point and double?
0 Likes