lightning
[Top][All Lists]
Advanced

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

[PATCH 2/2] ppc: Add implementations for pre-increment loads/stores


From: Paul Cercueil
Subject: [PATCH 2/2] ppc: Add implementations for pre-increment loads/stores
Date: Sun, 7 Jan 2024 16:27:42 +0100

The PowerPC instruction set has instructions to load/store with
pre-increments with a few exceptions.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 lib/jit_ppc-cpu.c | 33 +++++++++++++++++++++++++++++++++
 lib/jit_ppc-fpu.c |  8 ++++++++
 lib/jit_ppc.c     |  8 ++++----
 3 files changed, 45 insertions(+), 4 deletions(-)

diff --git a/lib/jit_ppc-cpu.c b/lib/jit_ppc-cpu.c
index fc79944..1a221b6 100644
--- a/lib/jit_ppc-cpu.c
+++ b/lib/jit_ppc-cpu.c
@@ -300,6 +300,7 @@ static void _FXS(jit_state_t*,int,int,int,int,int,int,int);
 #  define LWZUX(d,a,b)                 FX(31,d,a,b,55)
 #  define LWZX(d,a,b)                  FX(31,d,a,b,23)
 #  define LD(d,a,s)                    FDs(58,d,a,s)
+#  define LDU(d,a,s)                   FDs(58,d,a,s|1)
 #  define LDX(d,a,b)                   FX(31,d,a,b,21)
 #  define MCRF(d,s)                    FXL(19,((d)<<2),((s)<<2),0)
 #  if DEBUG
@@ -890,6 +891,26 @@ static void 
_ldxr_l(jit_state_t*,jit_int32_t,jit_int32_t,jit_int32_t);
 #    define ldxi_l(r0,r1,i0)           _ldxi_l(_jit,r0,r1,i0)
 static void _ldxi_l(jit_state_t*,jit_int32_t,jit_int32_t,jit_word_t);
 #  endif
+#  define ldxbi_c(r0,r1,i0)            generic_ldxbi_c(r0,r1,i0)
+#  define ldxbi_uc(r0,r1,i0)           LBZU(r0,r1,i0)
+#  define ldxbi_s(r0,r1,i0)            LHAU(r0,r1,i0)
+#  define ldxbi_us(r0,r1,i0)           LHZU(r0,r1,i0)
+#  if __WORDSIZE == 32
+#    define ldxbi_i(r0,r1,i0)          LWZU(r0,r1,i0)
+#  else
+#    define ldxbi_i(r0,r1,i0)          generic_ldxbi_i(r0,r1,i0)
+#    define ldxbi_ui(r0,r1,i0)         LWZU(r0,r1,i0)
+#    define ldxbi_l(r0,r1,i0)          LDU(r0,r1,i0)
+#  endif
+#  define ldxai_c(r0,r1,i0)            generic_ldxai_c(r0,r1,i0)
+#  define ldxai_uc(r0,r1,i0)           generic_ldxai_uc(r0,r1,i0)
+#  define ldxai_s(r0,r1,i0)            generic_ldxai_s(r0,r1,i0)
+#  define ldxai_us(r0,r1,i0)           generic_ldxai_us(r0,r1,i0)
+#  define ldxai_i(r0,r1,i0)            generic_ldxai_i(r0,r1,i0)
+#  if __WORDSIZE == 64
+#    define ldxai_ui(r0,r1,i0)         generic_ldxai_ui(r0,r1,i0)
+#    define ldxai_l(r0,r1,i0)          generic_ldxai_l(r0,r1,i0)
+#  endif
 #  define str_c(r0,r1)                 STBX(r1, _R0_REGNO, r0)
 #  define sti_c(i0,r0)                 _sti_c(_jit,i0,r0)
 static void _sti_c(jit_state_t*,jit_word_t,jit_int32_t);
