[RFC PATCH 05/19] powerpc/32: Use load and store multiple in GPR save/restore macros
Christophe Leroy
christophe.leroy at csgroup.eu
Mon Nov 7 23:51:38 AEDT 2022
Le 07/11/2022 à 13:45, Nicholas Piggin a écrit :
> On Thu Nov 3, 2022 at 6:26 PM AEST, Christophe Leroy wrote:
>> It contradicts commit a85c728cb5e1 ("powerpc/32: Don't use lmw/stmw for
>> saving/restoring non volatile regs")
>
> Hmm okay. Do you want to keep the #ifdef case in ppc_save_regs for ppc32
> to save ~124 bytes of text? I don't mind either way.
I think you can make ppc_save_regs() generic.
I don't think the lmw/stmw is worth it in ppc_save_regs(), just drop it.
Christophe
>
> Thanks,
> Nick
>
>>
>> Le 31/10/2022 à 06:54, Nicholas Piggin a écrit :
>>> ---
>>> arch/powerpc/include/asm/ppc_asm.h | 18 ++++++++++++++++--
>>> 1 file changed, 16 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/arch/powerpc/include/asm/ppc_asm.h b/arch/powerpc/include/asm/ppc_asm.h
>>> index 753a2757bcd4..ac44383d350a 100644
>>> --- a/arch/powerpc/include/asm/ppc_asm.h
>>> +++ b/arch/powerpc/include/asm/ppc_asm.h
>>> @@ -57,8 +57,22 @@
>>> #define SAVE_NVGPRS(base) SAVE_GPRS(14, 31, base)
>>> #define REST_NVGPRS(base) REST_GPRS(14, 31, base)
>>> #else
>>> -#define SAVE_GPRS(start, end, base) OP_REGS stw, 4, start, end, base, GPR0
>>> -#define REST_GPRS(start, end, base) OP_REGS lwz, 4, start, end, base, GPR0
>>> +.macro __SAVE_GPRS start, end, base, offset
>>> + .if \end == 31
>>> + stmw \start,\offset(\base)
>>> + .else
>>> + OP_REGS stw, 4, \start, \end, \base, \offset
>>> + .endif
>>> +.endm
>>> +.macro __REST_GPRS start, end, base, offset
>>> + .if \end == 31
>>> + lmw \start,\offset(\base)
>>> + .else
>>> + OP_REGS lwz, 4, \start, \end, \base, \offset
>>> + .endif
>>> +.endm
>>> +#define SAVE_GPRS(start, end, base) __SAVE_GPRS start, end, base, GPR0
>>> +#define REST_GPRS(start, end, base) __REST_GPRS start, end, base, GPR0
>>> #define SAVE_NVGPRS(base) SAVE_GPRS(13, 31, base)
>>> #define REST_NVGPRS(base) REST_GPRS(13, 31, base)
>>> #endif
>
More information about the Linuxppc-dev
mailing list