mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 15:27:46 -04:00
added branch cache to sh2 drc to improve cross-tcache jump speed
This commit is contained in:
parent
6822ba9d64
commit
d760c90f3a
4 changed files with 143 additions and 16 deletions
|
@ -179,6 +179,7 @@
|
|||
/* ldr and str */
|
||||
#define EOP_LDR_IMM2(cond,rd,rn,offset_12) EOP_C_AM2_IMM(cond,1,0,1,rn,rd,offset_12)
|
||||
#define EOP_LDRB_IMM2(cond,rd,rn,offset_12) EOP_C_AM2_IMM(cond,1,1,1,rn,rd,offset_12)
|
||||
#define EOP_STR_IMM2(cond,rd,rn,offset_12) EOP_C_AM2_IMM(cond,(offset_12) >= 0,0,0,rn,rd,abs(offset_12))
|
||||
|
||||
#define EOP_LDR_IMM( rd,rn,offset_12) EOP_C_AM2_IMM(A_COND_AL,1,0,1,rn,rd,offset_12)
|
||||
#define EOP_LDR_NEGIMM(rd,rn,offset_12) EOP_C_AM2_IMM(A_COND_AL,0,0,1,rn,rd,offset_12)
|
||||
|
@ -478,6 +479,9 @@ static int emith_xbranch(int cond, void *target, int is_call)
|
|||
#define emith_add_r_r(d, s) \
|
||||
emith_add_r_r_r(d, d, s)
|
||||
|
||||
#define emith_add_r_r_ptr(d, s) \
|
||||
emith_add_r_r_r(d, d, s)
|
||||
|
||||
#define emith_sub_r_r(d, s) \
|
||||
EOP_SUB_REG(A_COND_AL,0,d,d,s,A_AM1_LSL,0)
|
||||
|
||||
|
@ -684,6 +688,8 @@ static int emith_xbranch(int cond, void *target, int is_call)
|
|||
// misc
|
||||
#define emith_read_r_r_offs_c(cond, r, rs, offs) \
|
||||
EOP_LDR_IMM2(cond, r, rs, offs)
|
||||
#define emith_read_r_r_offs_ptr_c(cond, r, rs, offs) \
|
||||
emith_read_r_r_offs_c(cond, r, rs, offs)
|
||||
#define emith_read_r_r_r_c(cond, r, rs, rm) \
|
||||
EOP_LDR_REG_LSL(cond, r, rs, rm, 0)
|
||||
#define emith_read_r_r_r(r, rs, rm) \
|
||||
|
@ -716,8 +722,15 @@ static int emith_xbranch(int cond, void *target, int is_call)
|
|||
#define emith_read16_r_r_offs(r, rs, offs) \
|
||||
emith_read16_r_r_offs_c(A_COND_AL, r, rs, offs)
|
||||
|
||||
#define emith_write_r_r_offs_c(cond, r, rs, offs) \
|
||||
EOP_STR_IMM2(cond, r, rs, offs)
|
||||
#define emith_write_r_r_offs_ptr_c(cond, r, rs, offs) \
|
||||
emith_write_r_r_offs_c(cond, r, rs, offs)
|
||||
|
||||
#define emith_ctx_read_c(cond, r, offs) \
|
||||
emith_read_r_r_offs_c(cond, r, CONTEXT_REG, offs)
|
||||
#define emith_ctx_read(r, offs) \
|
||||
emith_read_r_r_offs(r, CONTEXT_REG, offs)
|
||||
emith_ctx_read_c(A_COND_AL, r, offs)
|
||||
|
||||
#define emith_ctx_read_ptr(r, offs) \
|
||||
emith_ctx_read(r, offs)
|
||||
|
|
|
@ -122,7 +122,7 @@ enum { xAX = 0, xCX, xDX, xBX, xSP, xBP, xSI, xDI };
|
|||
EMIT_OP_MODRM(0x01, 3, s, d)
|
||||
|
||||
#define emith_add_r_r_ptr(d, s) do { \
|
||||
EMIT_REX_IF(1, dst, src); \
|
||||
EMIT_REX_IF(1, s, d); \
|
||||
EMIT_OP_MODRM64(0x01, 3, s, d); \
|
||||
} while (0)
|
||||
|
||||
|
@ -260,6 +260,21 @@ enum { xAX = 0, xCX, xDX, xBX, xSP, xBP, xSI, xDI };
|
|||
} \
|
||||
} while (0)
|
||||
|
||||
// _r_r_r_shift
|
||||
#define emith_add_r_r_r_lsl(d, s1, s2, lslimm) do { \
|
||||
int tmp_ = rcache_get_tmp(); \
|
||||
emith_lsl(tmp_, s2, lslimm); \
|
||||
emith_add_r_r_r(d, s1, tmp_); \
|
||||
rcache_free_tmp(tmp_); \
|
||||
} while (0)
|
||||
|
||||
#define emith_add_r_r_r_lsr(d, s1, s2, lslimm) do { \
|
||||
int tmp_ = rcache_get_tmp(); \
|
||||
emith_lsr(tmp_, s2, lslimm); \
|
||||
emith_add_r_r_r(d, s1, tmp_); \
|
||||
rcache_free_tmp(tmp_); \
|
||||
} while (0)
|
||||
|
||||
// _r_r_shift
|
||||
#define emith_or_r_r_lsl(d, s, lslimm) do { \
|
||||
int tmp_ = rcache_get_tmp(); \
|
||||
|
@ -361,8 +376,12 @@ enum { xAX = 0, xCX, xDX, xBX, xSP, xBP, xSI, xDI };
|
|||
|
||||
#define emith_read_r_r_offs_c(cond, r, rs, offs) \
|
||||
emith_read_r_r_offs(r, rs, offs)
|
||||
#define emith_read_r_r_offs_ptr_c(cond, r, rs, offs) \
|
||||
emith_read_r_r_offs_ptr(r, rs, offs)
|
||||
#define emith_write_r_r_offs_c(cond, r, rs, offs) \
|
||||
emith_write_r_r_offs(r, rs, offs)
|
||||
#define emith_write_r_r_offs_ptr_c(cond, r, rs, offs) \
|
||||
emith_write_r_r_offs_ptr(r, rs, offs)
|
||||
#define emith_read8_r_r_offs_c(cond, r, rs, offs) \
|
||||
emith_read8_r_r_offs(r, rs, offs)
|
||||
#define emith_write8_r_r_offs_c(cond, r, rs, offs) \
|
||||
|
@ -583,9 +602,15 @@ enum { xAX = 0, xCX, xDX, xBX, xSP, xBP, xSI, xDI };
|
|||
|
||||
#define emith_read_r_r_offs(r, rs, offs) \
|
||||
emith_deref_op(0x8b, r, rs, offs)
|
||||
#define emith_read_r_r_offs_ptr(r, rs, offs) \
|
||||
EMIT_REX_IF(1, r, rs); \
|
||||
emith_deref_op(0x8b, r, rs, offs)
|
||||
|
||||
#define emith_write_r_r_offs(r, rs, offs) \
|
||||
emith_deref_op(0x89, r, rs, offs)
|
||||
#define emith_write_r_r_offs_ptr(r, rs, offs) \
|
||||
EMIT_REX_IF(1, r, rs); \
|
||||
emith_deref_op(0x89, r, rs, offs)
|
||||
|
||||
// note: don't use prefixes on this
|
||||
#define emith_read8_r_r_offs(r, rs, offs) do { \
|
||||
|
@ -664,6 +689,8 @@ enum { xAX = 0, xCX, xDX, xBX, xSP, xBP, xSI, xDI };
|
|||
|
||||
#define emith_ctx_read(r, offs) \
|
||||
emith_read_r_r_offs(r, CONTEXT_REG, offs)
|
||||
#define emith_ctx_read_c(cond, r, offs) \
|
||||
emith_ctx_read(r, offs)
|
||||
|
||||
#define emith_ctx_read_ptr(r, offs) do { \
|
||||
EMIT_REX_IF(1, r, CONTEXT_REG); \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue