[FRIAM] Q_rsqrt() vs 1/sqrt()

uǝlƃ ↙↙↙ gepropella at gmail.com
Fri Jan 8 17:49:17 EST 2021


Would out-of-order execution produce the same out-of-order order over, say, 10 executions?

The clock() results between GCC and TCC are similar. But the ASM looks fairly different. I'm still not seeing rsqrt or sqrt instructions even after specifying short floats throughout and using sqrtf(), with or without -O0, for whatever that's worth. But the speed of the 1/sqrtf() increased quite a bit from 1/sqrt().

gepr at cormac:~/lang/c$ ./gcc.out 
1/sqrt() took 0.076633 s
Q_rsqrt() took 0.473007 s

gepr at cormac:~/lang/c$ ./tcc.out 
1/sqrt() took 0.078259 s
Q_rsqrt() took 0.46164 s

On 1/8/21 8:46 AM, Stephen Taylor wrote:
> 	Because the hardware environment has changed, and the tradeoffs on integer and floating-point arithmetic are different. (Like it says in the Wikipedia article.)  Out of order execution might be messing up your measurements, too.

-- 
↙↙↙ uǝlƃ



More information about the Friam mailing list