Re: Revisiting More Complete long double Support

Corinna Vinschen <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
On Aug 18 17:16, Joel Sherrill wrote:
> I've dug in a bit and tried to bring in one function. Found
> a few things that are going to shape the solution:
> 
> (1)  Newlib and FreeBSD do not agree on filenames. truncl.c
>       gets replaced by s_truncl.c
>      (a) Great work on the new build system. :)

We can easily change this to the FreeBSD naming convention.  We're
using it mostly anyway.

> (2) FreeBSD long double methods rely on _fpmath.h to define
>      the long double format. It doesn't have to be 128 bits for the
>      code to work. But only a handful of architectures have this file:
> 
>       aarch64 amd64 arm i386 mips powerpc powerpc64 riscv sparc64
> 
>       This file would go in libc/machine/... I think based on the FreeBSD
>       source layout.

_fpmath.h defines one union and 5 macros.  It's very basic.

We have already multiple files defining structs and unions based on the
value of LDBL_MANT_DIG, libc/include/ieeefp.h,
libc/include/machine/ieee.h, and libc/stdio/vfieeefp.h.

The most useful way of action would probably be to define a common
_fpmath.h with all the required structs, unions and macros and use
that throughout, i. e., we include it from the above files.

And ideally we only have one *ieee*.h file, not three, in future...

> (3) I think my suggestion to have the default implementation and
>       then this implementation in parallel and then select the appropriate
>       one at configure time. For the architectures with _fpmath.h, the
>       new FreeBSD implementation can be used. For others, architectures
>       the old implementation could be used.

Dunno about others, but I'd rather not see two parallel implementations
of math in newlib.  It might be a bit more work to port the code, but
it's certainly not unfeasible.


Corinna
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.