@@ -7,3 +7,11 @@
# Reference: MIPS Architecture for Programmers, Volume IV-a
# The MIPS16e Application Specific Extension
# (Document Number: MD00076)
+
+&rd_imm rd imm
+
+%xlat_rx8 8:3 !function=xlat
+
+@ri ..... ... imm:8 &rd_imm rd=%xlat_rx8
+
+LI 01101 ... ........ @ri
@@ -7,3 +7,12 @@
# Reference: MIPS Architecture for Programmers, Volume IV-a
# The MIPS16e Application Specific Extension
# (Document Number: MD00076)
+
+&rd_imm rd imm !extern
+
+%immx 0:5 21:6 16:5
+%xlat_rx8 8:3 !function=xlat
+
+@ri ..... ...... ..... ..... ... ... ..... &rd_imm rd=%xlat_rx8 imm=%immx
+
+LI 11110 ...... ..... 01101 ... 000 ..... @ri
@@ -9,6 +9,20 @@
#include "qemu/osdep.h"
#include "translate.h"
+static inline int xlat(DisasContext *ctx, int x)
+{
+ static const int map[8] = { 16, 17, 2, 3, 4, 5, 6, 7 };
+
+ return map[x];
+}
+
/* Include the auto-generated decoders. */
#include "decode-mips16e_16.c.inc"
#include "decode-mips16e_32.c.inc"
+
+static bool trans_LI(DisasContext *ctx, arg_rd_imm *a)
+{
+ gen_li(ctx, a->rd, a->imm);
+
+ return true;
+}
@@ -24,7 +24,6 @@ enum {
M16_OPC_SLTI = 0x0a,
M16_OPC_SLTIU = 0x0b,
M16_OPC_I8 = 0x0c,
- M16_OPC_LI = 0x0d,
M16_OPC_CMPI = 0x0e,
M16_OPC_SD = 0x0f,
M16_OPC_LB = 0x10,
@@ -582,9 +581,6 @@ static int decode_extended_mips16_opc(CPUMIPSState *env, DisasContext *ctx)
break;
}
break;
- case M16_OPC_LI:
- tcg_gen_movi_tl(cpu_gpr[rx], (uint16_t) imm);
- break;
case M16_OPC_CMPI:
tcg_gen_xori_tl(cpu_gpr[24], cpu_gpr[rx], (uint16_t) imm);
break;
@@ -839,13 +835,6 @@ static int decode_ase_mips16e(CPUMIPSState *env, DisasContext *ctx)
}
}
break;
- case M16_OPC_LI:
- {
- int16_t imm = (uint8_t) ctx->opcode;
-
- gen_arith_imm(ctx, OPC_ADDIU, rx, 0, imm);
- }
- break;
case M16_OPC_CMPI:
{
int16_t imm = (uint8_t) ctx->opcode;
Decode the destination register using the xlat() helper. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- target/mips/tcg/mips16e_16.decode | 8 ++++++++ target/mips/tcg/mips16e_32.decode | 9 +++++++++ target/mips/tcg/mips16e_translate.c | 14 ++++++++++++++ target/mips/tcg/mips16e_translate.c.inc | 11 ----------- 4 files changed, 31 insertions(+), 11 deletions(-)