sh2 drc, fixes for mips, ppc, i386 backends (mostly 64 bit related)

This commit is contained in:
kub 2022-01-19 17:09:55 +00:00
parent b6887843e5
commit 05138bbd89
8 changed files with 31 additions and 25 deletions

View file

@ -49,7 +49,7 @@
#define LOOP_DETECTION 1
#define LOOP_OPTIMIZER 1
#define T_OPTIMIZER 1
#define DIV_OPTIMIZER 0
#define DIV_OPTIMIZER 1
#define MAX_LITERAL_OFFSET 0x200 // max. MOVA, MOV @(PC) offset
#define MAX_LOCAL_TARGETS (BLOCK_INSN_LIMIT / 4)
@ -2588,9 +2588,9 @@ static void emit_le_swap(int cond, int r)
{
#if CPU_IS_LE
if (cond == -1)
emith_ror(r, r, 16);
emith_ror(r, r, 16);
else
emith_ror_c(cond, r, r, 16);
emith_ror_c(cond, r, r, 16);
#endif
}
@ -2599,9 +2599,9 @@ static void emit_le_ptr8(int cond, int r)
{
#if CPU_IS_LE
if (cond == -1)
emith_eor_r_imm_ptr(r, 1);
emith_eor_r_imm_ptr(r, 1);
else
emith_eor_r_imm_ptr_c(cond, r, 1);
emith_eor_r_imm_ptr_c(cond, r, 1);
#endif
}
@ -3837,7 +3837,7 @@ static void REGPARM(2) *sh2_translate(SH2 *sh2, int tcache_id)
else
u = (s16)FETCH_OP(opd->imm);
// tweak for Blackthorne: avoid stack overwriting
if (GET_Rn() == SHR_SP && u == 0x0603f800) u = 0x0603f880;
if (GET_Rn() == SHR_SP && u == 0x0603f800) u = 0x0603f900;
gconst_new(GET_Rn(), u);
}
else
@ -3980,6 +3980,7 @@ static void REGPARM(2) *sh2_translate(SH2 *sh2, int tcache_id)
// divide 64/32
tmp4 = rcache_get_reg(div(opd).ro, RC_GR_READ, NULL);
emith_ctx_write(tmp4, offsetof(SH2, drc_tmp));
rcache_free(tmp4);
tmp = rcache_get_tmp_arg(1);
emith_add_r_r_ptr_imm(tmp, CONTEXT_REG, offsetof(SH2, drc_tmp));
rcache_get_reg_arg(0, div(opd).rn, NULL);
@ -4100,6 +4101,7 @@ static void REGPARM(2) *sh2_translate(SH2 *sh2, int tcache_id)
// divide 64/32
tmp4 = rcache_get_reg(div(opd).ro, RC_GR_READ, NULL);
emith_ctx_write(tmp4, offsetof(SH2, drc_tmp));
rcache_free(tmp4);
tmp = rcache_get_reg_arg(0, div(opd).rn, NULL);
tmp2 = rcache_get_reg_arg(2, div(opd).rm, NULL);
tmp3 = rcache_get_tmp_arg(1);

View file

@ -115,6 +115,7 @@ void sh2_pack(const SH2 *sh2, unsigned char *buff)
p[0] = sh2->pending_int_irq;
p[1] = sh2->pending_int_vector;
p[2] = sh2->m68krcycles_done;
}
void sh2_unpack(SH2 *sh2, const unsigned char *buff)
@ -127,6 +128,7 @@ void sh2_unpack(SH2 *sh2, const unsigned char *buff)
sh2->pending_int_irq = p[0];
sh2->pending_int_vector = p[1];
sh2->test_irq = 1;
sh2->m68krcycles_done = p[2];
}
#ifdef DRC_CMP