diff mbox series

[06/11] target/rx: Handle the FPSW.DN bit in helper_set_fpsw

Message ID 20210527041405.391567-7-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
Both input and output denormals flush to zero when DN is set.

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 | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

-- 
2.25.1

Comments

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

> Both input and output denormals flush to zero when DN is set.

> 

> 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 | 9 ++++++++-

>  1 file changed, 8 insertions(+), 1 deletion(-)

> 

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

> index ef904eb5f9..2139def3b2 100644

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

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

> @@ -127,13 +127,20 @@ void helper_set_fpsw(CPURXState *env, uint32_t val)

>          float_round_down,

>      };

>      uint32_t fpsw = env->fpsw;

> +    bool dn;

> +

>      fpsw |= 0x7fffff03;

>      val &= ~0x80000000;

>      fpsw &= val;

>      FIELD_DP32(fpsw, FPSW, FS, FIELD_EX32(fpsw, FPSW, FLAGS) != 0);

>      env->fpsw = fpsw;

> -    set_float_rounding_mode(roundmode[FIELD_EX32(env->fpsw, FPSW, RM)],

> +

> +    set_float_rounding_mode(roundmode[FIELD_EX32(fpsw, FPSW, RM)],

>                              &env->fp_status);

> +

> +    dn = FIELD_EX32(env->fpsw, FPSW, DN);

> +    set_flush_to_zero(dn, &env->fp_status);

> +    set_flush_inputs_to_zero(dn, &env->fp_status);

>  }

>  

>  #define FLOATOP(op, func)                                           \

> -- 

> 2.25.1

> 

>
diff mbox series

Patch

diff --git a/target/rx/op_helper.c b/target/rx/op_helper.c
index ef904eb5f9..2139def3b2 100644
--- a/target/rx/op_helper.c
+++ b/target/rx/op_helper.c
@@ -127,13 +127,20 @@  void helper_set_fpsw(CPURXState *env, uint32_t val)
         float_round_down,
     };
     uint32_t fpsw = env->fpsw;
+    bool dn;
+
     fpsw |= 0x7fffff03;
     val &= ~0x80000000;
     fpsw &= val;
     FIELD_DP32(fpsw, FPSW, FS, FIELD_EX32(fpsw, FPSW, FLAGS) != 0);
     env->fpsw = fpsw;
-    set_float_rounding_mode(roundmode[FIELD_EX32(env->fpsw, FPSW, RM)],
+
+    set_float_rounding_mode(roundmode[FIELD_EX32(fpsw, FPSW, RM)],
                             &env->fp_status);
+
+    dn = FIELD_EX32(env->fpsw, FPSW, DN);
+    set_flush_to_zero(dn, &env->fp_status);
+    set_flush_inputs_to_zero(dn, &env->fp_status);
 }
 
 #define FLOATOP(op, func)                                           \