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/dynarec | |
| 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/dynarec')
| -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 |
3 files changed, 27 insertions, 27 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) |