diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2025-02-02 16:10:56 +0100 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2025-02-02 16:10:56 +0100 |
| commit | 1c0dc8ec7c2d06a1c14c5c7349e08fe89fd00470 (patch) | |
| tree | c020b0044d86128798fe2f1fa80a81e67d09bc28 /src | |
| parent | b21776f9b08ce9e1d84205ccafaad7ceab1bf532 (diff) | |
| download | box64-1c0dc8ec7c2d06a1c14c5c7349e08fe89fd00470.tar.gz box64-1c0dc8ec7c2d06a1c14c5c7349e08fe89fd00470.zip | |
[COSIM] Reduce false negative on rcl/rcr OF flag
Diffstat (limited to 'src')
| -rw-r--r-- | src/emu/x64primop.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/emu/x64primop.c b/src/emu/x64primop.c index 129069ad..85abdd07 100644 --- a/src/emu/x64primop.c +++ b/src/emu/x64primop.c @@ -568,6 +568,8 @@ uint32_t rcl32(x64emu_t *emu, uint32_t d, uint8_t s) CONDITIONAL_SET_FLAG(cf, F_CF); if(cnt == 1) CONDITIONAL_SET_FLAG((cf ^ (res >> 31)) & 0x1, F_OF); + else + CLEAR_FLAG(F_OF); // UND, but clear for dynarec_test } return res; } @@ -590,6 +592,8 @@ uint64_t rcl64(x64emu_t *emu, uint64_t d, uint8_t s) CONDITIONAL_SET_FLAG(cf, F_CF); if(cnt == 1) CONDITIONAL_SET_FLAG((cf ^ (res >> 63)) & 0x1, F_OF); + else + CLEAR_FLAG(F_OF); // UND, but clear for dynarec_test } return res; } @@ -720,8 +724,10 @@ uint32_t rcr32(x64emu_t *emu, uint32_t d, uint8_t s) ocf = ACCESS_FLAG(F_CF) != 0; CONDITIONAL_SET_FLAG((ocf ^ (d >> 31)) & 0x1, F_OF); - } else + } else { cf = (d >> (cnt - 1)) & 0x1; + CLEAR_FLAG(F_OF); // UND, but clear for dynarec_test + } mask = (1 << (32 - cnt)) - 1; res = (d >> cnt) & mask; if (cnt != 1) @@ -749,8 +755,10 @@ uint64_t rcr64(x64emu_t *emu, uint64_t d, uint8_t s) ocf = ACCESS_FLAG(F_CF) != 0; CONDITIONAL_SET_FLAG((ocf ^ (d >> 63)) & 0x1, F_OF); - } else + } else { cf = (d >> (cnt - 1)) & 0x1; + CLEAR_FLAG(F_OF); // UND, but clear for dynarec_test + } mask = (1LL << (64 - cnt)) - 1; res = (d >> cnt) & mask; if (cnt != 1) |