diff options
| author | Yang Liu <numbksco@gmail.com> | 2024-05-22 19:06:43 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-22 13:06:43 +0200 |
| commit | 3faabb478d2f5ccaec250273750bd4b6d6adabea (patch) | |
| tree | 77a0583576d4f9e684c03eb7a037db438d46f996 /src | |
| parent | 2c127fe69c421ec9ab9928c6364018ca3828a64b (diff) | |
| download | box64-3faabb478d2f5ccaec250273750bd4b6d6adabea.tar.gz box64-3faabb478d2f5ccaec250273750bd4b6d6adabea.zip | |
[DYNAREC] Simplified emit_pf helper (#1518)
* [DYNAREC] Simplified emit_pf helper * Remove unused function and outdated comments
Diffstat (limited to 'src')
| -rw-r--r-- | src/dynarec/arm64/dynarec_arm64_emit_tests.c | 3 | ||||
| -rw-r--r-- | src/dynarec/la64/dynarec_la64_helper.c | 22 | ||||
| -rw-r--r-- | src/dynarec/rv64/dynarec_rv64_helper.c | 29 | ||||
| -rw-r--r-- | src/emu/x64emu.c | 5 | ||||
| -rw-r--r-- | src/include/x64emu.h | 1 |
5 files changed, 27 insertions, 33 deletions
diff --git a/src/dynarec/arm64/dynarec_arm64_emit_tests.c b/src/dynarec/arm64/dynarec_arm64_emit_tests.c index 5c402158..6a78ce8e 100644 --- a/src/dynarec/arm64/dynarec_arm64_emit_tests.c +++ b/src/dynarec/arm64/dynarec_arm64_emit_tests.c @@ -252,7 +252,6 @@ void emit_test32(dynarec_arm_t* dyn, int ninst, rex_t rex, int s1, int s2, int s LSRxw(s4, s3, rex.w?63:31); BFIw(xFlags, s4, F_SF, 1); } - // PF: (((emu->x64emu_parity_tab[(res) / 32] >> ((res) % 32)) & 1) == 0) IFX(X_PF) { emit_pf(dyn, ninst, s3, s5); } @@ -283,7 +282,6 @@ void emit_test16(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4, LSRw(s4, s5, 15); BFIw(xFlags, s4, F_SF, 1); } - // PF: (((emu->x64emu_parity_tab[(res) / 32] >> ((res) % 32)) & 1) == 0) IFX(X_PF) { emit_pf(dyn, ninst, s5, s4); } @@ -314,7 +312,6 @@ void emit_test8(dynarec_arm_t* dyn, int ninst, int s1, int s2, int s3, int s4, i LSRw(s4, s5, 7); BFIw(xFlags, s4, F_SF, 1); } - // PF: (((emu->x64emu_parity_tab[(res) / 32] >> ((res) % 32)) & 1) == 0) IFX(X_PF) { emit_pf(dyn, ninst, s5, s4); } diff --git a/src/dynarec/la64/dynarec_la64_helper.c b/src/dynarec/la64/dynarec_la64_helper.c index 9c59e59c..85bd950c 100644 --- a/src/dynarec/la64/dynarec_la64_helper.c +++ b/src/dynarec/la64/dynarec_la64_helper.c @@ -767,18 +767,18 @@ void emit_pf(dynarec_la64_t* dyn, int ninst, int s1, int s3, int s4) { MAYUSE(dyn); MAYUSE(ninst); - // PF: (((emu->x64emu_parity_tab[(res&0xff) / 32] >> ((res&0xff) % 32)) & 1) == 0) - MOV64x(s4, (uintptr_t)GetParityTab()); - SRLI_D(s3, s1, 3); - ANDI(s3, s3, 28); - ADD_D(s4, s4, s3); - LD_W(s4, s4, 0); - NOR(s4, xZR, s4); - SRL_W(s4, s4, s1); - ANDI(s4, s4, 1); - BEQZ(s4, 8); - ORI(xFlags, xFlags, 1 << F_PF); + SRLI_D(s3, s1, 4); + XOR(s3, s3, s1); + + SRLI_D(s4, s3, 2); + XOR(s4, s3, s4); + + SRLI_D(s3, s4, 1); + XOR(s3, s3, s4); + + XORI(s3, s3, 1); + BSTRINS_D(xFlags, s3, F_PF, F_PF); } void fpu_reset_cache(dynarec_la64_t* dyn, int ninst, int reset_n) diff --git a/src/dynarec/rv64/dynarec_rv64_helper.c b/src/dynarec/rv64/dynarec_rv64_helper.c index c87cd4f7..e64ccc48 100644 --- a/src/dynarec/rv64/dynarec_rv64_helper.c +++ b/src/dynarec/rv64/dynarec_rv64_helper.c @@ -2250,19 +2250,22 @@ void fpu_unreflectcache(dynarec_rv64_t* dyn, int ninst, int s1, int s2, int s3) void emit_pf(dynarec_rv64_t* dyn, int ninst, int s1, int s3, int s4) { - MAYUSE(dyn); MAYUSE(ninst); - // PF: (((emu->x64emu_parity_tab[(res&0xff) / 32] >> ((res&0xff) % 32)) & 1) == 0) - MOV64x(s4, (uintptr_t)GetParityTab()); - SRLI(s3, s1, 3); - ANDI(s3, s3, 28); - ADD(s4, s4, s3); - LW(s4, s4, 0); - NOT(s4, s4); - SRLW(s4, s4, s1); - ANDI(s4, s4, 1); - - BEQZ(s4, 8); - ORI(xFlags, xFlags, 1 << F_PF); + MAYUSE(dyn); + MAYUSE(ninst); + + SRLI(s3, s1, 4); + XOR(s3, s3, s1); + + SRLI(s4, s3, 2); + XOR(s4, s3, s4); + + SRLI(s3, s4, 1); + XOR(s3, s3, s4); + + ANDI(s3, s3, 1); + XORI(s3, s3, 1); + SLLI(s3, s3, F_PF); + OR(xFlags, xFlags, s3); } void fpu_reset_cache(dynarec_rv64_t* dyn, int ninst, int reset_n) diff --git a/src/emu/x64emu.c b/src/emu/x64emu.c index 68a9d4e0..2b8f94bc 100644 --- a/src/emu/x64emu.c +++ b/src/emu/x64emu.c @@ -48,11 +48,6 @@ static uint32_t x86emu_parity_tab[8] = 0x69969669, }; -uint32_t* GetParityTab() -{ - return x86emu_parity_tab; -} - static void internalX64Setup(x64emu_t* emu, box64context_t *context, uintptr_t start, uintptr_t stack, int stacksize, int ownstack) { emu->context = context; diff --git a/src/include/x64emu.h b/src/include/x64emu.h index 450f7a63..5591823b 100644 --- a/src/include/x64emu.h +++ b/src/include/x64emu.h @@ -15,7 +15,6 @@ void CopyEmu(x64emu_t *newemu, const x64emu_t* emu); void SetTraceEmu(uintptr_t trace_start, uintptr_t trace_end); box64context_t* GetEmuContext(x64emu_t* emu); -uint32_t* GetParityTab(void); uint32_t GetEAX(x64emu_t *emu); uint64_t GetRAX(x64emu_t *emu); |