fsqrt

Benjamin Herrenschmidt benh at kernel.crashing.org
Fri Jun 7 22:14:05 EST 2013


On Fri, 2013-06-07 at 11:48 +0100, David Laight wrote:
> > For those interested, this is the Quake3 sqrt from Carmack ...
> there's
> > plenty of literature about it one or two google clicks away :-)
> 
> I guess that is a rough enough approximation for graphics.
> 
> However it will be miscompiled unless i and y are put in a union.

It won't in the kernel disables strict aliasing :-)

Anyway, that was just a hack and plenty enough to get anaconda going,
the bloody thing only uses fsqrt because it's python crappola does
something like exp(1.0) / sqrt(2.0) as part of its random number stuff.

Honestly I could have made it just return 1.0 and it would probably have
worked :-)

However, my point remains, it would be very much worthwhile for the
kernel to have some reasonable emulation of those missing instructions
(afaik only a handful) like we have for isel, popcnt* etc... especially
since distros seem to be keen on enabling the use of them in their
toolchain.

I don't personally have the bandwidth to do a clean implementation (that
handles FP exceptions, NaNs, FPSCR, etc...) but I believe it would be
valuable if somebody else did (hint hint hint :-) since without this,
Fedora ppc64 is basically going to be a non-started on those chips.

BTW. Did you guys (ie. FSL) finally add fsqrt to e6500 or it's still
out ? 

Cheers,
Ben.




More information about the Linuxppc-dev mailing list