[RFC PATCH 05/19] powerpc/32: Use load and store multiple in GPR save/restore macros
Nicholas Piggin
npiggin at gmail.com
Mon Oct 31 16:54:26 AEDT 2022
---
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
--
2.37.2
More information about the Linuxppc-dev
mailing list