lightning
[Top][All Lists]
Advanced

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

[PATCH 2/2] mips: Optimize _callr


From: Paul Cercueil
Subject: [PATCH 2/2] mips: Optimize _callr
Date: Sat, 1 May 2021 00:54:41 +0100

Linux requires the function address to be present in $t9, but that
doesn't mean that $t9 must be the target register of JALR. The source
register can then be copied to $t9 in the delay slot, instead of before
the JALR.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 lib/jit_mips-cpu.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/jit_mips-cpu.c b/lib/jit_mips-cpu.c
index 8fb7fa1..766af0d 100644
--- a/lib/jit_mips-cpu.c
+++ b/lib/jit_mips-cpu.c
@@ -2869,10 +2869,11 @@ _bmci(jit_state_t *_jit, jit_word_t i0, jit_int32_t r0, 
jit_word_t i1)
 static void
 _callr(jit_state_t *_jit, jit_int32_t r0)
 {
+    JALR(r0);
     if (r0 != _T9_REGNO)
        movr(_T9_REGNO, r0);
-    JALR(r0);
-    NOP(1);
+    else
+       NOP(1);
 }
 
 static void
-- 
2.30.2




reply via email to

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