@@ -920,6 +941,18 @@ static void 
_stxr_l(jit_state_t*,jit_int32_t,jit_int32_t,jit_int32_t);
 #    define stxi_l(i0,r0,r1)           _stxi_l(_jit,i0,r0,r1)
 static void _stxi_l(jit_state_t*,jit_word_t,jit_int32_t,jit_int32_t);
 #  endif
+#  define stxbi_c(i0,r0,r1)            STBU(r1,r0,i0)
+#  define stxbi_s(i0,r0,r1)            STHU(r1,r0,i0)
+#  define stxbi_i(i0,r0,r1)            STWU(r1,r0,i0)
+#  if __WORDSIZE == 64
+#    define stxbi_l(i0,r0,r1)          STDU(r1,r0,i0)
+#  endif
+#  define stxai_c(i0,r0,r1)            generic_stxai_c(i0,r0,r1)
+#  define stxai_s(i0,r0,r1)            generic_stxai_s(i0,r0,r1)
+#  define stxai_i(i0,r0,r1)            generic_stxai_i(i0,r0,r1)
+#  if __WORDSIZE == 64
+#    define stxai_l(i0,r0,r1)          generic_stxai_l(i0,r0,r1)
+#  endif
 #  define jmpr(r0)                     _jmpr(_jit,r0)
 static void _jmpr(jit_state_t*,jit_int32_t);
 #  define jmpi(i0)                     _jmpi(_jit,i0)
diff --git a/lib/jit_ppc-fpu.c b/lib/jit_ppc-fpu.c
index 605bd4f..0eb24f2 100644
--- a/lib/jit_ppc-fpu.c
+++ b/lib/jit_ppc-fpu.c
@@ -422,6 +422,14 @@ static void _sti_d(jit_state_t*,jit_word_t,jit_int32_t);
 static void _stxr_d(jit_state_t*,jit_int32_t,jit_int32_t,jit_int32_t);
 #  define stxi_d(i0,r0,r1)             _stxi_d(_jit,i0,r0,r1)
 static void _stxi_d(jit_state_t*,jit_word_t,jit_int32_t,jit_int32_t);
+#  define ldxbi_f(r0,r1,i0)            LFSU(r0,r1,i0)
+#  define ldxbi_d(r0,r1,i0)            LFDU(r0,r1,i0)
+#  define ldxai_f(r0,r1,i0)            generic_ldxai_f(r0,r1,i0)
+#  define ldxai_d(r0,r1,i0)            generic_ldxai_d(r0,r1,i0)
+#  define stxbi_f(i0,r0,r1)            STFSU(r1,r0,i0)
+#  define stxbi_d(i0,r0,r1)            STFDU(r1,r0,i0)
+#  define stxai_f(i0,r0,r1)            generic_stxai_f(i0,r0,r1)
+#  define stxai_d(i0,r0,r1)            generic_stxai_d(i0,r0,r1)
 #endif
 
 #if CODE
diff --git a/lib/jit_ppc.c b/lib/jit_ppc.c
index 3b53aa6..af292f1 100644
--- a/lib/jit_ppc.c
+++ b/lib/jit_ppc.c
@@ -1264,13 +1264,13 @@ _emit_code(jit_state_t *_jit)
                break
 #define case_rrx(name, type)                                           \
            case jit_code_##name##i##type:                              \
-               generic_##name##i##type(rn(node->u.w),                  \
-                                       rn(node->v.w), node->w.w);      \
+               name##i##type(rn(node->u.w),                            \
+                             rn(node->v.w), node->w.w);                \
               break
 #define case_xrr(name, type)                                           \
                case jit_code_##name##i##type:                          \
-               generic_##name##i##type(node->u.w, rn(node->v.w),       \
-                                       rn(node->w.w));                 \
+               name##i##type(node->u.w, rn(node->v.w),                 \
+                             rn(node->w.w));                           \
                break
 #define case_rrrr(name, type)                                          \
            case jit_code_##name##r##type:                              \
-- 
2.43.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]