diff options
| author | xctan <xctan@cirno.icu> | 2023-12-24 20:50:51 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-12-24 13:50:51 +0100 |
| commit | 4ee6ae5da1290f3747d51649247f77ef3b072e3a (patch) | |
| tree | 2196bb9348cd9c0ff15770958a4a28c7bdd43a8d /src | |
| parent | 2c8d2d8643c451fe7829f7c86374ae08945a79f2 (diff) | |
| download | box64-4ee6ae5da1290f3747d51649247f77ef3b072e3a.tar.gz box64-4ee6ae5da1290f3747d51649247f77ef3b072e3a.zip | |
[DYNAREC_RV64] Fixed shift masks for GI (#1160)
* [DYNAREC_RV64] Fixed SHLD for GI * [DYNAREC_RV64] Fixed SHRD for GI * [DYNAREC_RV64] Fixed shamt mask of 16-bit shifts
Diffstat (limited to 'src')
| -rw-r--r-- | src/dynarec/rv64/dynarec_rv64_66.c | 14 | ||||
| -rw-r--r-- | src/dynarec/rv64/dynarec_rv64_emit_shift.c | 2 |
2 files changed, 9 insertions, 7 deletions
diff --git a/src/dynarec/rv64/dynarec_rv64_66.c b/src/dynarec/rv64/dynarec_rv64_66.c index d4e196c6..4f58ff98 100644 --- a/src/dynarec/rv64/dynarec_rv64_66.c +++ b/src/dynarec/rv64/dynarec_rv64_66.c @@ -887,13 +887,13 @@ uintptr_t dynarec64_66(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int ni SETFLAGS(X_ALL, SF_PENDING); GETEW(x1, 1); u8 = F8; - UFLAG_IF {MOV32w(x2, (u8&0x1f));} + UFLAG_IF {MOV32w(x2, (u8&15));} UFLAG_OP12(ed, x2) if(MODREG) { - SLLI(ed, ed, 48+(u8&0x1f)); + SLLI(ed, ed, 48+(u8&15)); SRLI(ed, ed, 48); } else { - SLLI(ed, ed, u8&0x1f); + SLLI(ed, ed, u8&15); } EWBACK; UFLAG_RES(ed); @@ -905,9 +905,9 @@ uintptr_t dynarec64_66(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int ni SETFLAGS(X_ALL, SF_PENDING); GETEW(x1, 1); u8 = F8; - UFLAG_IF {MOV32w(x2, (u8&0x1f));} + UFLAG_IF {MOV32w(x2, (u8&15));} UFLAG_OP12(ed, x2) - SRLI(ed, ed, u8&0x1f); + SRLI(ed, ed, u8&15); EWBACK; UFLAG_RES(ed); UFLAG_DF(x3, d_shr16); @@ -918,9 +918,9 @@ uintptr_t dynarec64_66(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int ni UFLAG_IF {MESSAGE(LOG_DUMP, "Need Optimization for flags\n");} GETSEW(x1, 1); u8 = F8; - UFLAG_IF {MOV32w(x2, (u8&0x1f));} + UFLAG_IF {MOV32w(x2, (u8&15));} UFLAG_OP12(ed, x2) - SRAI(ed, ed, u8&0x1f); + SRAI(ed, ed, u8&15); if(MODREG) { ZEXTH(ed, ed); } diff --git a/src/dynarec/rv64/dynarec_rv64_emit_shift.c b/src/dynarec/rv64/dynarec_rv64_emit_shift.c index 2460bd72..0fdc10e3 100644 --- a/src/dynarec/rv64/dynarec_rv64_emit_shift.c +++ b/src/dynarec/rv64/dynarec_rv64_emit_shift.c @@ -497,6 +497,7 @@ void emit_ror32c(dynarec_rv64_t* dyn, int ninst, rex_t rex, int s1, uint32_t c, // emit SHRD32 instruction, from s1, fill s2 , constant c, store result in s1 using s3 and s4 as scratch void emit_shrd32c(dynarec_rv64_t* dyn, int ninst, rex_t rex, int s1, int s2, uint32_t c, int s3, int s4) { + c&=(rex.w?0x3f:0x1f); CLEAR_FLAGS(); IFX(X_PEND) { @@ -562,6 +563,7 @@ void emit_shrd32c(dynarec_rv64_t* dyn, int ninst, rex_t rex, int s1, int s2, uin } void emit_shld32c(dynarec_rv64_t* dyn, int ninst, rex_t rex, int s1, int s2, uint32_t c, int s3, int s4, int s5) { + c&=(rex.w?0x3f:0x1f); CLEAR_FLAGS(); IFX(X_PEND) { if (c) { |