diff mbox series

target/rx: Correctly set Error Summary bit in set_fpsw() helper

Message ID 20211215124312.254042-1-f4bug@amsat.org (mailing list archive)
State New, archived
Headers show
Series target/rx: Correctly set Error Summary bit in set_fpsw() helper | expand

Commit Message

Philippe Mathieu-Daudé Dec. 15, 2021, 12:43 p.m. UTC
FIELD_DP32() does not update its first argument, so the Floating-Point
Error Summary Flag (FS, summary of FV/FO/FZ/FU bits) is never updated
to the Floating-Point Status Word (FPSW). Fix by assigning FIELD_DP32()
returned value to env->fpsw.

Fixes: 075d047e2bd ("target/rx: TCG helpers")
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 target/rx/op_helper.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Peter Maydell Dec. 15, 2021, 1:34 p.m. UTC | #1
On Wed, 15 Dec 2021 at 12:43, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> FIELD_DP32() does not update its first argument, so the Floating-Point
> Error Summary Flag (FS, summary of FV/FO/FZ/FU bits) is never updated
> to the Floating-Point Status Word (FPSW). Fix by assigning FIELD_DP32()
> returned value to env->fpsw.
>
> Fixes: 075d047e2bd ("target/rx: TCG helpers")
> Reported-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

-- PMM
Richard Henderson Dec. 15, 2021, 5:21 p.m. UTC | #2
On 12/15/21 4:43 AM, Philippe Mathieu-Daudé wrote:
> FIELD_DP32() does not update its first argument, so the Floating-Point
> Error Summary Flag (FS, summary of FV/FO/FZ/FU bits) is never updated
> to the Floating-Point Status Word (FPSW). Fix by assigning FIELD_DP32()
> returned value to env->fpsw.
> 
> Fixes: 075d047e2bd ("target/rx: TCG helpers")
> Reported-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~
diff mbox series

Patch

diff --git a/target/rx/op_helper.c b/target/rx/op_helper.c
index 11f952d3409..431d4ecf707 100644
--- a/target/rx/op_helper.c
+++ b/target/rx/op_helper.c
@@ -130,8 +130,7 @@  void helper_set_fpsw(CPURXState *env, uint32_t val)
     fpsw |= 0x7fffff03;
     val &= ~0x80000000;
     fpsw &= val;
-    FIELD_DP32(fpsw, FPSW, FS, FIELD_EX32(fpsw, FPSW, FLAGS) != 0);
-    env->fpsw = fpsw;
+    env->fpsw = FIELD_DP32(fpsw, FPSW, FS, FIELD_EX32(fpsw, FPSW, FLAGS) != 0);
     set_float_rounding_mode(roundmode[FIELD_EX32(env->fpsw, FPSW, RM)],
                             &env->fp_status);
 }