qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC PATCH] target/i386: for maximum rounding precision for fildll


From: Richard Henderson
Subject: Re: [RFC PATCH] target/i386: for maximum rounding precision for fildll
Date: Mon, 7 Mar 2022 09:47:31 -1000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0

On 3/7/22 08:44, Alex Bennée wrote:
The instruction description says "It is loaded without rounding
errors." which implies we should have the widest rounding mode
possible.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/888
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
  target/i386/tcg/fpu_helper.c | 4 ++++
  1 file changed, 4 insertions(+)

diff --git a/target/i386/tcg/fpu_helper.c b/target/i386/tcg/fpu_helper.c
index cdd8e9f947..d986fd5792 100644
--- a/target/i386/tcg/fpu_helper.c
+++ b/target/i386/tcg/fpu_helper.c
@@ -250,11 +250,15 @@ void helper_fildl_ST0(CPUX86State *env, int32_t val)
  void helper_fildll_ST0(CPUX86State *env, int64_t val)
  {
      int new_fpstt;
+    FloatX80RoundPrec old = get_floatx80_rounding_precision(&env->fp_status);
+    set_floatx80_rounding_precision(floatx80_precision_x, &env->fp_status);
new_fpstt = (env->fpstt - 1) & 7;
      env->fpregs[new_fpstt].d = int64_to_floatx80(val, &env->fp_status);
      env->fpstt = new_fpstt;
      env->fptags[new_fpstt] = 0; /* validate stack entry */
+
+    set_floatx80_rounding_precision(old, &env->fp_status);
  }

Yep.

Need a similar fix for fildl_ST0, for the case floatx80_precision_s is currently set (int32_t has more than the 23 bits of single-precision).


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]