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

Philippe Mathieu-Daudé posted 1 patch 4 years, 1 month ago
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20211215124312.254042-1-f4bug@amsat.org
target/rx/op_helper.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
[PATCH] target/rx: Correctly set Error Summary bit in set_fpsw() helper
Posted by Philippe Mathieu-Daudé 4 years, 1 month ago
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(-)

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);
 }
-- 
2.33.1

Re: [PATCH] target/rx: Correctly set Error Summary bit in set_fpsw() helper
Posted by Peter Maydell 4 years, 1 month ago
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

Re: [PATCH] target/rx: Correctly set Error Summary bit in set_fpsw() helper
Posted by Richard Henderson 4 years, 1 month ago
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~