public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Corinna Vinschen <vinschen@redhat.com>
To: Joel Sherrill <joel@rtems.org>
Cc: Newlib <newlib@sourceware.org>
Subject: Re: Revisiting More Complete long double Support
Date: Fri, 19 Aug 2022 11:19:12 +0200	[thread overview]
Message-ID: <Yv9VkDsK9e4R+MO9@calimero.vinschen.de> (raw)
In-Reply-To: <CAF9ehCXOtoM=6dKx4JB2n+yBTy+mK+7mNGj9ABRbjp=Z=efkVA@mail.gmail.com>

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


      reply	other threads:[~2022-08-19  9:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-17 22:06 Joel Sherrill
2022-08-18  7:57 ` Corinna Vinschen
2022-08-18 14:49   ` Joel Sherrill
2022-08-18 19:16     ` Corinna Vinschen
2022-08-18 19:31       ` Joel Sherrill
2022-08-18 22:16         ` Joel Sherrill
2022-08-19  9:19           ` Corinna Vinschen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Yv9VkDsK9e4R+MO9@calimero.vinschen.de \
    --to=vinschen@redhat.com \
    --cc=joel@rtems.org \
    --cc=newlib@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).