linux-mips
[Top] [All Lists]

Re: Optimisation

To: Geert Uytterhoeven <geert@linux-m68k.org>
Subject: Re: Optimisation
From: Sridhar Adagada <asridhars@gmail.com>
Date: Thu, 8 Jul 2004 15:18:35 +0530
In-reply-to: <f013fac6040708022160bbe790@mail.gmail.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <f013fac60407072338b65f8fd@mail.gmail.com> <Pine.GSO.4.58.0407081053500.12221@waterleaf.sonytel.be> <f013fac6040708022160bbe790@mail.gmail.com>
Resent-date: Thu, 8 Jul 2004 11:50:10 +0200 (MEST)
Resent-from: Geert Uytterhoeven <geert@sonycom.com>
Resent-message-id: <Pine.GSO.4.58.0407081150100.12221@waterleaf.sonytel.be>
Resent-subject: Re: Optimisation
Resent-to: Linux/MIPS Development <linux-mips@linux-mips.org>
Sender: linux-mips-bounce@linux-mips.org
Thank you! I got it now If the length is less then 7, the loop is
handled differently for the fast access of the abs and coef.

Thanks you very much
Sri

On Thu, 8 Jul 2004 14:51:59 +0530, Sridhar Adagada <asridhars@gmail.com> wrote:
> Thank you.  For some reason i have been reading ANDI ans ADDI.  But i
> am still confused at lines 13, 14 and 15
>  13         imax    $8, $6, 0
>  14         srl     $10, $8, 3
>  15         beq     $10, $0, .L62
> 
> Thanks for correcting me
> 
> Sri
> 
> 
> 
> 
> On Thu, 8 Jul 2004 10:59:58 +0200 (MEST), Geert Uytterhoeven
> <geert@linux-m68k.org> wrote:
> > On Thu, 8 Jul 2004, Sridhar Adagada wrote:
> > > As you can see $6 is the length, my confusion is at the lines 12-14,
> > > 19, 20 why is the length added with 65535 and the comparison with 0
> >
> > It's not `added with 65535', but `ANDed with 65535'. MIPS32 has 32-bit 
> > integer
> > operations only. If you want to do 16-bit math, all data has to be masked.
> >
> > Anyway, for performance, it's better to do 32-bit math only.
> >
> > > short cal_xxx(short *abs, short *coef, short len, short base)
> > > {
> > >  short i;
> > >  short sum = 0;
> > >
> > >  for (i = 0; i < length; i++)
> > >  {
> > >    sum += ( (unsigned int)abs[i] * (unsigned int)coef[i] );
> >
> > Why cast to unsigned int while sum is a short? Unless you really want to 
> > rely
> > on sum being a short, you better make it int and do the truncation to short
> > after the loop.
> >
> > Gr{oetje,eeting}s,
> >
> >                                                Geert
> >
> > --
> > Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- 
> > geert@linux-m68k.org
> >
> > In personal conversations with technical people, I call myself a hacker. But
> > when I'm talking to journalists I just say "programmer" or something like 
> > that.
> >                                                            -- Linus Torvalds
> >
>

<Prev in Thread] Current Thread [Next in Thread>