tcg/e2k: fixes

This commit is contained in:
Denis Drakhnia 2024-03-20 15:14:54 +02:00
parent 72a7184ef4
commit cf604aa754
1 changed files with 22 additions and 11 deletions

View File

@ -1128,7 +1128,7 @@ static void tcg_out_clz_int(TCGContext *s, TCGType type, TCGReg ret,
tcg_out_start(&bundle);
e2k_insert_alc(&bundle, 0, cmp, PREG_TMP0, UIMM5(0), GPR(a0), 0);
if (do_bitrev) {
e2k_insert_alc(&bundle, 1, bitrev, TCG_REG_TMP0, 0, GPR(a0), 0);
e2k_insert_alc(&bundle, 1, bitrev, GPR(TCG_REG_TMP0), 0, GPR(a0), 0);
a0 = TCG_REG_TMP0;
}
tcg_out_end(s, &bundle);
@ -1382,10 +1382,8 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContext *s, TCGReg *pbase,
tcg_out_alf1_rri(s, 0, ALC_SHRD, TCG_REG_TMP2, addr_reg,
s->page_bits - CPU_TLB_ENTRY_BITS);
tcg_out_alf1_rrr(s, 0, ALC_ANDD, TCG_REG_TMP2, TCG_REG_TMP2,
TCG_REG_TMP0);
tcg_out_alf1_rrr(s, 0, ALC_ADDD, TCG_REG_TMP2, TCG_REG_TMP2,
TCG_REG_TMP1);
tcg_out_alf1_rrr(s, 0, ALC_ANDD, TCG_REG_TMP2, TCG_REG_TMP2, TCG_REG_TMP0);
tcg_out_alf1_rrr(s, 0, ALC_ADDD, TCG_REG_TMP2, TCG_REG_TMP2, TCG_REG_TMP1);
/*
* For aligned accesses, we check the first byte and include the alignment
@ -2124,14 +2122,15 @@ static void tcg_target_qemu_prologue(TCGContext *s)
e2k_insert_movi(&bundle, 2, TCG_GUEST_BASE_REG, guest_base);
tcg_regset_set_reg(s->reserved_regs, TCG_GUEST_BASE_REG);
#endif
tcg_out_end(s, &bundle);
/* user stack is freed automatically */
tcg_out_alf1_rri(s, 0, ALC_GETSP, TCG_REG_SP, 0, -FRAME_SIZE);
/* Call generated code */
tcg_out_ct(s, CTPR1, CT_ALWAYS, 0);
tcg_out_start(&bundle);
/* user stack is freed automatically */
e2k_insert_lit(&bundle, 0, -FRAME_SIZE);
e2k_insert_alc(&bundle, 0, ALC_GETSP, GPR(TCG_REG_SP), 0, 0, 0);
/* Call generated code */
e2k_insert_ct(&bundle, CTPR1, CT_ALWAYS, 0);
tcg_out_end(s, &bundle);
/* Return path for goto_ptr. Set return value to 0 */
tcg_code_gen_epilogue = tcg_splitwx_to_rx(s->code_ptr);
@ -2153,8 +2152,20 @@ static void tcg_target_init(TCGContext *s)
tcg_target_available_regs[TCG_TYPE_I64] = 0xffffffff;
tcg_target_call_clobber_regs = -1u;
tcg_regset_reset_reg(tcg_target_call_clobber_regs, TCG_REG_R0);
tcg_regset_reset_reg(tcg_target_call_clobber_regs, TCG_REG_R1);
tcg_regset_reset_reg(tcg_target_call_clobber_regs, TCG_REG_R2);
tcg_regset_reset_reg(tcg_target_call_clobber_regs, TCG_REG_R3);
tcg_regset_reset_reg(tcg_target_call_clobber_regs, TCG_REG_R4);
tcg_regset_reset_reg(tcg_target_call_clobber_regs, TCG_REG_R5);
tcg_regset_reset_reg(tcg_target_call_clobber_regs, TCG_REG_R6);
tcg_regset_reset_reg(tcg_target_call_clobber_regs, TCG_REG_R7);
s->reserved_regs = 0;
tcg_regset_set_reg(s->reserved_regs, TCG_REG_TMP0);
tcg_regset_set_reg(s->reserved_regs, TCG_REG_TMP1);
tcg_regset_set_reg(s->reserved_regs, TCG_REG_TMP2);
tcg_regset_set_reg(s->reserved_regs, TCG_REG_SP);
}
typedef struct {