BD at Rivenhill
BD at Rivenhill

Reputation: 12963

What is the cost of converting 32-bit integer to double for Intel and AMD architecture?

I'm under the impression that conversions back and forth between these two representations are not expensive operations on modern hardware, is this true?

Upvotes: 2

Views: 139

Answers (1)

gbjbaanb
gbjbaanb

Reputation: 52679

Intel says that it can be rather expensive (on a Pentium 4 with Visual C++ 6), but using Intels' VTune performance analyser, you can turn the heavy, slow, _ftol call with a single FISTP FPU instruction for a 5x performance gain.

Then they say that enabling SSE2 instructions will give you an 11x performance gain, but I hear that has a high latency penatly. There's further speed up for using SSE3.

So, I'm not sure what the performance is like nowadays, although I think SSE2 is enabled by default in VC++, I'm pretty sure it is in GCC.

Upvotes: 1

Related Questions