I vaguely remember having seen somewhere that conversion between integers and floats is slow, so I was curious...
Intel(R) Celeron(R) M CPU 420 @ 1.60GHz (SSE3)
117 cycles for 100*cvtsd2si
97 cycles for 100*cvtsi2sd
One cycle on my good ol' slow Celeron...
hi jj,
the results varies on my i5 (a bit too strongly for my taste).
Intel(R) Core(TM) i5 CPU M 520 @ 2.40GHz (SSE4)
82 cycles for 100*cvtsd2si
140 cycles for 100*cvtsi2sd
85 cycles for 100*cvtsd2si
143 cycles for 100*cvtsi2sd
...
108 cycles for 100*cvtsd2si
129 cycles for 100*cvtsi2sd
88 cycles for 100*cvtsd2si
94 cycles for 100*cvtsi2sd
...
79 cycles for 100*cvtsd2si
118 cycles for 100*cvtsi2sd
83 cycles for 100*cvtsd2si
116 cycles for 100*cvtsi2sd
...
113 cycles for 100*cvtsd2si
81 cycles for 100*cvtsi2sd
85 cycles for 100*cvtsd2si
82 cycles for 100*cvtsi2sd
you may need to change the repetitions and also convert more then one value.
Quote from: qWord on June 11, 2011, 12:57:52 AM
a bit too strongly for my taste
You have never owned a P4, it seems :green2
Still, it's roughly one cycle, or a bit less on your CPU. Not bad for such a conversion.
Intel(R) Pentium(R) 4 CPU 3.20GHz (SSE3)
606 cycles for 100*cvtsd2si
1312 cycles for 100*cvtsi2sd
695 cycles for 100*cvtsd2si
701 cycles for 100*cvtsi2sd