mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-06-23 05:57:48 +00:00
target/i386: fix fscale handling of signaling NaN
The implementation of the fscale instruction returns a NaN exponent unchanged. Fix it to return a quiet NaN when the provided exponent is a signaling NaN. Backports commit 0d48b436327955c69e2eb53f88aba9aa1e0dbaa0 from qemu
This commit is contained in:
parent
18fc17ca25
commit
d96c218664
|
@ -936,6 +936,10 @@ void helper_fscale(CPUX86State *env)
|
||||||
{
|
{
|
||||||
if (floatx80_is_any_nan(ST1)) {
|
if (floatx80_is_any_nan(ST1)) {
|
||||||
ST0 = ST1;
|
ST0 = ST1;
|
||||||
|
if (floatx80_is_signaling_nan(ST0, &env->fp_status)) {
|
||||||
|
float_raise(float_flag_invalid, &env->fp_status);
|
||||||
|
ST0 = floatx80_silence_nan(ST0, &env->fp_status);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
int n = floatx80_to_int32_round_to_zero(ST1, &env->fp_status);
|
int n = floatx80_to_int32_round_to_zero(ST1, &env->fp_status);
|
||||||
ST0 = floatx80_scalbn(ST0, n, &env->fp_status);
|
ST0 = floatx80_scalbn(ST0, n, &env->fp_status);
|
||||||
|
|
Loading…
Reference in a new issue