diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2024-12-02 16:19:06 +0100 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2024-12-02 16:19:06 +0100 |
| commit | 415fc458be52095395236d80a7c402cb77b0b718 (patch) | |
| tree | 5f7ea72145622371b86ab7f13d50c67c138f6345 /src/dynarec/dynarec_native_functions.c | |
| parent | f2822f1a05afe63f233e172f67dcbe1f3b234551 (diff) | |
| download | box64-415fc458be52095395236d80a7c402cb77b0b718.tar.gz box64-415fc458be52095395236d80a7c402cb77b0b718.zip | |
[ARM64_DYNAREC] Improved some x87 opcode behaviour
Diffstat (limited to 'src/dynarec/dynarec_native_functions.c')
| -rw-r--r-- | src/dynarec/dynarec_native_functions.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/dynarec/dynarec_native_functions.c b/src/dynarec/dynarec_native_functions.c index e2e149f2..4b72ea01 100644 --- a/src/dynarec/dynarec_native_functions.c +++ b/src/dynarec/dynarec_native_functions.c @@ -59,10 +59,20 @@ void native_fpatan(x64emu_t* emu) } void native_fxtract(x64emu_t* emu) { - int32_t tmp32s = (ST1.q&0x7ff0000000000000LL)>>52; - tmp32s -= 1023; - ST1.d /= exp2(tmp32s); - ST0.d = tmp32s; + int tmp32s; + if(isnan(ST1.d)) { + ST0.d = ST1.d; + } else if(isinf(ST1.d)) { + ST0.d = ST1.d; + ST1.d = INFINITY; + } else if(ST1.d==0.0) { + ST0.d = ST1.d; + ST1.d = -INFINITY; + } else { + // LD80bits doesn't have implicit "1" bit, so need to adjust for that + ST0.d = frexp(ST1.d, &tmp32s)*2; + ST1.d = tmp32s-1; + } } void native_fprem(x64emu_t* emu) { |