diff mbox series

[08/11] target/rx: Fix setting of FPSW.CE

Message ID 20210527041405.391567-9-richard.henderson@linaro.org
State New
Headers show
Series softfloat: Improve denormal handling | expand

Commit Message

Richard Henderson May 27, 2021, 4:14 a.m. UTC
The existing check was completely wrong, confused about the
definition of the (previous) float_flag_{input,output}_denormal
flags, then making sure that DN, the flush-to-zero bit, was off.

Update for the introduction of float_flag_inorm_denormal and
float_flag_result_denormal, taking into account that DN now sets
the softfloat flush-to-zero bits.

Cc: Philippe Mathieu-Daudé <f4bug@amsat.org>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

---
 target/rx/op_helper.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

-- 
2.25.1

Comments

Yoshinori Sato May 28, 2021, 3:35 p.m. UTC | #1
On Thu, 27 May 2021 13:14:02 +0900,
Richard Henderson wrote:
> 

> The existing check was completely wrong, confused about the

> definition of the (previous) float_flag_{input,output}_denormal

> flags, then making sure that DN, the flush-to-zero bit, was off.

> 

> Update for the introduction of float_flag_inorm_denormal and

> float_flag_result_denormal, taking into account that DN now sets

> the softfloat flush-to-zero bits.

> 

> Cc: Philippe Mathieu-Daudé <f4bug@amsat.org>

> Cc: Yoshinori Sato <ysato@users.sourceforge.jp>

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


Reviewd-by: Yoshinori Sato <ysato@users.sourceforge.jp>

> ---

>  target/rx/op_helper.c | 8 +++++---

>  1 file changed, 5 insertions(+), 3 deletions(-)

> 

> diff --git a/target/rx/op_helper.c b/target/rx/op_helper.c

> index b1772e9538..c2e4f9a5e3 100644

> --- a/target/rx/op_helper.c

> +++ b/target/rx/op_helper.c

> @@ -97,9 +97,11 @@ static void update_fpsw(CPURXState *env, float32 ret, uintptr_t retaddr)

>          if (xcpt & float_flag_inexact) {

>              SET_FPSW(X);

>          }

> -        if ((xcpt & (float_flag_iflush_denormal

> -                     | float_flag_oflush_denormal))

> -            && !FIELD_EX32(env->fpsw, FPSW, DN)) {

> +        /*

> +         * If any input or output denormals, not flushed to zero, raise CE:

> +         * unimplemented processing has been encountered.

> +         */

> +        if (xcpt & (float_flag_inorm_denormal | float_flag_result_denormal)) {

>              env->fpsw = FIELD_DP32(env->fpsw, FPSW, CE, 1);

>          }

>  

> -- 

> 2.25.1

> 

>
diff mbox series

Patch

diff --git a/target/rx/op_helper.c b/target/rx/op_helper.c
index b1772e9538..c2e4f9a5e3 100644
--- a/target/rx/op_helper.c
+++ b/target/rx/op_helper.c
@@ -97,9 +97,11 @@  static void update_fpsw(CPURXState *env, float32 ret, uintptr_t retaddr)
         if (xcpt & float_flag_inexact) {
             SET_FPSW(X);
         }
-        if ((xcpt & (float_flag_iflush_denormal
-                     | float_flag_oflush_denormal))
-            && !FIELD_EX32(env->fpsw, FPSW, DN)) {
+        /*
+         * If any input or output denormals, not flushed to zero, raise CE:
+         * unimplemented processing has been encountered.
+         */
+        if (xcpt & (float_flag_inorm_denormal | float_flag_result_denormal)) {
             env->fpsw = FIELD_DP32(env->fpsw, FPSW, CE, 1);
         }