public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Joel Sherrill <joel@rtems.org>
To: newlib@sourceware.org
Subject: [PATCH newlib v1 0/4] Add FreeBSD long double functions
Date: Mon, 22 Aug 2022 17:50:18 -0500	[thread overview]
Message-ID: <20220822225022.32209-1-joel@rtems.org> (raw)

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

As each FreeBSD long double function is added, the existing 
implementation will be moved from libm/common/FUNC.c to
libm/common/ldbl_eq_dbl/s_FUNC.c.

This is a first round patch which includes only:

  + changes to build infrastructure
  + addition of all architecture specific _fpmath.h 
  + addition of FreeBSD s_truncl.c and move of truncl.c

Additionally, the existing libm/common/frexpl.c already had
code for long double and LDBL_EQ_DBL so I went ahead and split
that up.

Every file with LDBL_EQ_DBL conditional left in libm/common
should not have an implementation when there is a real long
double type. These will be easy to mechanically move into 
libm/common/ldbl_eq_dbl while adding their mate from FreeBSD.

Feedback appreciated.

Thanks.

--joel

Joel Sherrill (4):
  Add infrastructure for incorporating FreeBSD long double methods
  Makefile.in and configure: Regenerated
  Split libm/common/frexpl.c into LDBL_EQ_DBL and long double versions
  Makefile.in: Regenerated

 newlib/Makefile.am                            |   2 +-
 newlib/Makefile.in                            | 256 +++++++++++-------
 newlib/configure                              |  15 +
 newlib/libc/acinclude.m4                      |   2 +
 newlib/libc/include/math.h                    |  14 -
 newlib/libc/include/sys/endian.h              | 207 ++++++++++++++
 newlib/libc/machine/aarch64/machine/_fpmath.h |  64 +++++
 newlib/libc/machine/arm/machine/_fpmath.h     |  69 +++++
 newlib/libc/machine/i386/machine/_fpmath.h    |  56 ++++
 newlib/libc/machine/mips/machine/_fpmath.h    |  58 ++++
 newlib/libc/machine/powerpc/machine/_fpmath.h | 101 +++++++
 newlib/libc/machine/riscv/machine/_fpmath.h   |  71 +++++
 newlib/libc/machine/sparc64/machine/_fpmath.h |  59 ++++
 newlib/libc/machine/x86_64/machine/_fpmath.h  |  57 ++++
 newlib/libm/common/Makefile.inc               |  16 +-
 newlib/libm/common/ldbl/fpmath.h              |  82 ++++++
 .../libm/common/{frexpl.c => ldbl/s_frexpl.c} |   9 -
 newlib/libm/common/ldbl/s_truncl.c            |  68 +++++
 newlib/libm/common/ldbl_eq_dbl/s_frexpl.c     |  42 +++
 .../{truncl.c => ldbl_eq_dbl/s_truncl.c}      |   0
 20 files changed, 1126 insertions(+), 122 deletions(-)
 create mode 100644 newlib/libc/include/sys/endian.h
 create mode 100644 newlib/libc/machine/aarch64/machine/_fpmath.h
 create mode 100644 newlib/libc/machine/arm/machine/_fpmath.h
 create mode 100644 newlib/libc/machine/i386/machine/_fpmath.h
 create mode 100644 newlib/libc/machine/mips/machine/_fpmath.h
 create mode 100644 newlib/libc/machine/powerpc/machine/_fpmath.h
 create mode 100644 newlib/libc/machine/riscv/machine/_fpmath.h
 create mode 100644 newlib/libc/machine/sparc64/machine/_fpmath.h
 create mode 100644 newlib/libc/machine/x86_64/machine/_fpmath.h
 create mode 100644 newlib/libm/common/ldbl/fpmath.h
 rename newlib/libm/common/{frexpl.c => ldbl/s_frexpl.c} (94%)
 create mode 100644 newlib/libm/common/ldbl/s_truncl.c
 create mode 100644 newlib/libm/common/ldbl_eq_dbl/s_frexpl.c
 rename newlib/libm/common/{truncl.c => ldbl_eq_dbl/s_truncl.c} (100%)

-- 
2.24.4


             reply	other threads:[~2022-08-22 22:50 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-22 22:50 Joel Sherrill [this message]
2022-08-22 22:50 ` [PATCH newlib v1 1/4] Add infrastructure for incorporating FreeBSD long double methods Joel Sherrill
2022-08-22 22:50 ` [PATCH newlib v1 2/4] Makefile.in and configure: Regenerated Joel Sherrill
2022-08-22 22:50 ` [PATCH newlib v1 3/4] Split libm/common/frexpl.c into LDBL_EQ_DBL and long double versions Joel Sherrill
2022-08-22 22:50 ` [PATCH newlib v1 4/4] Makefile.in: Regenerated Joel Sherrill
2022-08-24  9:26 ` [PATCH newlib v1 0/4] Add FreeBSD long double functions Corinna Vinschen
2022-08-24 13:40   ` Joel Sherrill
2022-08-24 13:40     ` Joel Sherrill
2022-08-26 15:05     ` Corinna Vinschen
2022-08-26 15:45       ` Joel Sherrill
2022-08-26 15:45         ` Joel Sherrill
2022-08-26 17:45         ` Corinna Vinschen
2022-08-26 20:45           ` Jeff Johnston
2022-08-26 20:45             ` Jeff Johnston

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=20220822225022.32209-1-joel@rtems.org \
    --to=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).