linux-mips
[Top] [All Lists]

Re: [patch] MIPS/gcc: Revert removal of DImode shifts for 32-bit targets

To: Nigel Stephens <nigel@mips.com>
Subject: Re: [patch] MIPS/gcc: Revert removal of DImode shifts for 32-bit targets
From: "Maciej W. Rozycki" <macro@linux-mips.org>
Date: Wed, 4 Aug 2004 22:54:39 +0200 (CEST)
Cc: Richard Sandiford <rsandifo@redhat.com>, Ralf Baechle <ralf@linux-mips.org>, Richard Henderson <rth@redhat.com>, gcc-patches@gcc.gnu.org, linux-mips@linux-mips.org
In-reply-to: <411148F0.2040605@mips.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <Pine.LNX.4.55.0407191648451.3667@jurand.ds.pg.gda.pl> <87hds49bmo.fsf@redhat.com> <Pine.LNX.4.55.0407191907300.3667@jurand.ds.pg.gda.pl> <20040719213801.GD14931@redhat.com> <Pine.LNX.4.55.0407201505330.14824@jurand.ds.pg.gda.pl> <20040723202703.GB30931@redhat.com> <20040723211232.GB5138@linux-mips.org> <Pine.LNX.4.58L.0407261325470.3873@blysk.ds.pg.gda.pl> <410E9E25.7080104@mips.com> <87acxcbxfl.fsf@redhat.com> <410F5964.3010109@mips.com> <876580bm2e.fsf@redhat.com> <410F60DF.9020400@mips.com> <Pine.LNX.4.58L.0408042123030.31930@blysk.ds.pg.gda.pl> <411148F0.2040605@mips.com>
Sender: linux-mips-bounce@linux-mips.org
On Wed, 4 Aug 2004, Nigel Stephens wrote:

> > Here are my proposals I've referred to previously.  Instruction counts
> >are 9, 9 and 10, respectively, as I've missed an additional instruction
> >required to handle shifts by 0 (or actually any multiples of 64). 
> 
> IMHO handling a shift by zero correctly is important.

 Agreed, hence an additional instruction needed.

> >             "not    %1, %3\n\t"
> >             "srlv   %1, %L2, %1\n\t"
> >             "srl    %1, %1, 1\n\t"
> >
> 
> Why not the shorter:
> 
> >             "neg    %1, %3\n\t"
> >             "srlv   %1, %L2, %1\n\t"

 Notice the difference -- this shorter code doesn't handle shifts by zero
correctly. ;-)

> And then in __ashrdi3:
> 
>               "andi   %1, %3, 0x20\n\t"
>               ".set   push\n\t"
>               ".set   noat\n\t"
>               "sra    $1, %M2, 31\n\t"
>               "movn   %L0, %M0, %1\n\t"
>               "movn   %M0, $1, %1\n\t"
>               ".set   pop"
> 
> Cute, but I think that should be
> 
>       "sra    $1, %M0, 31\n\t"
> 
> (i.e %M0 not %M2)

 Well, I've tested it for all shift counts and it works properly as is --
we care of the value of bit #31 to be shifted only and at this stage it's
the same in both registers.  So it's just a matter of style.

  Maciej

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