This is the mail archive of the
libc-ports@sources.redhat.com
mailing list for the libc-ports project.
Re: Implement fma in soft-fp
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Richard Henderson <rth at twiddle dot net>
- Cc: <libc-alpha at sourceware dot org>, <libc-ports at sourceware dot org>, Marcus Shawcroft <marcus dot shawcroft at linaro dot org>, Richard Henderson <rth at redhat dot com>, David Holsgrove <david dot holsgrove at xilinx dot com>, Chris Metcalf <cmetcalf at tilera dot com>, "David S. Miller" <davem at davemloft dot net>
- Date: Tue, 25 Jun 2013 16:45:29 +0000
- Subject: Re: Implement fma in soft-fp
- References: <Pine dot LNX dot 4 dot 64 dot 1306221707230 dot 15367 at digraph dot polyomino dot org dot uk> <51C9C5F5 dot 1070809 at twiddle dot net>
On Tue, 25 Jun 2013, Richard Henderson wrote:
> With the following patch, I get
>
> > testing long double (without inline functions)
> > Failure: fma (0x1.fffffffffffffffffffffffffffcp-16382, 0x1.0000000000000000000000000001p-1, 0x1p-16494): Exception "Underflow" set
> > Failure: fma (-0x1.fffffffffffffffffffffffffffcp-16382, 0x1.0000000000000000000000000001p-1, -0x1p-16494): Exception "Underflow" set
> > Failure: fma (0x1p-16494, -0x1p-16494, 0x1p-16382): Exception "Underflow" set
> > Failure: fma (0x1p-16494, 0x1p-16494, -0x1p-16382): Exception "Underflow" set
> > Failure: fma_downward (-0x1.fffffffffffffffffffffffffffcp-16382, 0x1.0000000000000000000000000001p-1, -0x1p-16494): Exception "Underflow" set
> > Failure: fma_downward (-0x1p-16494, 0x1.1p-1, -0x0.ffffffffffffffffffffffffffffp-16382): Exception "Underflow" set
> > Failure: fma_downward (0x1p-16494, 0x1p-16494, -0x1p-16382): Exception "Underflow" set
> > Failure: fma_upward (0x1.fffffffffffffffffffffffffffcp-16382, 0x1.0000000000000000000000000001p-1, 0x1p-16494): Exception "Underflow" set
> > Failure: fma_upward (0x1p-16494, 0x1.1p-1, 0x0.ffffffffffffffffffffffffffffp-16382): Exception "Underflow" set
> > Failure: fma_upward (0x1p-16494, -0x1p-16494, 0x1p-16382): Exception "Underflow" set
>
> but I thought you'd already committed the patch to solve this
> as commit 695c378f81263640618bdebf56eaa065f578251f ?
No, that fix was about incorrect results rather than exceptions. The
above is what I was referring to about soft-fp not supporting
after-rounding tininess detection. _FP_PACK_SEMIRAW and
_FP_PACK_CANONICAL will need, for results whose before-rounding exponent
is the largest underflowing exponent, to check some new soft-fp macro for
after-rounding architectures and if it's true then determine whether the
result would still underflow if rounded to the normal precision (*not* if
rounded to the subnormal precision with one less bit, so this involves an
extra trial rounding in a temporary variable to determine whether the
result counts as tiny). See what stdlib/strtod_l.c does in
round_and_return if (TININESS_AFTER_ROUNDING && shift == 1), for example.
(But soft-fp would use its own macro definition from sfp-machine.h instead
of the existing tininess.h since it's supposed to be usable outside glibc
and independent of glibc internal headers.)
MIPS is an after-rounding architecture but this issue doesn't cause test
failures there because the testsuite knows not to test exceptions for MIPS
software floating point (which uses fp-bit in libgcc), via math-tests.h.
--
Joseph S. Myers
joseph@codesourcery.com