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

Joel Sherrill <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
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
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.