This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Powerpc64 long double support


On Wed, Mar 10, 2004 at 01:42:43PM +0100, Andreas Schwab wrote:
> The sign bit might also be a don't-care at this point, in which case both
> formats must be supported.

I don't believe there is anything in our implementation that cares about
the sign of a low zero word, *except* for long double -> double
conversion of -0.0.

Richard brought up the interesting point privately, that if the high
double of a long double pair is always a correctly rounded double, then
just using that double as the result for a long double -> double
conversion would be correct.  My only counter argument is that our
ABI doesn't specify the long double format as tightly as MIPS does,
only requiring that the larger magnitude double be first, and that
the magnitudes do not overlap.  So our ABI doesn't require correct
rounding of the high double, just that the low double be < 1ULP of the
high double.  However, a correctly rounded high double results in
the best precision results for straight-forward arithmetic routines.

I also think that the MIPS specification requiring correct rounding
(or equivalently the low double <= 0.5 ULP of the high double) is
better.  Our looser spec means that it is possible for someone to
create two long doubles that have exactly the same infinite precision
sum, but different component doubles.  Differing component doubles will
result in the long doubles not comparing equal in gcc's current
implementation, when they have the same value according to our ABI.

So..

If gcc's rs6000/darwin-ldouble.c implementation of the basic arithmetic
operations always rounds the high double correctly, then I'd be quite
happy to work on rewording our ABI, and just taking the high double
for long double -> double conversion as Richard suggested.  You can't
get faster than a conversion that need not do anything.

Then, if we don't need to add the component doubles, we don't need to
use -0.0 in the low double.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]