[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 6/7] target/i386: reimplement fprem1 using floatx80 operation
From: |
Alex Bennée |
Subject: |
Re: [PATCH 6/7] target/i386: reimplement fprem1 using floatx80 operations |
Date: |
Mon, 08 Jun 2020 17:46:52 +0100 |
User-agent: |
mu4e 1.5.2; emacs 28.0.50 |
Joseph Myers <joseph@codesourcery.com> writes:
> The x87 fprem1 emulation is currently based around conversion to
> double, which is inherently unsuitable for a good emulation of any
> floatx80 operation. Reimplement using the soft-float floatx80
> remainder operations.
>
> Signed-off-by: Joseph Myers <joseph@codesourcery.com>
> ---
> target/i386/fpu_helper.c | 96 +++++++++++++++++++---------------------
> 1 file changed, 45 insertions(+), 51 deletions(-)
>
> diff --git a/target/i386/fpu_helper.c b/target/i386/fpu_helper.c
> index 8ef5b463ea..bab35e00a0 100644
> --- a/target/i386/fpu_helper.c
> +++ b/target/i386/fpu_helper.c
> @@ -934,63 +934,57 @@ void helper_fxtract(CPUX86State *env)
> merge_exception_flags(env, old_flags);
> }
>
> -void helper_fprem1(CPUX86State *env)
> +static void helper_fprem_common(CPUX86State *env, bool mod)
> {
> - double st0, st1, dblq, fpsrcop, fptemp;
> - CPU_LDoubleU fpsrcop1, fptemp1;
> - int expdif;
> - signed long long int q;
> -
> - st0 = floatx80_to_double(env, ST0);
> - st1 = floatx80_to_double(env, ST1);
> -
> - if (isinf(st0) || isnan(st0) || isnan(st1) || (st1 == 0.0)) {
> - ST0 = double_to_floatx80(env, 0.0 / 0.0); /* NaN */
> - env->fpus &= ~0x4700; /* (C3,C2,C1,C0) <-- 0000 */
> - return;
> - }
> -
> - fpsrcop = st0;
> - fptemp = st1;
> - fpsrcop1.d = ST0;
> - fptemp1.d = ST1;
> - expdif = EXPD(fpsrcop1) - EXPD(fptemp1);
> -
> - if (expdif < 0) {
> - /* optimisation? taken from the AMD docs */
> - env->fpus &= ~0x4700; /* (C3,C2,C1,C0) <-- 0000 */
> - /* ST0 is unchanged */
> - return;
> - }
> + uint8_t old_flags = save_exception_flags(env);
Hmm where did this come from:
/home/alex/lsrc/qemu.git/target/i386/fpu_helper.c: In function
‘helper_fprem_common’:
/home/alex/lsrc/qemu.git/target/i386/fpu_helper.c:784:25: error: implicit
declaration of function ‘save_exception_flags’; did you mean
‘raise_exception_ra’? [-Werror=implicit-function-declaration]
uint8_t old_flags = save_exception_flags(env);
^~~~~~~~~~~~~~~~~~~~
raise_exception_ra
/home/alex/lsrc/qemu.git/target/i386/fpu_helper.c:784:25: error: nested extern
declaration of ‘save_exception_flags’ [-Werror=nested-externs]
/home/alex/lsrc/qemu.git/target/i386/fpu_helper.c:827:5: error: implicit
declaration of function ‘merge_exception_flags’; did you mean
‘get_float_exception_flags’? [-Werror=implicit-function-declaration]
merge_exception_flags(env, old_flags);
^~~~~~~~~~~~~~~~~~~~~
get_float_exception_flags
/home/alex/lsrc/qemu.git/target/i386/fpu_helper.c:827:5: error: nested extern
declaration of ‘merge_exception_flags’ [-Werror=nested-externs]
cc1: all warnings being treated as errors
--
Alex Bennée
- [PATCH 2/7] softfloat: fix floatx80 remainder pseudo-denormal check for zero, (continued)
- [PATCH 2/7] softfloat: fix floatx80 remainder pseudo-denormal check for zero, Joseph Myers, 2020/06/05
- [PATCH 3/7] softfloat: do not return pseudo-denormal from floatx80 remainder, Joseph Myers, 2020/06/05
- [PATCH 4/7] softfloat: do not set denominator high bit for floatx80 remainder, Joseph Myers, 2020/06/05
- [PATCH 5/7] softfloat: return low bits of quotient from floatx80_modrem, Joseph Myers, 2020/06/05
- [PATCH 6/7] target/i386: reimplement fprem1 using floatx80 operations, Joseph Myers, 2020/06/05
- [PATCH 7/7] target/i386: reimplement fprem using floatx80 operations, Joseph Myers, 2020/06/05