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 <kei...@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 <kei...@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~

Reply via email to