[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/3] mips: Don't generate anything in jit_movr if O1 == O2
From: |
Paul Cercueil |
Subject: |
[PATCH 1/3] mips: Don't generate anything in jit_movr if O1 == O2 |
Date: |
Fri, 7 May 2021 12:50:37 +0100 |
Lightning would previously generate a "move $x, $x" opcode, which is
effectively a NOP.
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
lib/jit_mips-cpu.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/lib/jit_mips-cpu.c b/lib/jit_mips-cpu.c
index 766af0d..57fc2bf 100644
--- a/lib/jit_mips-cpu.c
+++ b/lib/jit_mips-cpu.c
@@ -494,7 +494,8 @@ static void
_ori(jit_state_t*,jit_int32_t,jit_int32_t,jit_word_t);
# define xorr(r0,r1,r2) XOR(r0,r1,r2)
# define xori(r0,r1,i0) _xori(_jit,r0,r1,i0)
static void _xori(jit_state_t*,jit_int32_t,jit_int32_t,jit_word_t);
-# define movr(r0,r1) orr(r0,r1,_ZERO_REGNO)
+# define movr(r0,r1) _movr(_jit,r0,r1)
+static void _movr(jit_state_t*,jit_int32_t,jit_int32_t);
# define movi(r0,i0) _movi(_jit,r0,i0)
static void _movi(jit_state_t*,jit_int32_t,jit_word_t);
# define movi_p(r0,i0) _movi_p(_jit,r0,i0)
@@ -1196,6 +1197,13 @@ _xori(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1,
jit_word_t i0)
}
}
+static void
+_movr(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1)
+{
+ if (r0 != r1)
+ orr(r0, r1, _ZERO_REGNO);
+}
+
static void
_movi(jit_state_t *_jit, jit_int32_t r0, jit_word_t i0)
{
--
2.30.2
- [PATCH 1/3] mips: Don't generate anything in jit_movr if O1 == O2,
Paul Cercueil <=