From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 6BBB32C007E for ; Fri, 7 Jun 2013 22:14:19 +1000 (EST) Message-ID: <1370607245.3766.386.camel@pasglop> Subject: Re: fsqrt From: Benjamin Herrenschmidt To: David Laight Date: Fri, 07 Jun 2013 22:14:05 +1000 In-Reply-To: References: <1368679657.9603.32.camel@pasglop> <1368683156.9603.34.camel@pasglop> <6A3DF150A5B70D4F9B66A25E3F7C888D0701C307@039-SN2MPN1-012.039d.mgd.msft.net> <3E027F8168735B46AC006B1D0C7BB0020B1E040F@039-SN2MPN1-011.039d.mgd.msft.net> <1368684547.9603.38.camel@pasglop> <51947A00.9010504@windriver.com> <1368685307.9603.39.camel@pasglop> <51947E35.30808@windriver.com> <1368686426.9603.49.camel@pasglop> <5194800D.3010606@windriver.com> <6A3DF150A5B70D4F9B66A25E3F7C888D0701C498@039-SN2MPN1-012.039d.mgd.msft.net> <1368687133.9603.51.camel@pasglop> <1370577138.3766.342.camel@pasglop> <1370579976.3766.345.camel@pasglop> <3E027F8168735B46AC006B1D0C7BB0020B2135A0@039-SN2MPN1-012.039d.mgd.msft.net> <1370580426.3766.349.camel@pasglop> <3E027F8168735B46AC006B1D0C7BB0020B213817@039-SN2MPN1-012.039d.mgd.msft.net> <1370590884.3766.357.camel@pasglop> <3E027F8168735B46AC006B1D0C7BB0020B213A62@039-SN2MPN1-012.039d.mgd.msft.net> <137 0595190.3766 .359.camel@pasglop> <1370595557.3766.362.camel@pasglop> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Cc: Xie Shaohui-B21989 , Liu Qiang-B32616 , Zang Roy-R61911 , Timur Tabi , "tiejun.chen" , Fleming Andy-AFLEMING , Bhushan Bharat-R65777 , linuxppc-dev@lists.ozlabs.org List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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.