arch/powerpc/math-emu/mtfsf.c - incorrect mask?
Stephen N Chivers
schivers at csc.com.au
Mon Feb 10 06:42:19 EST 2014
James Yang <James.Yang at freescale.com> wrote on 02/08/2014 07:49:40 AM:
> From: James Yang <James.Yang at freescale.com>
> To: Gabriel Paubert <paubert at iram.es>
> Cc: Stephen N Chivers <schivers at csc.com.au>, Chris Proctor
> <cproctor at csc.com.au>, <linuxppc-dev at lists.ozlabs.org>
> Date: 02/08/2014 07:49 AM
> Subject: Re: arch/powerpc/math-emu/mtfsf.c - incorrect mask?
>
> On Fri, 7 Feb 2014, Gabriel Paubert wrote:
>
> > Hi Stephen,
> >
> > On Fri, Feb 07, 2014 at 11:27:57AM +1000, Stephen N Chivers wrote:
> > > Gabriel Paubert <paubert at iram.es> wrote on 02/06/2014 07:26:37 PM:
> > >
> > > > From: Gabriel Paubert <paubert at iram.es>
> > > > To: Stephen N Chivers <schivers at csc.com.au>
> > > > Cc: linuxppc-dev at lists.ozlabs.org, Chris Proctor
<cproctor at csc.com.au>
> > > > Date: 02/06/2014 07:26 PM
> > > > Subject: Re: arch/powerpc/math-emu/mtfsf.c - incorrect mask?
> > > >
> > > > On Thu, Feb 06, 2014 at 12:09:00PM +1000, Stephen N Chivers wrote:
>
> > > > >
> > > > > mask = 0;
> > > > > if (FM & (1 << 0))
> > > > > mask |= 0x0000000f;
> > > > > if (FM & (1 << 1))
> > > > > mask |= 0x000000f0;
> > > > > if (FM & (1 << 2))
> > > > > mask |= 0x00000f00;
> > > > > if (FM & (1 << 3))
> > > > > mask |= 0x0000f000;
> > > > > if (FM & (1 << 4))
> > > > > mask |= 0x000f0000;
> > > > > if (FM & (1 << 5))
> > > > > mask |= 0x00f00000;
> > > > > if (FM & (1 << 6))
> > > > > mask |= 0x0f000000;
> > > > > if (FM & (1 << 7))
> > > > > mask |= 0x90000000;
> > > > >
> > > > > With the above mask computation I get consistent results for
> > > > > both the MPC8548 and MPC7410 boards.
> > > > >
> > > > > Am I missing something subtle?
> > > >
> > > > No I think you are correct. This said, this code may probably be
> > > optimized
> > > > to eliminate a lot of the conditional branches. I think that:
>
>
> If the compiler is enabled to generate isel instructions, it would not
> use a conditional branch for this code. (ignore the andi's values,
> this is an old compile)
>
>From limited research, the 440GP is a processor
that doesn't implement the isel instruction and it does
not implement floating point.
The kernel emulates isel and so using that instruction
for the 440GP would have a double trap penalty.
Correct me if I am wrong, the isel instruction first appears
in PowerPC ISA v2.04 around mid 2007.
Stephen Chivers,
CSC Australia Pty. Ltd.
More information about the Linuxppc-dev
mailing list