Re: floating point

Bruce Dawson <comments@cygnus-software.com>
1 Nov 1998 11:40:33 -0500

          From comp.compilers

Related articles
[2 earlier articles]
Re: floating point will@ccs.neu.edu (William D Clinger) (1998-10-05)
Re: floating point comments@cygnus-software.com (Bruce Dawson) (1998-10-07)
Re: floating point will@ccs.neu.edu (William D Clinger) (1998-10-10)
Re: floating point dmcq@fano.demon.co.uk (David McQuillan) (1998-10-13)
Re: floating point darcy@CS.Berkeley.EDU (Joseph D. Darcy) (1998-10-19)
Re: floating point darcy@usul.CS.Berkeley.EDU (1998-10-24)
Re: floating point comments@cygnus-software.com (Bruce Dawson) (1998-11-01)
Re: floating point comments@cygnus-software.com (Bruce Dawson) (1998-11-01)
Re: floating point darcy@usul.CS.Berkeley.EDU (1998-11-06)
Re: floating point darcy@CS.Berkeley.EDU (Joseph D. Darcy) (1998-11-06)
Re: floating point comments@cygnus-software.com (Bruce Dawson) (1998-11-07)
Re: floating point eggert@twinsun.com (1998-11-19)
Re: floating point dmcq@fano.demon.co.uk (David McQuillan) (1998-11-21)
[2 later articles]
| List of all articles for this month |
From: Bruce Dawson <comments@cygnus-software.com>
Newsgroups: comp.compilers
Date: 1 Nov 1998 11:40:33 -0500
Organization: Cygnus Software
References: 98-09-164 98-10-018 98-10-040 98-10-120
Keywords: arithmetic

Bruce Dawson said:
> >Simultaneously, the 80x87 makes it extremely difficult to write pure
> >extended precision math. Because most of the FPU instructions that
> >reference memory only support float or double precision, compiler
> >vendors have to write an entirely different code generator if they
> >want to support extended precision.


> Joseph D. Darcy wrote:
> The x86's floating point load instruction can load float, double, or
> double extended values (all floating point values are converted to
> double extended when brought into the floating point register stack).
> By setting the rounding precision, the same arithmetic instructions
> act on all three formats (with extended exponent range). The FST
> instruction can only store float or double values. The FSTP
> instruction can store and pop float, double, or double extended. This
> last difference in store instructions is certainly an annoying, but
> not an insurmountable, problem to code generation.


If fst not supporting extended precision was the only problem then it
would be just a minor nuisance to support extended precision on the
x87 architecture. Unfortunately, that's far from the only
limitation. Try assembling these three instructions, and you'll find
the third one is illegal. The TBYTE size (ten bytes, extended
precision) is not supported on most FPU instructions.


      fadd DWORD PTR 0[esp]
      fadd QWORD PTR 0[esp]
      fadd TBYTE PTR 0[esp] ; Sorry - doesn't work.


In other words, a code generator for extended double types on the x87
architecture has to avoid fstp and avoid ALL OTHER FPU instructions
that read or write numbers from memory, the sole exceptions being fld
and fstp.


That is a major pain in the code generator, especially if you want
your float and double code to run fast (ie; use adds from memory
when appropriate).
--
Bruce Dawson, Cygnus Software Author of Fractal eXtreme for Win32
Get your 15 day trial copy of FX at: http://www.cygnus-software.com/
Write me at: comments@cygnus-software.com


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.