mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-01-22 11:31:00 +00:00
target/i386: fix fbstp handling of negative zero
The fbstp implementation stores +0 when the rounded result should be -0 because it compares an integer value with 0 to determine the sign. Fix this by checking the sign bit of the operand instead. Backports commit 18c53e1e73197a24f9f4b66b1276eb9868db5bf0 from qemu
This commit is contained in:
parent
c796ee5e13
commit
477a0af161
|
@ -692,11 +692,14 @@ void helper_fbst_ST0(CPUX86State *env, target_ulong ptr)
|
||||||
int v;
|
int v;
|
||||||
target_ulong mem_ref, mem_end;
|
target_ulong mem_ref, mem_end;
|
||||||
int64_t val;
|
int64_t val;
|
||||||
|
CPU_LDoubleU temp;
|
||||||
|
|
||||||
|
temp.d = ST0;
|
||||||
|
|
||||||
val = floatx80_to_int64(ST0, &env->fp_status);
|
val = floatx80_to_int64(ST0, &env->fp_status);
|
||||||
mem_ref = ptr;
|
mem_ref = ptr;
|
||||||
mem_end = mem_ref + 9;
|
mem_end = mem_ref + 9;
|
||||||
if (val < 0) {
|
if (SIGND(temp)) {
|
||||||
cpu_stb_data_ra(env, mem_end, 0x80, GETPC());
|
cpu_stb_data_ra(env, mem_end, 0x80, GETPC());
|
||||||
val = -val;
|
val = -val;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue