diff options
| author | Yang Liu <liuyang22@iscas.ac.cn> | 2023-04-11 15:11:33 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-11 09:11:33 +0200 |
| commit | fdb6908474979b6602fa2c23087cf4ddc4c988e7 (patch) | |
| tree | 0f00f41a91b1279028411310f79043172bcc27e0 /src | |
| parent | 5d6307184941f6f2171153df6a5bb0105fcbce9e (diff) | |
| download | box64-fdb6908474979b6602fa2c23087cf4ddc4c988e7.tar.gz box64-fdb6908474979b6602fa2c23087cf4ddc4c988e7.zip | |
[RV64_DYNAREC] Fixed emit_sub8/16 (#685)
Diffstat (limited to 'src')
| -rw-r--r-- | src/dynarec/rv64/dynarec_rv64_emit_math.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/dynarec/rv64/dynarec_rv64_emit_math.c b/src/dynarec/rv64/dynarec_rv64_emit_math.c index d05ccc24..3564d684 100644 --- a/src/dynarec/rv64/dynarec_rv64_emit_math.c +++ b/src/dynarec/rv64/dynarec_rv64_emit_math.c @@ -390,11 +390,12 @@ void emit_sub8(dynarec_rv64_t* dyn, int ninst, int s1, int s2, int s3, int s4, i } SUB(s1, s1, s2); + ANDI(s1, s1, 0xff); IFX(X_SF) { - BGE(s1, xZR, 8); + SRLI(s3, s1, 7); + BEQZ(s3, 8); ORI(xFlags, xFlags, 1 << F_SF); } - ANDI(s1, s1, 0xff); IFX(X_PEND) { SB(s1, xEmu, offsetof(x64emu_t, res)); } @@ -436,11 +437,11 @@ void emit_sub16(dynarec_rv64_t* dyn, int ninst, int s1, int s2, int s3, int s4, IFX(X_PEND) { SH(s1, xEmu, offsetof(x64emu_t, res)); } + SLLI(s1, s1, 48); IFX(X_SF) { BGE(s1, xZR, 8); ORI(xFlags, xFlags, 1 << F_SF); } - SLLI(s1, s1, 48); SRLI(s1, s1, 48); CALC_SUB_FLAGS(s5, s2, s1, s3, s4, 16); |