mirror of
https://github.com/qemu/qemu.git
synced 2024-11-26 21:14:41 +08:00
target/arm: Check NaN mode before silencing NaN
If the CPU is running in default NaN mode (FPCR.DN == 1) and we execute FRSQRTE, FRECPE, or FRECPX with a signaling NaN, parts_silence_nan_frac() will assert due to fpst->default_nan_mode being set. To avoid this, we check to see what NaN mode we're running in before we call floatxx_silence_nan(). Signed-off-by: Joe Komlodi <joe.komlodi@xilinx.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 1624662174-175828-2-git-send-email-joe.komlodi@xilinx.com Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
95079d5c79
commit
103e7579dd
@ -365,7 +365,9 @@ uint32_t HELPER(frecpx_f16)(uint32_t a, void *fpstp)
|
||||
float16 nan = a;
|
||||
if (float16_is_signaling_nan(a, fpst)) {
|
||||
float_raise(float_flag_invalid, fpst);
|
||||
nan = float16_silence_nan(a, fpst);
|
||||
if (!fpst->default_nan_mode) {
|
||||
nan = float16_silence_nan(a, fpst);
|
||||
}
|
||||
}
|
||||
if (fpst->default_nan_mode) {
|
||||
nan = float16_default_nan(fpst);
|
||||
@ -396,7 +398,9 @@ float32 HELPER(frecpx_f32)(float32 a, void *fpstp)
|
||||
float32 nan = a;
|
||||
if (float32_is_signaling_nan(a, fpst)) {
|
||||
float_raise(float_flag_invalid, fpst);
|
||||
nan = float32_silence_nan(a, fpst);
|
||||
if (!fpst->default_nan_mode) {
|
||||
nan = float32_silence_nan(a, fpst);
|
||||
}
|
||||
}
|
||||
if (fpst->default_nan_mode) {
|
||||
nan = float32_default_nan(fpst);
|
||||
@ -427,7 +431,9 @@ float64 HELPER(frecpx_f64)(float64 a, void *fpstp)
|
||||
float64 nan = a;
|
||||
if (float64_is_signaling_nan(a, fpst)) {
|
||||
float_raise(float_flag_invalid, fpst);
|
||||
nan = float64_silence_nan(a, fpst);
|
||||
if (!fpst->default_nan_mode) {
|
||||
nan = float64_silence_nan(a, fpst);
|
||||
}
|
||||
}
|
||||
if (fpst->default_nan_mode) {
|
||||
nan = float64_default_nan(fpst);
|
||||
|
@ -671,7 +671,9 @@ uint32_t HELPER(recpe_f16)(uint32_t input, void *fpstp)
|
||||
float16 nan = f16;
|
||||
if (float16_is_signaling_nan(f16, fpst)) {
|
||||
float_raise(float_flag_invalid, fpst);
|
||||
nan = float16_silence_nan(f16, fpst);
|
||||
if (!fpst->default_nan_mode) {
|
||||
nan = float16_silence_nan(f16, fpst);
|
||||
}
|
||||
}
|
||||
if (fpst->default_nan_mode) {
|
||||
nan = float16_default_nan(fpst);
|
||||
@ -719,7 +721,9 @@ float32 HELPER(recpe_f32)(float32 input, void *fpstp)
|
||||
float32 nan = f32;
|
||||
if (float32_is_signaling_nan(f32, fpst)) {
|
||||
float_raise(float_flag_invalid, fpst);
|
||||
nan = float32_silence_nan(f32, fpst);
|
||||
if (!fpst->default_nan_mode) {
|
||||
nan = float32_silence_nan(f32, fpst);
|
||||
}
|
||||
}
|
||||
if (fpst->default_nan_mode) {
|
||||
nan = float32_default_nan(fpst);
|
||||
@ -767,7 +771,9 @@ float64 HELPER(recpe_f64)(float64 input, void *fpstp)
|
||||
float64 nan = f64;
|
||||
if (float64_is_signaling_nan(f64, fpst)) {
|
||||
float_raise(float_flag_invalid, fpst);
|
||||
nan = float64_silence_nan(f64, fpst);
|
||||
if (!fpst->default_nan_mode) {
|
||||
nan = float64_silence_nan(f64, fpst);
|
||||
}
|
||||
}
|
||||
if (fpst->default_nan_mode) {
|
||||
nan = float64_default_nan(fpst);
|
||||
@ -866,7 +872,9 @@ uint32_t HELPER(rsqrte_f16)(uint32_t input, void *fpstp)
|
||||
float16 nan = f16;
|
||||
if (float16_is_signaling_nan(f16, s)) {
|
||||
float_raise(float_flag_invalid, s);
|
||||
nan = float16_silence_nan(f16, s);
|
||||
if (!s->default_nan_mode) {
|
||||
nan = float16_silence_nan(f16, fpstp);
|
||||
}
|
||||
}
|
||||
if (s->default_nan_mode) {
|
||||
nan = float16_default_nan(s);
|
||||
@ -910,7 +918,9 @@ float32 HELPER(rsqrte_f32)(float32 input, void *fpstp)
|
||||
float32 nan = f32;
|
||||
if (float32_is_signaling_nan(f32, s)) {
|
||||
float_raise(float_flag_invalid, s);
|
||||
nan = float32_silence_nan(f32, s);
|
||||
if (!s->default_nan_mode) {
|
||||
nan = float32_silence_nan(f32, fpstp);
|
||||
}
|
||||
}
|
||||
if (s->default_nan_mode) {
|
||||
nan = float32_default_nan(s);
|
||||
@ -953,7 +963,9 @@ float64 HELPER(rsqrte_f64)(float64 input, void *fpstp)
|
||||
float64 nan = f64;
|
||||
if (float64_is_signaling_nan(f64, s)) {
|
||||
float_raise(float_flag_invalid, s);
|
||||
nan = float64_silence_nan(f64, s);
|
||||
if (!s->default_nan_mode) {
|
||||
nan = float64_silence_nan(f64, fpstp);
|
||||
}
|
||||
}
|
||||
if (s->default_nan_mode) {
|
||||
nan = float64_default_nan(s);
|
||||
|
Loading…
Reference in New Issue
Block a user