5 ms·
It's an FPU instruction with some setup and teardown instructions associated. I usually bow to Agner Fog on this: "On Core2 65nm, FSQRT takes 9 to 69 cc's (wi
by nibnib 11y ago
It's an FPU instruction with some setup and teardown instructions associated.
I usually bow to Agner Fog on this:
"On Core2 65nm, FSQRT takes 9 to 69 cc's (with almost equal reciprocal throughput), depending on the value and precision bits. For comparison, FDIV takes 9 to 38 cc's (with almost equal reciprocal throughput), FMUL takes 5 (recipthroughput = 2) and FADD takes 3 (recipthroughput = 1). SSE performance is about equal, but looks faster because it can't do 80bit math. SSE has a super fast approximate reciprocal and approximate reciprocal sqrt though.
On Core2 45nm, division and square root got faster; FSQRT takes 6 to 20 cc's, FDIV takes 6 to 21 cc's, FADD and FMUL haven't changed. Once again SSE performance is about the same."
- uxcn 11y agox87 is largely deprecated. Try inspecting the code emitted for floating point by all the major compilers.
- nibnib 11y agoYou are correct. It looks like SSE sqrt matches or beats fsqrt too.
- uxcn 11y agoSSE performance is better than x87, for a number of reasons. Latency and throughput are generally better, but SSE also supports SIMD which allows more than one op per instruction. SSE also has more registers (x87 only has 8 80bit compared to at least 16 128bit). If I'm not mistaken, the number of available execution units with SSE is also larger, which means more opportunities for instruction level parallelism. These are why modern compilers don't emit x87 for floating point.