target/rx: Use translator_ld*

Reviewed-by: Yoshinori Sato <ysato@users.sourceforge.jp>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson 2024-04-04 23:42:29 -10:00
parent 1f9c446233
commit 104cf5524e
1 changed files with 14 additions and 13 deletions

View File

@ -22,7 +22,6 @@
#include "cpu.h" #include "cpu.h"
#include "exec/exec-all.h" #include "exec/exec-all.h"
#include "tcg/tcg-op.h" #include "tcg/tcg-op.h"
#include "exec/cpu_ldst.h"
#include "exec/helper-proto.h" #include "exec/helper-proto.h"
#include "exec/helper-gen.h" #include "exec/helper-gen.h"
#include "exec/translator.h" #include "exec/translator.h"
@ -75,10 +74,10 @@ static TCGv_i64 cpu_acc;
/* decoder helper */ /* decoder helper */
static uint32_t decode_load_bytes(DisasContext *ctx, uint32_t insn, static uint32_t decode_load_bytes(DisasContext *ctx, uint32_t insn,
int i, int n) int i, int n)
{ {
while (++i <= n) { while (++i <= n) {
uint8_t b = cpu_ldub_code(ctx->env, ctx->base.pc_next++); uint8_t b = translator_ldub(ctx->env, &ctx->base, ctx->base.pc_next++);
insn |= b << (32 - i * 8); insn |= b << (32 - i * 8);
} }
return insn; return insn;
@ -90,22 +89,24 @@ static uint32_t li(DisasContext *ctx, int sz)
CPURXState *env = ctx->env; CPURXState *env = ctx->env;
addr = ctx->base.pc_next; addr = ctx->base.pc_next;
tcg_debug_assert(sz < 4);
switch (sz) { switch (sz) {
case 1: case 1:
ctx->base.pc_next += 1; ctx->base.pc_next += 1;
return cpu_ldsb_code(env, addr); return (int8_t)translator_ldub(env, &ctx->base, addr);
case 2: case 2:
ctx->base.pc_next += 2; ctx->base.pc_next += 2;
return cpu_ldsw_code(env, addr); return (int16_t)translator_lduw(env, &ctx->base, addr);
case 3: case 3:
ctx->base.pc_next += 3; ctx->base.pc_next += 3;
tmp = cpu_ldsb_code(env, addr + 2) << 16; tmp = (int8_t)translator_ldub(env, &ctx->base, addr + 2);
tmp |= cpu_lduw_code(env, addr) & 0xffff; tmp <<= 16;
tmp |= translator_lduw(env, &ctx->base, addr);
return tmp; return tmp;
case 0: case 0:
ctx->base.pc_next += 4; ctx->base.pc_next += 4;
return cpu_ldl_code(env, addr); return translator_ldl(env, &ctx->base, addr);
default:
g_assert_not_reached();
} }
return 0; return 0;
} }
@ -190,22 +191,22 @@ static inline TCGv rx_index_addr(DisasContext *ctx, TCGv mem,
{ {
uint32_t dsp; uint32_t dsp;
tcg_debug_assert(ld < 3);
switch (ld) { switch (ld) {
case 0: case 0:
return cpu_regs[reg]; return cpu_regs[reg];
case 1: case 1:
dsp = cpu_ldub_code(ctx->env, ctx->base.pc_next) << size; dsp = translator_ldub(ctx->env, &ctx->base, ctx->base.pc_next) << size;
tcg_gen_addi_i32(mem, cpu_regs[reg], dsp); tcg_gen_addi_i32(mem, cpu_regs[reg], dsp);
ctx->base.pc_next += 1; ctx->base.pc_next += 1;
return mem; return mem;
case 2: case 2:
dsp = cpu_lduw_code(ctx->env, ctx->base.pc_next) << size; dsp = translator_lduw(ctx->env, &ctx->base, ctx->base.pc_next) << size;
tcg_gen_addi_i32(mem, cpu_regs[reg], dsp); tcg_gen_addi_i32(mem, cpu_regs[reg], dsp);
ctx->base.pc_next += 2; ctx->base.pc_next += 2;
return mem; return mem;
default:
g_assert_not_reached();
} }
return NULL;
} }
static inline MemOp mi_to_mop(unsigned mi) static inline MemOp mi_to_mop(unsigned mi)