diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2021-03-20 18:47:50 +0100 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2021-03-20 18:47:50 +0100 |
| commit | 79c4c8bdd3d0c8d02915ec721e5e1a46664b445d (patch) | |
| tree | 3496816e09d3959e796050c77f298422897fd9c9 /src | |
| parent | 6be2c376e2b5bf784418618c6ae260be6a7a200f (diff) | |
| download | box64-79c4c8bdd3d0c8d02915ec721e5e1a46664b445d.tar.gz box64-79c4c8bdd3d0c8d02915ec721e5e1a46664b445d.zip | |
[DYNAREC] Added (66) 30..35 XOR opcodes
Diffstat (limited to 'src')
| -rwxr-xr-x | src/dynarec/dynarec_arm64_00.c | 28 | ||||
| -rwxr-xr-x | src/dynarec/dynarec_arm64_66.c | 28 | ||||
| -rwxr-xr-x | src/dynarec/dynarec_arm64_emit_logic.c | 128 | ||||
| -rwxr-xr-x | src/dynarec/dynarec_arm64_helper.h | 4 |
4 files changed, 116 insertions, 72 deletions
diff --git a/src/dynarec/dynarec_arm64_00.c b/src/dynarec/dynarec_arm64_00.c index 7daf88fd..61a18f8f 100755 --- a/src/dynarec/dynarec_arm64_00.c +++ b/src/dynarec/dynarec_arm64_00.c @@ -375,6 +375,15 @@ uintptr_t dynarec64_00(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin emit_sub32c(dyn, ninst, rex, xRAX, i64, x3, x4, x5); break; + case 0x30: + INST_NAME("XOR Eb, Gb"); + SETFLAGS(X_ALL, SF_SET); + nextop = F8; + GETEB(x1, 0); + GETGB(x2); + emit_xor8(dyn, ninst, x1, x2, x4, x5); + EBBACK; + break; case 0x31: INST_NAME("XOR Ed, Gd"); SETFLAGS(X_ALL, SF_SET); @@ -384,7 +393,15 @@ uintptr_t dynarec64_00(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin emit_xor32(dyn, ninst, rex, ed, gd, x3, x4); WBACK; break; - + case 0x32: + INST_NAME("XOR Gb, Eb"); + SETFLAGS(X_ALL, SF_SET); + nextop = F8; + GETEB(x2, 0); + GETGB(x1); + emit_xor8(dyn, ninst, x1, x2, x3, x4); + GBBACK; + break; case 0x33: INST_NAME("XOR Gd, Ed"); SETFLAGS(X_ALL, SF_SET); @@ -393,7 +410,14 @@ uintptr_t dynarec64_00(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin GETED(0); emit_xor32(dyn, ninst, rex, gd, ed, x3, x4); break; - + case 0x34: + INST_NAME("XOR AL, Ib"); + SETFLAGS(X_ALL, SF_SET); + u8 = F8; + UXTBw(x1, xRAX); + emit_xor8c(dyn, ninst, x1, u8, x3, x4); + BFIw(xRAX, x1, 0, 8); + break; case 0x35: INST_NAME("XOR EAX, Id"); SETFLAGS(X_ALL, SF_SET); diff --git a/src/dynarec/dynarec_arm64_66.c b/src/dynarec/dynarec_arm64_66.c index dcbefd77..64bfe765 100755 --- a/src/dynarec/dynarec_arm64_66.c +++ b/src/dynarec/dynarec_arm64_66.c @@ -230,6 +230,34 @@ uintptr_t dynarec64_66(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin BFIw(xRAX, x1, 0, 16); break; + case 0x31: + INST_NAME("XOR Ew, Gw"); + SETFLAGS(X_ALL, SF_SET); + nextop = F8; + GETGW(x2); + GETEW(x1, 0); + emit_xor16(dyn, ninst, x1, x2, x4, x5); + EWBACK; + break; + case 0x33: + INST_NAME("XOR Gw, Ew"); + SETFLAGS(X_ALL, SF_SET); + nextop = F8; + GETGW(x1); + GETEW(x2, 0); + emit_xor16(dyn, ninst, x1, x2, x3, x4); + GWBACK; + break; + case 0x35: + INST_NAME("XOR AX, Iw"); + SETFLAGS(X_ALL, SF_SET); + i32 = F16; + UXTHw(x1, xRAX); + MOV32w(x2, i32); + emit_xor16(dyn, ninst, x1, x2, x3, x4); + BFIx(xRAX, x1, 0, 16); + break; + case 0xD1: case 0xD3: nextop = F8; diff --git a/src/dynarec/dynarec_arm64_emit_logic.c b/src/dynarec/dynarec_arm64_emit_logic.c index 519b697b..66f2cc9c 100755 --- a/src/dynarec/dynarec_arm64_emit_logic.c +++ b/src/dynarec/dynarec_arm64_emit_logic.c @@ -293,40 +293,36 @@ void emit_or8c(dynarec_arm_t* dyn, int ninst, int s1, int32_t c, int s3, int s4) } // emit XOR8 instruction, from s1 , s2, store result in s1 using s3 and s4 as scratch, s4 can be same as s2 (and so s2 destroyed) -//void emit_xor8(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4) -//{ -// IFX(X_PEND) { -// STR_IMM9(s1, xEmu, offsetof(x64emu_t, op1)); -// STR_IMM9(s2, xEmu, offsetof(x64emu_t, op2)); -// SET_DF(s3, d_xor8); -// } else IFX(X_ALL) { -// SET_DFNONE(s3); -// } -// IFX(X_ALL) { -// XORS_REG_LSL_IMM5(s1, s1, s2, 0); -// } else { -// XOR_REG_LSL_IMM5(s1, s1, s2, 0); -// } -// IFX(X_PEND) { -// STR_IMM9(s1, xEmu, offsetof(x64emu_t, res)); -// } -// IFX(X_CF | X_AF | X_ZF) { -// BIC_IMM8(xFlags, xFlags, (1<<F_CF)|(1<<F_AF)|(1<<F_ZF), 0); -// } -// IFX(X_OF) { -// BIC_IMM8(xFlags, xFlags, 0b10, 0x0b); -// } -// IFX(X_ZF) { -// ORR_IMM8_COND(cEQ, xFlags, xFlags, 1<<F_ZF, 0); -// } -// IFX(X_SF) { -// MOV_REG_LSR_IMM5(s3, s1, 7); -// BFI(xFlags, s3, F_SF, 1); -// } -// IFX(X_PF) { -// emit_pf(dyn, ninst, s1, s3, s4); -// } -//} +void emit_xor8(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4) +{ + IFX(X_PEND) { + STRB_REG(s1, xEmu, offsetof(x64emu_t, op1)); + STRB_REG(s2, xEmu, offsetof(x64emu_t, op2)); + SET_DF(s3, d_xor8); + } else IFX(X_ALL) { + SET_DFNONE(s3); + } + EORx_REG(s1, s1, s2); + IFX(X_PEND) { + STRB_U12(s1, xEmu, offsetof(x64emu_t, res)); + } + IFX(X_CF | X_AF | X_OF) { + MOV32w(s3, (1<<F_CF)|(1<<F_AF)|(1<<F_OF)); + BICw(xFlags, xFlags, s3); + } + IFX(X_ZF) { + TSTw_REG(s1, s1); + CSETw(s3, cEQ); + BFIw(xFlags, s3, F_ZF, 1); + } + IFX(X_SF) { + LSRw(s3, s1, 7); + BFIw(xFlags, s3, F_SF, 1); + } + IFX(X_PF) { + emit_pf(dyn, ninst, s1, s3, s4); + } +} // emit XOR8 instruction, from s1 , constant c, store result in s1 using s3 and s4 as scratch void emit_xor8c(dynarec_arm_t* dyn, int ninst, int s1, int32_t c, int s3, int s4) @@ -512,40 +508,36 @@ void emit_or16(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4) //} // emit XOR16 instruction, from s1 , s2, store result in s1 using s3 and s4 as scratch, s4 can be same as s2 (and so s2 destroyed) -//void emit_xor16(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4) -//{ -// IFX(X_PEND) { -// STR_IMM9(s1, xEmu, offsetof(x64emu_t, op1)); -// STR_IMM9(s2, xEmu, offsetof(x64emu_t, op2)); -// SET_DF(s3, d_xor16); -// } else IFX(X_ALL) { -// SET_DFNONE(s3); -// } -// IFX(X_ALL) { -// XORS_REG_LSL_IMM5(s1, s1, s2, 0); -// } else { -// XOR_REG_LSL_IMM5(s1, s1, s2, 0); -// } -// IFX(X_PEND) { -// STR_IMM9(s1, xEmu, offsetof(x64emu_t, res)); -// } -// IFX(X_CF | X_AF | X_ZF) { -// BIC_IMM8(xFlags, xFlags, (1<<F_CF)|(1<<F_AF)|(1<<F_ZF), 0); -// } -// IFX(X_OF) { -// BIC_IMM8(xFlags, xFlags, 0b10, 0x0b); -// } -// IFX(X_ZF) { -// ORR_IMM8_COND(cEQ, xFlags, xFlags, 1<<F_ZF, 0); -// } -// IFX(X_SF) { -// MOV_REG_LSR_IMM5(s3, s1, 15); -// BFI(xFlags, s3, F_SF, 1); -// } -// IFX(X_PF) { -// emit_pf(dyn, ninst, s1, s3, s4); -// } -//} +void emit_xor16(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4) +{ + IFX(X_PEND) { + STRH_U12(s1, xEmu, offsetof(x64emu_t, op1)); + STRH_U12(s2, xEmu, offsetof(x64emu_t, op2)); + SET_DF(s3, d_xor16); + } else IFX(X_ALL) { + SET_DFNONE(s3); + } + EORw_REG(s1, s1, s2); + IFX(X_PEND) { + STRH_U12(s1, xEmu, offsetof(x64emu_t, res)); + } + IFX(X_CF | X_AF | X_OF) { + MOV32w(s3, (1<<F_CF)|(1<<F_AF)|(1<<F_OF)); + BICw(xFlags, xFlags, s3); + } + IFX(X_ZF) { + ANDSw_mask(s1, s1, 0, 15); //mask=0xffff + CSETw(s3, cEQ); + BFIw(xFlags, s3, F_ZF, 1); + } + IFX(X_SF) { + LSRw(s3, s1, 15); + BFIw(xFlags, s3, F_SF, 1); + } + IFX(X_PF) { + emit_pf(dyn, ninst, s1, s3, s4); + } +} // emit XOR16 instruction, from s1 , constant c, store result in s1 using s3 and s4 as scratch //void emit_xor16c(dynarec_arm_t* dyn, int ninst, int s1, int32_t c, int s3, int s4) diff --git a/src/dynarec/dynarec_arm64_helper.h b/src/dynarec/dynarec_arm64_helper.h index 09503ab9..1629170a 100755 --- a/src/dynarec/dynarec_arm64_helper.h +++ b/src/dynarec/dynarec_arm64_helper.h @@ -656,7 +656,7 @@ void emit_and32(dynarec_arm_t* dyn, int ninst, rex_t rex, int s1, int s2, int s3 void emit_and32c(dynarec_arm_t* dyn, int ninst, rex_t rex, int s1, int64_t c, int s3, int s4); void emit_or8(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4); void emit_or8c(dynarec_arm_t* dyn, int ninst, int s1, int32_t c, int s3, int s4); -//void emit_xor8(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4); +void emit_xor8(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4); void emit_xor8c(dynarec_arm_t* dyn, int ninst, int s1, int32_t c, int s3, int s4); void emit_and8(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4); void emit_and8c(dynarec_arm_t* dyn, int ninst, int s1, int32_t c, int s3, int s4); @@ -666,7 +666,7 @@ void emit_sub16(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4); //void emit_sub16c(dynarec_arm_t* dyn, int ninst, int s1, int32_t c, int s3, int s4); void emit_or16(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4); //void emit_or16c(dynarec_arm_t* dyn, int ninst, int s1, int32_t c, int s3, int s4); -//void emit_xor16(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4); +void emit_xor16(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4); //void emit_xor16c(dynarec_arm_t* dyn, int ninst, int s1, int32_t c, int s3, int s4); void emit_and16(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4); //void emit_and16c(dynarec_arm_t* dyn, int ninst, int s1, int32_t c, int s3, int s4); |