tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: compiler_rt missing support for 80-bit floats?



On 11 Nov, 2014, at 03:25 , Aymeric Vincent <aymericvincent%free.fr@localhost> wrote:
> Could someone with experience on floating point and/or compiler_rt
> please tell if it's a simple matter of adding the 80-bit case to
> fp_trunc_impl.inc and add stub C files, or if there is a deeper reason
> for dropping 80bit support?

It isn't a matter of dropping 80 bit support.  Standard C only has
one floating point type that is wider than a double, a long double.
That type can by 80 or 128 bits wide (or something else, in theory),
usually depending on what the hardware supports, but which ever it
is it will be the only floating type wider than a double.  There is
hence no reason to have a runtime function to convert 128 bit floats
to 80 bit floats for standard C because you'll only have one kind or
the other and not both at the same time.

gcc has a non-standard extension, a __float128 type which works for
some machines.  On amd64, where long double is 80 bits, this adds an
additional, new (soft) floating point type.  It is this extension
which requires runtime functions to convert between 128 and 80 bit
float formats.  This is a fairly recent invention which may not be
(as completely?) supported by clang and its runtime.

Whatever the case, anything you can do to make this work is probably
appropriate if you have code which uses this.  I would note, though,
that the code which is using this may not be very portable.  I use
__int128 for some things, since it is good when it works, but it
requires a per-architecture header to select when to use it since it
isn't reliably there.

Dennis Ferguson


Home | Main Index | Thread Index | Old Index