[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 2/8] target/i386: force maximum rounding precision for fildl[l]
From: |
Alex Bennée |
Subject: |
[PULL 2/8] target/i386: force maximum rounding precision for fildl[l] |
Date: |
Wed, 23 Mar 2022 11:27:05 +0000 |
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>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220315121251.2280317-4-alex.bennee@linaro.org>
diff --git a/target/i386/tcg/fpu_helper.c b/target/i386/tcg/fpu_helper.c
index cdd8e9f947..ebf5e73df9 100644
--- a/target/i386/tcg/fpu_helper.c
+++ b/target/i386/tcg/fpu_helper.c
@@ -237,24 +237,37 @@ void helper_fldl_ST0(CPUX86State *env, uint64_t val)
merge_exception_flags(env, old_flags);
}
+static FloatX80RoundPrec tmp_maximise_precision(float_status *st)
+{
+ FloatX80RoundPrec old = get_floatx80_rounding_precision(st);
+ set_floatx80_rounding_precision(floatx80_precision_x, st);
+ return old;
+}
+
void helper_fildl_ST0(CPUX86State *env, int32_t val)
{
int new_fpstt;
+ FloatX80RoundPrec old = tmp_maximise_precision(&env->fp_status);
new_fpstt = (env->fpstt - 1) & 7;
env->fpregs[new_fpstt].d = int32_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);
}
void helper_fildll_ST0(CPUX86State *env, int64_t val)
{
int new_fpstt;
+ FloatX80RoundPrec old = tmp_maximise_precision(&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);
}
uint32_t helper_fsts_ST0(CPUX86State *env)
--
2.30.2
- [PULL for 7.0 0/8] i386, docs, gitlab fixes, Alex Bennée, 2022/03/23
- [PULL 1/8] tests/Makefile.include: Let "make clean" remove the TCG tests, too, Alex Bennée, 2022/03/23
- [PULL 3/8] mailmap/gitdm: more fixes for bad tags and authors, Alex Bennée, 2022/03/23
- [PULL 2/8] target/i386: force maximum rounding precision for fildl[l],
Alex Bennée <=
- [PULL 5/8] semihosting: clean up handling of expanded argv, Alex Bennée, 2022/03/23
- [PULL 4/8] docs/devel: try and impose some organisation, Alex Bennée, 2022/03/23
- [PULL 6/8] gitlab: include new aarch32 job in custom-runners, Alex Bennée, 2022/03/23
- [PULL 8/8] docs/tcg-plugins: document QEMU_PLUGIN behaviour, Alex Bennée, 2022/03/23
- [PULL 7/8] docs: remove qemu_logo.pdf, Alex Bennée, 2022/03/23
- Re: [PULL for 7.0 0/8] i386, docs, gitlab fixes, Peter Maydell, 2022/03/23
- Re: [PULL for 7.0 0/8] i386, docs, gitlab fixes, Peter Maydell, 2022/03/24