This is the mail archive of the gcc@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: Floating Point Representation in libgcc (is IEEE?)


Quoting "Paulo J. Matos" <pocmatos@gmail.com>:

Hi all,

I am implementing some function for conversion between modes (QI ->
HF, SF -> HI, etc). For this it would be useful to know the floating
point representation using in libgcc. However, I can't find any
description of it anywhere. Is it using IEEE floating point
representation?

It is using whatever floating point format the target has. If you don't have hardware floating point support, then you get to choose the format when you design your ABI. Of course, basing the floating point format on IEEE is a popular choice, albeit it is common to cut corners on subnormals / rounding modes / signals. (This is merely an observation, not advocating for or against these practices.)

There are two C implementations of IEEE software floating point in the
GCC runtime:
- fp-bit.c, which is fairly old and slow, but requires little work to use
  if longlong.h supports your processor (which is also needed for GNU mp).
  It only has round-to-nearest, no signals, but subnormals work except for
  one rounding issue with division.
- soft-fp.  This is supposed to be a bit faster, but you need to define
  various primitives.  The default configuration is similar in features
  to fp-bit.c, but you can customize it for support of signals ('exceptions')
  and other rounding modes.

Some targets also have their own implementation in optimized assembly code.


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