Re: fsqrt

2013-06-09 Thread Benjamin Herrenschmidt
The interesting thing I'm finding is that our math-emu is actually quite busted :-) For example look at fsqrt. It's defined as type AB which is incorrect, it should be type XB. It ends up looking for it's arguments in the wrong registers, same for fsrqts, fre, and a few others. Also quite a few

Re: fsqrt

2013-06-08 Thread Dan Malek
On Jun 7, 2013, at 4:30 PM, Benjamin Herrenschmidt b...@kernel.crashing.org wrote: Right, looking more, the code really sucks. Hey! :) …. Either you use the existing apparent ability for MATH_EMU to operate in minimal mode, ie, load/store/fmr only (which seems to do exactly the same

Re: fsqrt

2013-06-08 Thread Dan Malek
Hi Ben. On Jun 7, 2013, at 5:34 PM, Benjamin Herrenschmidt b...@kernel.crashing.org wrote: The question is whether this is still relevant ? The only answer I could provide is that it's dependent upon the libraries and how the distributions are built. It's also dependent upon processors

fsqrt

2013-06-07 Thread Benjamin Herrenschmidt
Another question... Do you guys happen to have a patch to emulate fsqrt in the kernel ? Fedora 19 seems to be using it ... among others. Cheers, Ben. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo

RE: fsqrt

2013-06-07 Thread Zang Roy-R61911
-Original Message- From: Benjamin Herrenschmidt [mailto:b...@kernel.crashing.org] Another question... Do you guys happen to have a patch to emulate fsqrt in the kernel ? Fedora 19 seems to be using it ... among others. You mean this one arch/powerpc/math-emu/fsqrt.c ? Yes. Roy

Re: fsqrt

2013-06-07 Thread tiejun.chen
On 06/07/2013 03:41 PM, Benjamin Herrenschmidt wrote: Another question... Do you guys happen to have a patch to emulate fsqrt in the kernel ? Seems this is already emulated: arch/powerpc/math-emu/fsqrt.c You can enable CONFIG_MATH_EMULATION to try. Tiejun

Re: fsqrt

2013-06-07 Thread Benjamin Herrenschmidt
On Fri, 2013-06-07 at 15:46 +0800, tiejun.chen wrote: On 06/07/2013 03:41 PM, Benjamin Herrenschmidt wrote: Another question... Do you guys happen to have a patch to emulate fsqrt in the kernel ? Seems this is already emulated: arch/powerpc/math-emu/fsqrt.c You can enable

Re: fsqrt

2013-06-07 Thread Benjamin Herrenschmidt
On Fri, 2013-06-07 at 07:45 +, Zang Roy-R61911 wrote: -Original Message- From: Benjamin Herrenschmidt [mailto:b...@kernel.crashing.org] Another question... Do you guys happen to have a patch to emulate fsqrt in the kernel ? Fedora 19 seems to be using it ... among

Re: fsqrt

2013-06-07 Thread Benjamin Herrenschmidt
On Fri, 2013-06-07 at 18:53 +1000, Benjamin Herrenschmidt wrote: + +static double crackpot_sqrt(double val) +{ +int i; +float x, y; +const float f = 1.5F; + +x = val * 0.5F; +y = val; +i = * ( int * ) y; +i = 0x5f3759df - ( i 1 ); +y = * ( float *

Re: fsqrt

2013-06-07 Thread tiejun.chen
On 06/07/2013 04:53 PM, Benjamin Herrenschmidt wrote: On Fri, 2013-06-07 at 15:46 +0800, tiejun.chen wrote: On 06/07/2013 03:41 PM, Benjamin Herrenschmidt wrote: Another question... Do you guys happen to have a patch to emulate fsqrt in the kernel ? Seems this is already emulated: arch

RE: fsqrt

2013-06-07 Thread David Laight
+ +static double crackpot_sqrt(double val) +{ +int i; +float x, y; +const float f = 1.5F; + +x = val * 0.5F; +y = val; +i = * ( int * ) y; +i = 0x5f3759df - ( i 1 ); +y = * ( float * ) i; +y = y * ( f - ( x * y * y ) ); +y

Re: fsqrt

2013-06-07 Thread Benjamin Herrenschmidt
On Fri, 2013-06-07 at 17:02 +0800, tiejun.chen wrote: On 06/07/2013 04:53 PM, Benjamin Herrenschmidt wrote: On Fri, 2013-06-07 at 15:46 +0800, tiejun.chen wrote: On 06/07/2013 03:41 PM, Benjamin Herrenschmidt wrote: Another question... Do you guys happen to have a patch to emulate fsqrt

Re: fsqrt

2013-06-07 Thread Benjamin Herrenschmidt
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

Re: fsqrt

2013-06-07 Thread Kumar Gala
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

Re: fsqrt

2013-06-07 Thread Benjamin Herrenschmidt
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. Pretty sure fsqrt is still out of e6500. Ok, thinking out loud... looks like we might be able to just use existing math-emu for that. From what I

Re: fsqrt

2013-06-07 Thread Benjamin Herrenschmidt
On Sat, 2013-06-08 at 09:23 +1000, Benjamin Herrenschmidt wrote: Ok, thinking out loud... looks like we might be able to just use existing math-emu for that. From what I can tell, all it needs (other than enabling the config option), is a call to flush_fp_to_thread(current); While talking

Re: fsqrt

2013-06-07 Thread Benjamin Herrenschmidt
On Sat, 2013-06-08 at 09:25 +1000, Benjamin Herrenschmidt wrote: On Sat, 2013-06-08 at 09:23 +1000, Benjamin Herrenschmidt wrote: Ok, thinking out loud... looks like we might be able to just use existing math-emu for that. From what I can tell, all it needs (other than enabling the config

Re: fsqrt

2013-06-07 Thread Benjamin Herrenschmidt
On Fri, 2013-06-07 at 17:20 -0700, Dan Malek wrote: The purpose for that minimal code was the signal handlers were hand-coded assembly that always did the FPU load/store regardless of compiler flags. Over time, it became convenient to emulate a few others, even with user space math

Re: fsqrt

2013-06-07 Thread Benjamin Herrenschmidt
On Fri, 2013-06-07 at 18:13 -0700, Dan Malek wrote: Hi Ben. On Jun 7, 2013, at 5:34 PM, Benjamin Herrenschmidt b...@kernel.crashing.org wrote: The question is whether this is still relevant ? The only answer I could provide is that it's dependent upon the libraries and how the

HWCAP for fsqrt vs PPC64

2010-06-25 Thread Kumar Gala
Guys, We seem to be using the PPC_FEATURE_64 HWCAP to imply fsqrt support. However, the new e5500 core from Freescale that is 64-bit does NOT implement fsqrt so this assumption is wrong: sysdeps/powerpc/fpu/math_private.h # if __WORDSIZE == 64 || defined _ARCH_PWR4 # define __CPU_HAS_FSQRT