fsqrt

Benjamin Herrenschmidt benh at kernel.crashing.org
Fri Jun 7 22:07:02 EST 2013


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 in the kernel ?
> >>
> >> Seems this is already emulated:
> >>
> >> arch/powerpc/math-emu/fsqrt.c
> >>
> >> You can enable CONFIG_MATH_EMULATION to try.
> >
> > Is math emu expected to work at all on top of a real FPU ? I though it
> > didn't ... maybe I'm wrong.
> 
> As I understand often the real FPU can't support all float instructions, so we 
> have to enable this to emulate those unsupported float instructions in that 
> scenario.

Ok, two things come to mind here:

  - do_mathemu doesn't do giveup_fpu() so the FPU state might still be
in the "live" FP registers and not in the thread_struct, so it can't
work... unless I missed something.

  - mathemu uses solely integers. For something like fsqrt it's going to
suck a lot more than implementing using floating points in the kernel.

Cheers,
Ben.




More information about the Linuxppc-dev mailing list