This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] soft-fp handling of underflow
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: David Miller <davem at davemloft dot net>
- Cc: libc-alpha at sourceware dot org
- Date: Wed, 30 May 2012 09:45:16 +0000 (UTC)
- Subject: Re: [PATCH] soft-fp handling of underflow
- References: <20120529.191630.1047412988242060683.davem@davemloft.net>
On Tue, 29 May 2012, David Miller wrote:
> As you have asked, I've taken care of the semi-RAW packing macro. I
> think I have a handle on this side but I need your help.
>
> It seems like subnormal handling is split between the actual FPU
> operations and the packing. For example, underflowing to subnormal
> is handled in the tail of the subtraction code in _FP_ADD_INTERNAL.
Yes, in the semiraw case the caller is responsible for setting up the
exponent and mantissa appropriately for results in the subnormal range.
> I briefly looked over the calculations that operate on semiraw encoded
> values and the only case that pops out at me is the sub3: label code
> in _FP_ADD_INTERNAL. I think we need to detect when bits of precision
> are actually lost and signal FP_EX_INEXACT in such cases. Or is that
> never possible here for some reason?
sub3: is the case where a subnormal has been subtracted from a value with
the least normal exponent (i.e. the mantissa bits act as if the values had
the same exponent, no shifting needed, with just one of the values having
the implicit high bit of the mantissa set). In such a case, the result
will always be exact.
This patch is OK with an appropriate ChangeLog entry (and 2012 added to
the copyright dates in op-common.h; we don't yet use ranges of years in
the copyright notices in soft-fp because GCC's README doesn't yet have a
notice about the meaning of such ranges).
--
Joseph S. Myers
joseph@codesourcery.com