[patch][0/5] powerpc: Add support to fully comply with IEEE-754 standard

Zhu Ebony-r57400 ebony.zhu at freescale.com
Wed Feb 7 19:04:44 EST 2007


 

> -----Original Message-----
> From: Kumar Gala [mailto:galak at kernel.crashing.org] 
> Sent: Wednesday, February 07, 2007 3:57 PM
> To: Zhu Ebony-r57400
> Cc: paulus at samba.org; linuxppc-dev at ozlabs.org
> Subject: Re: [patch][0/5] powerpc: Add support to fully 
> comply with IEEE-754 standard
> 
> 
> On Feb 7, 2007, at 1:21 AM, Zhu Ebony-r57400 wrote:
> 
> >
> >
> >> -----Original Message-----
> >> From: Kumar Gala [mailto:galak at kernel.crashing.org]
> >> Sent: Wednesday, February 07, 2007 3:12 PM
> >> To: Zhu Ebony-r57400
> >> Cc: paulus at samba.org; linuxppc-dev at ozlabs.org
> >> Subject: Re: [patch][0/5] powerpc: Add support to fully 
> comply with 
> >> IEEE-754 standard
> >>
> >>
> >> On Feb 6, 2007, at 11:52 PM, Zhu Ebony-r57400 wrote:
> >>
> >>>>>> This snippet of code breaks it from math-emu/sfp-machine.h
> >>>>>>
> >>>>>>>> +#ifdef CONFIG_SPE
> >>>>>>>> +#define __FPU_FPSCR	(current->thread.spefscr)
> >>>>>>>> +#else
> >>>>>>>>  #define __FPU_FPSCR	(current->thread.fpscr.val)
> >>>>>>>> +#endif
> >>>>>>
> >>>>>> By doing this if I want 'classic FP' emulation as well
> >> as the IEEE
> >>>>>> fixup my fpscr for classic emu will not be updated properly.
> >>>>>
> >>>>> Logically, user can choose "SPE Support" and "Math
> >>>> emulation" at the
> >>>>> same time on menuconfig. But from my understanding, it is not 
> >>>>> necessary to select math-emu on a SPE available system,
> >>>> since SPE can
> >>>>> do math operation.
> >>>>
> >>>> This is not true.  If I want to run a "classic" PPC binary
> >> with FP I
> >>>> need "Math emulation" and if I want to run an SPE one I
> >> enable "SPE
> >>>> Support".  I could want to run both of these types of
> >> binaries on the
> >>>> same system at the same time.
> >>>
> >>> If this is the case, maybe we need a separate macro like
> >>> #define __SPE_SPEFSCR	(current->thread.spefscr)
> >>> But if we do this, how does the kernel know if the 
> emulation is for 
> >>> "classic" PPC binary with FP or an SPE one, thus corresponding 
> >>> registers(fpscr or spefscr) being updated?
> >>
> >> It's based on what instruction you are trying to emulate.
> >>
> > For example, the FP_ROUNDMODE now defined by __FPU_FPSCR is widely 
> > used in existing code. If the kernel doesn't know the 
> emulation is for 
> > classic PPC or SPE fixup, then it doesn't know where to get the 
> > correct rounding mode, from fpscr or spefscr? This has confused me.
> 
> Yes, this is a good point, I guess in truth the two modes are 
> mutually exclusive.
> 
> Sorry for not figuring that out sooner.  (uugh, all the stuff 
> to make IEEE emulation work properly on SPE is a pain :)

Defining FP_ROUNDMODE as (current->thread.spefscr & 0x3) in sigfpe
handler maybe
a feasible way to get correct rounding mode, and won't break existing
FPU simulation.
At least it works here :) I will submit revised patches soon.

B.R.
Ebony



More information about the Linuxppc-dev mailing list