mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-02-02 15:41:00 +00:00
target-i386: Wrong conversion infinity from float80 to int32/int64
Backports commit ea32aaf1a72af102b855317b47a22e75ac2965a9 from qemu
This commit is contained in:
parent
a771209389
commit
fff0c621da
|
@ -250,16 +250,34 @@ int32_t helper_fist_ST0(CPUX86State *env)
|
|||
int32_t helper_fistl_ST0(CPUX86State *env)
|
||||
{
|
||||
int32_t val;
|
||||
signed char old_exp_flags;
|
||||
|
||||
old_exp_flags = get_float_exception_flags(&env->fp_status);
|
||||
set_float_exception_flags(0, &env->fp_status);
|
||||
|
||||
val = floatx80_to_int32(ST0, &env->fp_status);
|
||||
if (get_float_exception_flags(&env->fp_status) & float_flag_invalid) {
|
||||
val = 0x80000000;
|
||||
}
|
||||
set_float_exception_flags(get_float_exception_flags(&env->fp_status)
|
||||
| old_exp_flags, &env->fp_status);
|
||||
return val;
|
||||
}
|
||||
|
||||
int64_t helper_fistll_ST0(CPUX86State *env)
|
||||
{
|
||||
int64_t val;
|
||||
signed char old_exp_flags;
|
||||
|
||||
val = floatx80_to_int64(ST0, &env->fp_status);
|
||||
old_exp_flags = get_float_exception_flags(&env->fp_status);
|
||||
set_float_exception_flags(0, &env->fp_status);
|
||||
|
||||
val = floatx80_to_int32(ST0, &env->fp_status);
|
||||
if (get_float_exception_flags(&env->fp_status) & float_flag_invalid) {
|
||||
val = 0x8000000000000000ULL;
|
||||
}
|
||||
set_float_exception_flags(get_float_exception_flags(&env->fp_status)
|
||||
| old_exp_flags, &env->fp_status);
|
||||
return val;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue