Re: [PATCH newlib v1 0/4] Add FreeBSD long double functions

Joel Sherrill <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <CAF9ehCVSHjt-9820Ba6mCLrya9Br13CuCOqMBmNja1crps6K6g@mail.gmail.com>
On Wed, Aug 24, 2022 at 4:26 AM Corinna Vinschen <[email protected]>
wrote:

> On Aug 22 17:50, Joel Sherrill wrote:
> > Hi
> >
> > To be clear, this is a V1 for review. It actually does **NOT**
> > add every long double math method from FreeBSD. That would add
> > unnecessary bulk to this patch set at this point.
> >
> > The FreeBSD long double code requires there to be an architecture
> > specific _fpmath.h file. This is only available for a handful of
> > architestures. Further, LDBL does EQ DBL on many architectures.
> > The FreeBSD long double code will **NOT** compile if there isn't
> > an _fpmath.h file. Thus, the overall approach is:
> >
> >   if architecture has _fpmath.h
> >      use FreeBSD long double code in libm/common/ldbl
> >   else
> >      use existing long double code
>
> Erm... Did you actually read my last reply?


Yes. If we do that, we end up with long double support on 8
architectures and lose it immediately on all others. On the
18 RTEMS target architectures,

+ Current: long double support on 12
+ Proposed: long double support on all
+ Delete ldbl=dbl implementation: 8 would have long double


We should really not add YA
> code path.  Merging the FreeBSD long double functions should work for
> basically all supported arches.  We only have to create our own
> _fpmath.h supporting all arches based on LDBL_MANT_DIG, isn't it?
>

It should if someone creates all the _fpmath.h headers. There are 61
directories under libc/machine. That leaves 53 _fpmath.h headers to
complete and most are likely ldbl==dbl. That is up to 53 target
architectures
which would lose the long double math APIs in libm.a.

Honestly, I don't mind long term planning to delete them but I was
thinking this approach improves the current situation a lot since it will
support the targets which really have long double support. It leaves
in place support for where ldbl==dbl with no change in available APIs.
It is a net win for users.

If there is a target with long double which doesn't have a FreeBSD
_fpmath.h file, then there is value in creating it.  Honestly, unless
someone
can script writing the missing 50+ _fpmath.h files, I am not comfortable
or eager to dive in. Ignoring the lack of time to so.

This approach works and doesn't abandon the targets which the
ldbl==dbl method works for.

--joel


>
>
> 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.