[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3d4e757f-84cd-7a48-0b5a-d39c44ea33ea@c-s.fr>
Date: Wed, 14 Aug 2019 11:46:41 +0200
From: Christophe Leroy <christophe.leroy@....fr>
To: Paul Mackerras <paulus@...abs.org>
Cc: Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Michael Ellerman <mpe@...erman.id.au>,
segher@...nel.crashing.org, linux-kernel@...r.kernel.org,
linuxppc-dev@...ts.ozlabs.org
Subject: Re: [PATCH 1/2] powerpc: rewrite LOAD_REG_IMMEDIATE() as an
intelligent macro
Le 14/08/2019 à 04:08, Paul Mackerras a écrit :
> On Tue, Aug 13, 2019 at 09:59:35AM +0000, Christophe Leroy wrote:
>
> [snip]
>
>> +.macro __LOAD_REG_IMMEDIATE r, x
>> + .if \x & ~0xffffffff != 0
>> + __LOAD_REG_IMMEDIATE_32 \r, (\x) >> 32
>> + rldicr \r, \r, 32, 31
>> + .if (\x) & 0xffff0000 != 0
>> + oris \r, \r, (\x)@__AS_ATHIGH
>> + .endif
>> + .if (\x) & 0xffff != 0
>> + oris \r, \r, (\x)@l
>> + .endif
>> + .else
>> + __LOAD_REG_IMMEDIATE_32 \r, \x
>> + .endif
>> +.endm
>
> Doesn't this force all negative constants, even small ones, to use
> the long sequence? For example, __LOAD_REG_IMMEDIATE r3, -1 will
> generate (as far as I can see):
>
> li r3, -1
> rldicr r3, r3, 32, 31
> oris r3, r3, 0xffff
> ori r3, r3, 0xffff
>
> which seems suboptimal.
Ah yes, thanks. And it is also buggy when \x is over 0x80000000 because
lis is a signed ops
I'll send v2
Christophe
Powered by blists - more mailing lists