[Mesa-dev] [PATCH 12/12] mesa: remove INV_SQRTF() macro

Brian Paul brianp at vmware.com
Tue Feb 24 09:46:58 PST 2015


On 02/24/2015 10:37 AM, Roland Scheidegger wrote:
> The comment in INV_SQRTF sort of makes it sound like optimizing it might
> be worthwile.
> x86 sse has a very fast rsqrt function, though you'd need to be able to
> guarantee you can live with crappy precision (10 bits or so and IIRC in
> particular the biggest issue with it was that rsqrt(1.0) != 1.0... - I
> guess wouldn't have been a problem for Quake...).
> div, sqrt is quite a problematic instruction sequence in fact, on modern
> cpus these will use the unpipelined divison unit with really high
> latency for both instructions so a single rsqrt ought to be like 20
> times faster.
> However, since apparently noone tried to implement an optimized
> INV_SQRTF version, getting rid of it seems the right thing to do.

That was my thinking too.

-Brian



More information about the mesa-dev mailing list