From: Richard Henderson <richard.henderson@linaro.org>
To: Keith Packard <keithp@keithp.com>, qemu-devel@nongnu.org
Subject: Re: [PATCH] softfloat: Handle m68k extended precision denormals properly
Date: Sun, 20 Aug 2023 20:02:13 -0700 [thread overview]
Message-ID: <420b8a0d-4a36-ff07-e95c-fff3b980d1c2@linaro.org> (raw)
In-Reply-To: <877cppkx0r.fsf@keithp.com>
On 8/20/23 18:24, Keith Packard wrote:
>
>> Motorola treats denormals with explicit integer bit set as
>> having unbiased exponent 0, unlike Intel which treats it as
>> having unbiased exponent 1 (like all other IEEE formats).
>
> Thanks for having a look at this. Your patch fixes a couple of cases,
> but there are further adventures that await if you're interested.
>
> x: 0x1p0 0x3fff 0x80000000 0x00000000
> y: 0x1p-16383 0x0000 0x80000000 0x00000000
> build_mul: 0x1p-16382 0x0000 0x80000000 0x00000000
> runtime_mul: 0x1p-16383 0x0001 0x80000000 0x00000000
>
> I think the enclosed additional patch fixes this. I've still got 75 fmal
> failures on this target, but the obvious 'multiply is broken' problem
> appears fixed.
>
> From b722c92f8329f56f5243496eca3779f1156aff4f Mon Sep 17 00:00:00 2001
> From: Keith Packard <keithp@keithp.com>
> Date: Sun, 20 Aug 2023 18:20:13 -0700
> Subject: [PATCH] softfloat: Handle m68k LDBL_MIN_EXP normal values
>
> Unlike Intel 80-bit floats, Motorola allows for normal values with a
> zero exponent. Handle that by not setting exponent to 1 when the value
> is normal for this format.
>
> Signed-off-by: Keith Packard <keithp@keithp.com>
> ---
> fpu/softfloat-parts.c.inc | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fpu/softfloat-parts.c.inc b/fpu/softfloat-parts.c.inc
> index d0c43c28fb..cea854cdf1 100644
> --- a/fpu/softfloat-parts.c.inc
> +++ b/fpu/softfloat-parts.c.inc
> @@ -288,7 +288,7 @@ static void partsN(uncanon_normal)(FloatPartsN *p, float_status *s,
> p->frac_lo &= ~round_mask;
> }
>
> - exp = (p->frac_hi & DECOMPOSED_IMPLICIT_BIT) != 0;
> + exp = (p->frac_hi & DECOMPOSED_IMPLICIT_BIT) != 0 && !fmt->m68k_denormal;
That does look like a correct change. I'll fold it in.
Please let us know if you encounter anything else.
r~
next prev parent reply other threads:[~2023-08-21 3:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-21 0:32 [PATCH] softfloat: Handle m68k extended precision denormals properly Richard Henderson
2023-08-21 1:24 ` Keith Packard via
2023-08-21 3:02 ` Richard Henderson [this message]
2023-08-21 3:42 ` Keith Packard via
2023-08-21 6:16 ` Philippe Mathieu-Daudé
2023-08-21 10:16 ` BALATON Zoltan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=420b8a0d-4a36-ff07-e95c-fff3b980d1c2@linaro.org \
--to=richard.henderson@linaro.org \
--cc=keithp@keithp.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).