[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 1/8] mips: Optimize jit_eqr / jit_eqi
From: |
Paul Cercueil |
Subject: |
[PATCH v2 1/8] mips: Optimize jit_eqr / jit_eqi |
Date: |
Mon, 9 Jan 2023 23:04:04 +0000 |
To perform the operation r0 = r1 == 0, the old code would do:
SLTU(r0, _ZERO_REGNO, r1);
XORI(r0, r0, 1);
But it is actually possible to do that in a single opcode:
SLTIU(r0, r1, 1);
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
lib/jit_mips-cpu.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/lib/jit_mips-cpu.c b/lib/jit_mips-cpu.c
index 44fa99d..d73535a 100644
--- a/lib/jit_mips-cpu.c
+++ b/lib/jit_mips-cpu.c
@@ -1948,8 +1948,7 @@ static void
_eqr(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1, jit_int32_t r2)
{
subr(r0, r1, r2);
- SLTU(r0, _ZERO_REGNO, r0);
- XORI(r0, r0, 1);
+ SLTIU(r0, r0, 1);
}
static void
@@ -1957,11 +1956,10 @@ _eqi(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1,
jit_word_t i0)
{
if (i0) {
subi(r0, r1, i0);
- SLTU(r0, _ZERO_REGNO, r0);
+ SLTIU(r0, r0, 1);
+ } else {
+ SLTIU(r0, r1, 1);
}
- else
- SLTU(r0, _ZERO_REGNO, r1);
- XORI(r0, r0, 1);
}
static void
--
2.39.0
- [PATCH v2 0/9] mips: Fill delay slots v2, Paul Cercueil, 2023/01/09
- [PATCH v2 1/8] mips: Optimize jit_eqr / jit_eqi,
Paul Cercueil <=
- [PATCH v2 2/8] mips: Fill delay slots of JR opcodes in jit_jmpr, Paul Cercueil, 2023/01/09
- [PATCH v2 3/8] mips: Fill delay slots of JALR opcodes in jit_callr, Paul Cercueil, 2023/01/09
- [PATCH v2 4/8] mips: Fill delay slots of J in jit_jmpi, Paul Cercueil, 2023/01/09
- [PATCH v2 5/8] mips: Fill delay slots in jit_beqr / jit_beqi, Paul Cercueil, 2023/01/09
- [PATCH v2 6/8] mips: Fill delay slots in jit_bner / jit_bnei, Paul Cercueil, 2023/01/09
- [PATCH v2 7/8] mips: Fill delay slots in jit_bgtr, jit_bgti, jit_bler, jit_blei, Paul Cercueil, 2023/01/09
- [PATCH v2 8/8] mips: Fill delay slots in jit_bger, jit_bgei, jit_bltr, jit_blti, Paul Cercueil, 2023/01/09
- Re: [PATCH v2 0/9] mips: Fill delay slots v2, Paulo César Pereira de Andrade, 2023/01/10