Re: Optimisation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx> 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@xxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxx
> >
> > 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
> >
>


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux