[DYNAREC] Fixed and optimized 0F BA opcodes

This commit is contained in:
ptitSeb 2022-10-01 23:29:38 +02:00
parent 1c110080a8
commit cc26096c28
2 changed files with 15 additions and 26 deletions

View File

@ -1370,11 +1370,7 @@ uintptr_t dynarec64_0F(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin
}
u8 = F8;
u8&=rex.w?0x3f:0x1f;
if(u8) {
LSRxw(x1, ed, u8);
ed = x1;
}
BFIw(xFlags, ed, F_CF, 1);
BFXILxw(xFlags, ed, u8, 1); // inject 1 bit from u8 to F_CF (i.e. pos 0)
break;
case 5:
INST_NAME("BTS Ed, Ib");
@ -1390,13 +1386,8 @@ uintptr_t dynarec64_0F(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin
}
u8 = F8;
u8&=(rex.w?0x3f:0x1f);
if(u8) {
LSRxw(x4, ed, u8);
} else {
MOVw_REG(x4, ed);
}
BFIw(xFlags, x4, F_CF, 1);
TBNZ_MARK3(x4, 0); // bit already set, jump to next instruction
BFXILxw(xFlags, ed, u8, 1); // inject 1 bit from u8 to F_CF (i.e. pos 0)
TBNZ_MARK3(xFlags, 0); // bit already set, jump to next instruction
MOV32w(x4, 1);
EORxw_REG_LSL(ed, ed, x4, u8);
if(wback) {
@ -1418,14 +1409,9 @@ uintptr_t dynarec64_0F(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin
}
u8 = F8;
u8&=(rex.w?0x3f:0x1f);
if(u8) {
LSRxw(x4, ed, u8);
} else {
MOVw_REG(x4, ed);
}
BFIw(xFlags, x4, F_CF, 1);
TBZ_MARK3(x4, 0); // bit already clear, jump to next instruction
//MOVW(x14, 1); // already 0x01
BFXILxw(xFlags, ed, u8, 1); // inject 1 bit from u8 to F_CF (i.e. pos 0)
TBZ_MARK3(xFlags, 0); // bit already clear, jump to next instruction
MOV32w(x4, 1);
EORxw_REG_LSL(ed, ed, x4, u8);
if(wback) {
STRxw_U12(ed, wback, fixedaddress);
@ -1446,12 +1432,7 @@ uintptr_t dynarec64_0F(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin
}
u8 = F8;
u8&=(rex.w?0x3f:0x1f);
if(u8) {
LSRxw(x4, ed, u8);
} else {
MOVw_REG(x4, ed);
}
BFIw(xFlags, x4, F_CF, 1);
BFXILxw(xFlags, ed, u8, 1); // inject 1 bit from u8 to F_CF (i.e. pos 0)
MOV32w(x4, 1);
EORxw_REG_LSL(ed, ed, x4, u8);
if(wback) {

View File

@ -408,10 +408,18 @@
#define CBNZx_MARK3(reg) \
j64 = GETMARK3-(dyn->native_size); \
CBNZx(reg, j64)
// Branch to MARK3 if reg is not 0 (use j64)
#define CBNZw_MARK3(reg) \
j64 = GETMARK3-(dyn->native_size); \
CBNZw(reg, j64)
// Branch to MARK3 if reg is 0 (use j64)
#define CBZx_MARK3(reg) \
j64 = GETMARK3-(dyn->native_size); \
CBZx(reg, j64)
// Branch to MARK3 if reg is 0 (use j64)
#define CBZw_MARK3(reg) \
j64 = GETMARK3-(dyn->native_size); \
CBZw(reg, j64)
// Test bit N of A and branch to MARK3 if not set
#define TBZ_MARK3(A, N) \
j64 = GETMARK3-(dyn->native_size); \