newlib: Add more FreeBSD files for non LDBL_EQ_DBL support

Message ID 20240710094459.2799297-1-kito.cheng@sifive.com
State New
Headers
Series newlib: Add more FreeBSD files for non LDBL_EQ_DBL support |

Commit Message

Kito Cheng July 10, 2024, 9:44 a.m. UTC
  For RISC-V, AArch64, i386, and x86_64

- k_tanl.c is required for tanl; the linker will report `__kernel_tanl`
  not found when tanl is called.
- s_cospil.c and s_sinpil.c are added for cospil and sinpil, which are already
  available for ld80 but not for ld128.
---
 newlib/Makefile.in             |  97 ++++++++++++++++++++++++---
 newlib/libm/ld/math_private.h  |  53 +++++++++++++++
 newlib/libm/ld128/Makefile.inc |   3 +-
 newlib/libm/ld128/k_cospil.h   |  42 ++++++++++++
 newlib/libm/ld128/k_sinpil.h   |  42 ++++++++++++
 newlib/libm/ld128/k_tanl.c     | 114 +++++++++++++++++++++++++++++++
 newlib/libm/ld128/s_cospil.c   | 108 ++++++++++++++++++++++++++++++
 newlib/libm/ld128/s_sinpil.c   | 111 ++++++++++++++++++++++++++++++
 newlib/libm/ld80/Makefile.inc  |   4 +-
 newlib/libm/ld80/k_tanl.c      | 119 +++++++++++++++++++++++++++++++++
 10 files changed, 681 insertions(+), 12 deletions(-)
 create mode 100644 newlib/libm/ld128/k_cospil.h
 create mode 100644 newlib/libm/ld128/k_sinpil.h
 create mode 100644 newlib/libm/ld128/k_tanl.c
 create mode 100644 newlib/libm/ld128/s_cospil.c
 create mode 100644 newlib/libm/ld128/s_sinpil.c
 create mode 100644 newlib/libm/ld80/k_tanl.c
  

Comments

Corinna Vinschen July 16, 2024, 9:32 a.m. UTC | #1
Jeff, ping?  I think that looks ok, but it's libm, yuk.

Thanks,
Corinna

On Jul 10 17:44, Kito Cheng wrote:
> For RISC-V, AArch64, i386, and x86_64
> 
> - k_tanl.c is required for tanl; the linker will report `__kernel_tanl`
>   not found when tanl is called.
> - s_cospil.c and s_sinpil.c are added for cospil and sinpil, which are already
>   available for ld80 but not for ld128.
> ---
>  newlib/Makefile.in             |  97 ++++++++++++++++++++++++---
>  newlib/libm/ld/math_private.h  |  53 +++++++++++++++
>  newlib/libm/ld128/Makefile.inc |   3 +-
>  newlib/libm/ld128/k_cospil.h   |  42 ++++++++++++
>  newlib/libm/ld128/k_sinpil.h   |  42 ++++++++++++
>  newlib/libm/ld128/k_tanl.c     | 114 +++++++++++++++++++++++++++++++
>  newlib/libm/ld128/s_cospil.c   | 108 ++++++++++++++++++++++++++++++
>  newlib/libm/ld128/s_sinpil.c   | 111 ++++++++++++++++++++++++++++++
>  newlib/libm/ld80/Makefile.inc  |   4 +-
>  newlib/libm/ld80/k_tanl.c      | 119 +++++++++++++++++++++++++++++++++
>  10 files changed, 681 insertions(+), 12 deletions(-)
>  create mode 100644 newlib/libm/ld128/k_cospil.h
>  create mode 100644 newlib/libm/ld128/k_sinpil.h
>  create mode 100644 newlib/libm/ld128/k_tanl.c
>  create mode 100644 newlib/libm/ld128/s_cospil.c
>  create mode 100644 newlib/libm/ld128/s_sinpil.c
>  create mode 100644 newlib/libm/ld80/k_tanl.c
> 
> diff --git a/newlib/Makefile.in b/newlib/Makefile.in
> index b45c42c36..a051c2760 100644
> --- a/newlib/Makefile.in
> +++ b/newlib/Makefile.in
> @@ -3244,7 +3244,10 @@ am__objects_159 = libm/fenv/libm_a-feclearexcept.$(OBJEXT) \
>  @HAVE_LIBM_MACHINE_AARCH64_FALSE@@HAVE_LIBM_MACHINE_RISCV_TRUE@	libm/ld128/libm_a-invtrig.$(OBJEXT) \
>  @HAVE_LIBM_MACHINE_AARCH64_FALSE@@HAVE_LIBM_MACHINE_RISCV_TRUE@	libm/ld128/libm_a-e_lgammal_r.$(OBJEXT) \
>  @HAVE_LIBM_MACHINE_AARCH64_FALSE@@HAVE_LIBM_MACHINE_RISCV_TRUE@	libm/ld128/libm_a-k_cosl.$(OBJEXT) \
> -@HAVE_LIBM_MACHINE_AARCH64_FALSE@@HAVE_LIBM_MACHINE_RISCV_TRUE@	libm/ld128/libm_a-k_sinl.$(OBJEXT)
> +@HAVE_LIBM_MACHINE_AARCH64_FALSE@@HAVE_LIBM_MACHINE_RISCV_TRUE@	libm/ld128/libm_a-k_sinl.$(OBJEXT) \
> +@HAVE_LIBM_MACHINE_AARCH64_FALSE@@HAVE_LIBM_MACHINE_RISCV_TRUE@	libm/ld128/libm_a-k_tanl.$(OBJEXT) \
> +@HAVE_LIBM_MACHINE_AARCH64_FALSE@@HAVE_LIBM_MACHINE_RISCV_TRUE@	libm/ld128/libm_a-s_sinpil.$(OBJEXT) \
> +@HAVE_LIBM_MACHINE_AARCH64_FALSE@@HAVE_LIBM_MACHINE_RISCV_TRUE@	libm/ld128/libm_a-s_cospil.$(OBJEXT)
>  @HAVE_LIBM_MACHINE_AARCH64_TRUE@am__objects_162 = libm/ld128/libm_a-e_powl.$(OBJEXT) \
>  @HAVE_LIBM_MACHINE_AARCH64_TRUE@	libm/ld128/libm_a-s_erfl.$(OBJEXT) \
>  @HAVE_LIBM_MACHINE_AARCH64_TRUE@	libm/ld128/libm_a-s_exp2l.$(OBJEXT) \
> @@ -3254,7 +3257,10 @@ am__objects_159 = libm/fenv/libm_a-feclearexcept.$(OBJEXT) \
>  @HAVE_LIBM_MACHINE_AARCH64_TRUE@	libm/ld128/libm_a-invtrig.$(OBJEXT) \
>  @HAVE_LIBM_MACHINE_AARCH64_TRUE@	libm/ld128/libm_a-e_lgammal_r.$(OBJEXT) \
>  @HAVE_LIBM_MACHINE_AARCH64_TRUE@	libm/ld128/libm_a-k_cosl.$(OBJEXT) \
> -@HAVE_LIBM_MACHINE_AARCH64_TRUE@	libm/ld128/libm_a-k_sinl.$(OBJEXT)
> +@HAVE_LIBM_MACHINE_AARCH64_TRUE@	libm/ld128/libm_a-k_sinl.$(OBJEXT) \
> +@HAVE_LIBM_MACHINE_AARCH64_TRUE@	libm/ld128/libm_a-k_tanl.$(OBJEXT) \
> +@HAVE_LIBM_MACHINE_AARCH64_TRUE@	libm/ld128/libm_a-s_sinpil.$(OBJEXT) \
> +@HAVE_LIBM_MACHINE_AARCH64_TRUE@	libm/ld128/libm_a-s_cospil.$(OBJEXT)
>  @HAVE_LIBM_MACHINE_AARCH64_TRUE@@HAVE_LONG_DOUBLE_TRUE@am__objects_163 = $(am__objects_162)
>  @HAVE_LIBM_MACHINE_AMDGCN_TRUE@am__objects_164 = libm/machine/amdgcn/libm_a-v64_mathcnst.$(OBJEXT) \
>  @HAVE_LIBM_MACHINE_AMDGCN_TRUE@	libm/machine/amdgcn/libm_a-v64_reent.$(OBJEXT) \
> @@ -3426,7 +3432,8 @@ am__objects_159 = libm/fenv/libm_a-feclearexcept.$(OBJEXT) \
>  @HAVE_LIBM_MACHINE_I386_FALSE@@HAVE_LIBM_MACHINE_X86_64_TRUE@	libm/ld80/libm_a-invtrig.$(OBJEXT) \
>  @HAVE_LIBM_MACHINE_I386_FALSE@@HAVE_LIBM_MACHINE_X86_64_TRUE@	libm/ld80/libm_a-e_lgammal_r.$(OBJEXT) \
>  @HAVE_LIBM_MACHINE_I386_FALSE@@HAVE_LIBM_MACHINE_X86_64_TRUE@	libm/ld80/libm_a-k_cosl.$(OBJEXT) \
> -@HAVE_LIBM_MACHINE_I386_FALSE@@HAVE_LIBM_MACHINE_X86_64_TRUE@	libm/ld80/libm_a-k_sinl.$(OBJEXT)
> +@HAVE_LIBM_MACHINE_I386_FALSE@@HAVE_LIBM_MACHINE_X86_64_TRUE@	libm/ld80/libm_a-k_sinl.$(OBJEXT) \
> +@HAVE_LIBM_MACHINE_I386_FALSE@@HAVE_LIBM_MACHINE_X86_64_TRUE@	libm/ld80/libm_a-k_tanl.$(OBJEXT)
>  @HAVE_LIBM_MACHINE_I386_TRUE@am__objects_170 = libm/ld80/libm_a-b_tgammal.$(OBJEXT) \
>  @HAVE_LIBM_MACHINE_I386_TRUE@	libm/ld80/libm_a-e_powl.$(OBJEXT) \
>  @HAVE_LIBM_MACHINE_I386_TRUE@	libm/ld80/libm_a-s_erfl.$(OBJEXT) \
> @@ -3438,7 +3445,8 @@ am__objects_159 = libm/fenv/libm_a-feclearexcept.$(OBJEXT) \
>  @HAVE_LIBM_MACHINE_I386_TRUE@	libm/ld80/libm_a-invtrig.$(OBJEXT) \
>  @HAVE_LIBM_MACHINE_I386_TRUE@	libm/ld80/libm_a-e_lgammal_r.$(OBJEXT) \
>  @HAVE_LIBM_MACHINE_I386_TRUE@	libm/ld80/libm_a-k_cosl.$(OBJEXT) \
> -@HAVE_LIBM_MACHINE_I386_TRUE@	libm/ld80/libm_a-k_sinl.$(OBJEXT)
> +@HAVE_LIBM_MACHINE_I386_TRUE@	libm/ld80/libm_a-k_sinl.$(OBJEXT) \
> +@HAVE_LIBM_MACHINE_I386_TRUE@	libm/ld80/libm_a-k_tanl.$(OBJEXT)
>  @HAVE_LIBM_MACHINE_I386_TRUE@@HAVE_LONG_DOUBLE_TRUE@am__objects_171 = $(am__objects_170)
>  @HAVE_LIBM_MACHINE_MIPS_TRUE@am__objects_172 = libm/machine/mips/libm_a-feclearexcept.$(OBJEXT) \
>  @HAVE_LIBM_MACHINE_MIPS_TRUE@	libm/machine/mips/libm_a-fegetenv.$(OBJEXT) \
> @@ -3971,7 +3979,6 @@ pdfdir = @pdfdir@
>  prefix = @prefix@
>  program_transform_name = @program_transform_name@
>  psdir = @psdir@
> -runstatedir = @runstatedir@
>  sbindir = @sbindir@
>  shared_machine_dir = @shared_machine_dir@
>  sharedstatedir = @sharedstatedir@
> @@ -5066,12 +5073,14 @@ libm_test_test_LDADD = $(CRT0) libm.a libc.a
>  @HAVE_LIBM_MACHINE_AARCH64_TRUE@libm_ld128_lsrc = \
>  @HAVE_LIBM_MACHINE_AARCH64_TRUE@	libm/ld128/e_powl.c libm/ld128/s_erfl.c libm/ld128/s_exp2l.c libm/ld128/s_expl.c \
>  @HAVE_LIBM_MACHINE_AARCH64_TRUE@	libm/ld128/s_logl.c libm/ld128/b_tgammal.c libm/ld128/invtrig.c \
> -@HAVE_LIBM_MACHINE_AARCH64_TRUE@	libm/ld128/e_lgammal_r.c libm/ld128/k_cosl.c libm/ld128/k_sinl.c
> +@HAVE_LIBM_MACHINE_AARCH64_TRUE@	libm/ld128/e_lgammal_r.c libm/ld128/k_cosl.c libm/ld128/k_sinl.c \
> +@HAVE_LIBM_MACHINE_AARCH64_TRUE@	libm/ld128/k_tanl.c libm/ld128/s_sinpil.c libm/ld128/s_cospil.c
>  
>  @HAVE_LIBM_MACHINE_RISCV_TRUE@libm_ld128_lsrc = \
>  @HAVE_LIBM_MACHINE_RISCV_TRUE@	libm/ld128/e_powl.c libm/ld128/s_erfl.c libm/ld128/s_exp2l.c libm/ld128/s_expl.c \
>  @HAVE_LIBM_MACHINE_RISCV_TRUE@	libm/ld128/s_logl.c libm/ld128/b_tgammal.c libm/ld128/invtrig.c \
> -@HAVE_LIBM_MACHINE_RISCV_TRUE@	libm/ld128/e_lgammal_r.c libm/ld128/k_cosl.c libm/ld128/k_sinl.c
> +@HAVE_LIBM_MACHINE_RISCV_TRUE@	libm/ld128/e_lgammal_r.c libm/ld128/k_cosl.c libm/ld128/k_sinl.c \
> +@HAVE_LIBM_MACHINE_RISCV_TRUE@	libm/ld128/k_tanl.c libm/ld128/s_sinpil.c libm/ld128/s_cospil.c
>  
>  @HAVE_LIBM_MACHINE_AARCH64_TRUE@libm_a_CFLAGS_libm_ld128 = -fbuiltin -fno-math-errno
>  @HAVE_LIBM_MACHINE_RISCV_TRUE@libm_a_CFLAGS_libm_ld128 = -fbuiltin -fno-math-errno
> @@ -5212,12 +5221,14 @@ libm_test_test_LDADD = $(CRT0) libm.a libc.a
>  @HAVE_LIBM_MACHINE_I386_TRUE@libm_ld80_lsrc = \
>  @HAVE_LIBM_MACHINE_I386_TRUE@	libm/ld80/b_tgammal.c libm/ld80/e_powl.c libm/ld80/s_erfl.c libm/ld80/s_exp2l.c \
>  @HAVE_LIBM_MACHINE_I386_TRUE@	libm/ld80/s_expl.c libm/ld80/s_logl.c libm/ld80/s_sinpil.c libm/ld80/s_cospil.c \
> -@HAVE_LIBM_MACHINE_I386_TRUE@	libm/ld80/invtrig.c libm/ld80/e_lgammal_r.c libm/ld80/k_cosl.c libm/ld80/k_sinl.c
> +@HAVE_LIBM_MACHINE_I386_TRUE@	libm/ld80/invtrig.c libm/ld80/e_lgammal_r.c libm/ld80/k_cosl.c libm/ld80/k_sinl.c \
> +@HAVE_LIBM_MACHINE_I386_TRUE@	libm/ld80/k_tanl.c
>  
>  @HAVE_LIBM_MACHINE_X86_64_TRUE@libm_ld80_lsrc = \
>  @HAVE_LIBM_MACHINE_X86_64_TRUE@	libm/ld80/b_tgammal.c libm/ld80/e_powl.c libm/ld80/s_erfl.c libm/ld80/s_exp2l.c \
>  @HAVE_LIBM_MACHINE_X86_64_TRUE@	libm/ld80/s_expl.c libm/ld80/s_logl.c libm/ld80/s_sinpil.c libm/ld80/s_cospil.c \
> -@HAVE_LIBM_MACHINE_X86_64_TRUE@	libm/ld80/invtrig.c libm/ld80/e_lgammal_r.c libm/ld80/k_cosl.c libm/ld80/k_sinl.c
> +@HAVE_LIBM_MACHINE_X86_64_TRUE@	libm/ld80/invtrig.c libm/ld80/e_lgammal_r.c libm/ld80/k_cosl.c libm/ld80/k_sinl.c \
> +@HAVE_LIBM_MACHINE_X86_64_TRUE@	libm/ld80/k_tanl.c
>  
>  @HAVE_LIBM_MACHINE_I386_TRUE@libm_a_CFLAGS_libm_ld80 = -fbuiltin -fno-math-errno
>  @HAVE_LIBM_MACHINE_X86_64_TRUE@libm_a_CFLAGS_libm_ld80 = -fbuiltin -fno-math-errno
> @@ -11059,6 +11070,12 @@ libm/ld128/libm_a-k_cosl.$(OBJEXT): libm/ld128/$(am__dirstamp) \
>  	libm/ld128/$(DEPDIR)/$(am__dirstamp)
>  libm/ld128/libm_a-k_sinl.$(OBJEXT): libm/ld128/$(am__dirstamp) \
>  	libm/ld128/$(DEPDIR)/$(am__dirstamp)
> +libm/ld128/libm_a-k_tanl.$(OBJEXT): libm/ld128/$(am__dirstamp) \
> +	libm/ld128/$(DEPDIR)/$(am__dirstamp)
> +libm/ld128/libm_a-s_sinpil.$(OBJEXT): libm/ld128/$(am__dirstamp) \
> +	libm/ld128/$(DEPDIR)/$(am__dirstamp)
> +libm/ld128/libm_a-s_cospil.$(OBJEXT): libm/ld128/$(am__dirstamp) \
> +	libm/ld128/$(DEPDIR)/$(am__dirstamp)
>  libm/machine/amdgcn/$(am__dirstamp):
>  	@$(MKDIR_P) libm/machine/amdgcn
>  	@: > libm/machine/amdgcn/$(am__dirstamp)
> @@ -11575,6 +11592,8 @@ libm/ld80/libm_a-k_cosl.$(OBJEXT): libm/ld80/$(am__dirstamp) \
>  	libm/ld80/$(DEPDIR)/$(am__dirstamp)
>  libm/ld80/libm_a-k_sinl.$(OBJEXT): libm/ld80/$(am__dirstamp) \
>  	libm/ld80/$(DEPDIR)/$(am__dirstamp)
> +libm/ld80/libm_a-k_tanl.$(OBJEXT): libm/ld80/$(am__dirstamp) \
> +	libm/ld80/$(DEPDIR)/$(am__dirstamp)
>  libm/machine/mips/$(am__dirstamp):
>  	@$(MKDIR_P) libm/machine/mips
>  	@: > libm/machine/mips/$(am__dirstamp)
> @@ -14427,16 +14446,20 @@ distclean-compile:
>  @AMDEP_TRUE@@am__include@ @am__quote@libm/ld128/$(DEPDIR)/libm_a-invtrig.Po@am__quote@
>  @AMDEP_TRUE@@am__include@ @am__quote@libm/ld128/$(DEPDIR)/libm_a-k_cosl.Po@am__quote@
>  @AMDEP_TRUE@@am__include@ @am__quote@libm/ld128/$(DEPDIR)/libm_a-k_sinl.Po@am__quote@
> +@AMDEP_TRUE@@am__include@ @am__quote@libm/ld128/$(DEPDIR)/libm_a-k_tanl.Po@am__quote@
> +@AMDEP_TRUE@@am__include@ @am__quote@libm/ld128/$(DEPDIR)/libm_a-s_cospil.Po@am__quote@
>  @AMDEP_TRUE@@am__include@ @am__quote@libm/ld128/$(DEPDIR)/libm_a-s_erfl.Po@am__quote@
>  @AMDEP_TRUE@@am__include@ @am__quote@libm/ld128/$(DEPDIR)/libm_a-s_exp2l.Po@am__quote@
>  @AMDEP_TRUE@@am__include@ @am__quote@libm/ld128/$(DEPDIR)/libm_a-s_expl.Po@am__quote@
>  @AMDEP_TRUE@@am__include@ @am__quote@libm/ld128/$(DEPDIR)/libm_a-s_logl.Po@am__quote@
> +@AMDEP_TRUE@@am__include@ @am__quote@libm/ld128/$(DEPDIR)/libm_a-s_sinpil.Po@am__quote@
>  @AMDEP_TRUE@@am__include@ @am__quote@libm/ld80/$(DEPDIR)/libm_a-b_tgammal.Po@am__quote@
>  @AMDEP_TRUE@@am__include@ @am__quote@libm/ld80/$(DEPDIR)/libm_a-e_lgammal_r.Po@am__quote@
>  @AMDEP_TRUE@@am__include@ @am__quote@libm/ld80/$(DEPDIR)/libm_a-e_powl.Po@am__quote@
>  @AMDEP_TRUE@@am__include@ @am__quote@libm/ld80/$(DEPDIR)/libm_a-invtrig.Po@am__quote@
>  @AMDEP_TRUE@@am__include@ @am__quote@libm/ld80/$(DEPDIR)/libm_a-k_cosl.Po@am__quote@
>  @AMDEP_TRUE@@am__include@ @am__quote@libm/ld80/$(DEPDIR)/libm_a-k_sinl.Po@am__quote@
> +@AMDEP_TRUE@@am__include@ @am__quote@libm/ld80/$(DEPDIR)/libm_a-k_tanl.Po@am__quote@
>  @AMDEP_TRUE@@am__include@ @am__quote@libm/ld80/$(DEPDIR)/libm_a-s_cospil.Po@am__quote@
>  @AMDEP_TRUE@@am__include@ @am__quote@libm/ld80/$(DEPDIR)/libm_a-s_erfl.Po@am__quote@
>  @AMDEP_TRUE@@am__include@ @am__quote@libm/ld80/$(DEPDIR)/libm_a-s_exp2l.Po@am__quote@
> @@ -44350,6 +44373,48 @@ libm/ld128/libm_a-k_sinl.obj: libm/ld128/k_sinl.c
>  @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
>  @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -c -o libm/ld128/libm_a-k_sinl.obj `if test -f 'libm/ld128/k_sinl.c'; then $(CYGPATH_W) 'libm/ld128/k_sinl.c'; else $(CYGPATH_W) '$(srcdir)/libm/ld128/k_sinl.c'; fi`
>  
> +libm/ld128/libm_a-k_tanl.o: libm/ld128/k_tanl.c
> +@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -MT libm/ld128/libm_a-k_tanl.o -MD -MP -MF libm/ld128/$(DEPDIR)/libm_a-k_tanl.Tpo -c -o libm/ld128/libm_a-k_tanl.o `test -f 'libm/ld128/k_tanl.c' || echo '$(srcdir)/'`libm/ld128/k_tanl.c
> +@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) libm/ld128/$(DEPDIR)/libm_a-k_tanl.Tpo libm/ld128/$(DEPDIR)/libm_a-k_tanl.Po
> +@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='libm/ld128/k_tanl.c' object='libm/ld128/libm_a-k_tanl.o' libtool=no @AMDEPBACKSLASH@
> +@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
> +@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -c -o libm/ld128/libm_a-k_tanl.o `test -f 'libm/ld128/k_tanl.c' || echo '$(srcdir)/'`libm/ld128/k_tanl.c
> +
> +libm/ld128/libm_a-k_tanl.obj: libm/ld128/k_tanl.c
> +@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -MT libm/ld128/libm_a-k_tanl.obj -MD -MP -MF libm/ld128/$(DEPDIR)/libm_a-k_tanl.Tpo -c -o libm/ld128/libm_a-k_tanl.obj `if test -f 'libm/ld128/k_tanl.c'; then $(CYGPATH_W) 'libm/ld128/k_tanl.c'; else $(CYGPATH_W) '$(srcdir)/libm/ld128/k_tanl.c'; fi`
> +@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) libm/ld128/$(DEPDIR)/libm_a-k_tanl.Tpo libm/ld128/$(DEPDIR)/libm_a-k_tanl.Po
> +@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='libm/ld128/k_tanl.c' object='libm/ld128/libm_a-k_tanl.obj' libtool=no @AMDEPBACKSLASH@
> +@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
> +@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -c -o libm/ld128/libm_a-k_tanl.obj `if test -f 'libm/ld128/k_tanl.c'; then $(CYGPATH_W) 'libm/ld128/k_tanl.c'; else $(CYGPATH_W) '$(srcdir)/libm/ld128/k_tanl.c'; fi`
> +
> +libm/ld128/libm_a-s_sinpil.o: libm/ld128/s_sinpil.c
> +@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -MT libm/ld128/libm_a-s_sinpil.o -MD -MP -MF libm/ld128/$(DEPDIR)/libm_a-s_sinpil.Tpo -c -o libm/ld128/libm_a-s_sinpil.o `test -f 'libm/ld128/s_sinpil.c' || echo '$(srcdir)/'`libm/ld128/s_sinpil.c
> +@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) libm/ld128/$(DEPDIR)/libm_a-s_sinpil.Tpo libm/ld128/$(DEPDIR)/libm_a-s_sinpil.Po
> +@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='libm/ld128/s_sinpil.c' object='libm/ld128/libm_a-s_sinpil.o' libtool=no @AMDEPBACKSLASH@
> +@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
> +@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -c -o libm/ld128/libm_a-s_sinpil.o `test -f 'libm/ld128/s_sinpil.c' || echo '$(srcdir)/'`libm/ld128/s_sinpil.c
> +
> +libm/ld128/libm_a-s_sinpil.obj: libm/ld128/s_sinpil.c
> +@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -MT libm/ld128/libm_a-s_sinpil.obj -MD -MP -MF libm/ld128/$(DEPDIR)/libm_a-s_sinpil.Tpo -c -o libm/ld128/libm_a-s_sinpil.obj `if test -f 'libm/ld128/s_sinpil.c'; then $(CYGPATH_W) 'libm/ld128/s_sinpil.c'; else $(CYGPATH_W) '$(srcdir)/libm/ld128/s_sinpil.c'; fi`
> +@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) libm/ld128/$(DEPDIR)/libm_a-s_sinpil.Tpo libm/ld128/$(DEPDIR)/libm_a-s_sinpil.Po
> +@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='libm/ld128/s_sinpil.c' object='libm/ld128/libm_a-s_sinpil.obj' libtool=no @AMDEPBACKSLASH@
> +@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
> +@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -c -o libm/ld128/libm_a-s_sinpil.obj `if test -f 'libm/ld128/s_sinpil.c'; then $(CYGPATH_W) 'libm/ld128/s_sinpil.c'; else $(CYGPATH_W) '$(srcdir)/libm/ld128/s_sinpil.c'; fi`
> +
> +libm/ld128/libm_a-s_cospil.o: libm/ld128/s_cospil.c
> +@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -MT libm/ld128/libm_a-s_cospil.o -MD -MP -MF libm/ld128/$(DEPDIR)/libm_a-s_cospil.Tpo -c -o libm/ld128/libm_a-s_cospil.o `test -f 'libm/ld128/s_cospil.c' || echo '$(srcdir)/'`libm/ld128/s_cospil.c
> +@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) libm/ld128/$(DEPDIR)/libm_a-s_cospil.Tpo libm/ld128/$(DEPDIR)/libm_a-s_cospil.Po
> +@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='libm/ld128/s_cospil.c' object='libm/ld128/libm_a-s_cospil.o' libtool=no @AMDEPBACKSLASH@
> +@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
> +@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -c -o libm/ld128/libm_a-s_cospil.o `test -f 'libm/ld128/s_cospil.c' || echo '$(srcdir)/'`libm/ld128/s_cospil.c
> +
> +libm/ld128/libm_a-s_cospil.obj: libm/ld128/s_cospil.c
> +@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -MT libm/ld128/libm_a-s_cospil.obj -MD -MP -MF libm/ld128/$(DEPDIR)/libm_a-s_cospil.Tpo -c -o libm/ld128/libm_a-s_cospil.obj `if test -f 'libm/ld128/s_cospil.c'; then $(CYGPATH_W) 'libm/ld128/s_cospil.c'; else $(CYGPATH_W) '$(srcdir)/libm/ld128/s_cospil.c'; fi`
> +@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) libm/ld128/$(DEPDIR)/libm_a-s_cospil.Tpo libm/ld128/$(DEPDIR)/libm_a-s_cospil.Po
> +@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='libm/ld128/s_cospil.c' object='libm/ld128/libm_a-s_cospil.obj' libtool=no @AMDEPBACKSLASH@
> +@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
> +@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -c -o libm/ld128/libm_a-s_cospil.obj `if test -f 'libm/ld128/s_cospil.c'; then $(CYGPATH_W) 'libm/ld128/s_cospil.c'; else $(CYGPATH_W) '$(srcdir)/libm/ld128/s_cospil.c'; fi`
> +
>  libm/machine/amdgcn/libm_a-v64_mathcnst.o: libm/machine/amdgcn/v64_mathcnst.c
>  @am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -MT libm/machine/amdgcn/libm_a-v64_mathcnst.o -MD -MP -MF libm/machine/amdgcn/$(DEPDIR)/libm_a-v64_mathcnst.Tpo -c -o libm/machine/amdgcn/libm_a-v64_mathcnst.o `test -f 'libm/machine/amdgcn/v64_mathcnst.c' || echo '$(srcdir)/'`libm/machine/amdgcn/v64_mathcnst.c
>  @am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) libm/machine/amdgcn/$(DEPDIR)/libm_a-v64_mathcnst.Tpo libm/machine/amdgcn/$(DEPDIR)/libm_a-v64_mathcnst.Po
> @@ -46534,6 +46599,20 @@ libm/ld80/libm_a-k_sinl.obj: libm/ld80/k_sinl.c
>  @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
>  @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -c -o libm/ld80/libm_a-k_sinl.obj `if test -f 'libm/ld80/k_sinl.c'; then $(CYGPATH_W) 'libm/ld80/k_sinl.c'; else $(CYGPATH_W) '$(srcdir)/libm/ld80/k_sinl.c'; fi`
>  
> +libm/ld80/libm_a-k_tanl.o: libm/ld80/k_tanl.c
> +@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -MT libm/ld80/libm_a-k_tanl.o -MD -MP -MF libm/ld80/$(DEPDIR)/libm_a-k_tanl.Tpo -c -o libm/ld80/libm_a-k_tanl.o `test -f 'libm/ld80/k_tanl.c' || echo '$(srcdir)/'`libm/ld80/k_tanl.c
> +@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) libm/ld80/$(DEPDIR)/libm_a-k_tanl.Tpo libm/ld80/$(DEPDIR)/libm_a-k_tanl.Po
> +@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='libm/ld80/k_tanl.c' object='libm/ld80/libm_a-k_tanl.o' libtool=no @AMDEPBACKSLASH@
> +@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
> +@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -c -o libm/ld80/libm_a-k_tanl.o `test -f 'libm/ld80/k_tanl.c' || echo '$(srcdir)/'`libm/ld80/k_tanl.c
> +
> +libm/ld80/libm_a-k_tanl.obj: libm/ld80/k_tanl.c
> +@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -MT libm/ld80/libm_a-k_tanl.obj -MD -MP -MF libm/ld80/$(DEPDIR)/libm_a-k_tanl.Tpo -c -o libm/ld80/libm_a-k_tanl.obj `if test -f 'libm/ld80/k_tanl.c'; then $(CYGPATH_W) 'libm/ld80/k_tanl.c'; else $(CYGPATH_W) '$(srcdir)/libm/ld80/k_tanl.c'; fi`
> +@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) libm/ld80/$(DEPDIR)/libm_a-k_tanl.Tpo libm/ld80/$(DEPDIR)/libm_a-k_tanl.Po
> +@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='libm/ld80/k_tanl.c' object='libm/ld80/libm_a-k_tanl.obj' libtool=no @AMDEPBACKSLASH@
> +@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
> +@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -c -o libm/ld80/libm_a-k_tanl.obj `if test -f 'libm/ld80/k_tanl.c'; then $(CYGPATH_W) 'libm/ld80/k_tanl.c'; else $(CYGPATH_W) '$(srcdir)/libm/ld80/k_tanl.c'; fi`
> +
>  libm/machine/mips/libm_a-feclearexcept.o: libm/machine/mips/feclearexcept.c
>  @am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -MT libm/machine/mips/libm_a-feclearexcept.o -MD -MP -MF libm/machine/mips/$(DEPDIR)/libm_a-feclearexcept.Tpo -c -o libm/machine/mips/libm_a-feclearexcept.o `test -f 'libm/machine/mips/feclearexcept.c' || echo '$(srcdir)/'`libm/machine/mips/feclearexcept.c
>  @am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) libm/machine/mips/$(DEPDIR)/libm_a-feclearexcept.Tpo libm/machine/mips/$(DEPDIR)/libm_a-feclearexcept.Po
> diff --git a/newlib/libm/ld/math_private.h b/newlib/libm/ld/math_private.h
> index c5b88f65e..6d0183e3c 100644
> --- a/newlib/libm/ld/math_private.h
> +++ b/newlib/libm/ld/math_private.h
> @@ -705,6 +705,59 @@ irintl(long double x)
>  }
>  #endif
>  
> +/*
> + * The following are fast floor macros for 0 <= |x| < 0x1p(N-1), where
> + * N is the precision of the type of x. These macros are used in the
> + * half-cycle trignometric functions (e.g., sinpi(x)).
> + */
> +#define	FFLOORF(x, j0, ix) do {			\
> +	(j0) = (((ix) >> 23) & 0xff) - 0x7f;	\
> +	(ix) &= ~(0x007fffff >> (j0));		\
> +	SET_FLOAT_WORD((x), (ix));		\
> +} while (0)
> +
> +#define	FFLOOR(x, j0, ix, lx) do {				\
> +	(j0) = (((ix) >> 20) & 0x7ff) - 0x3ff;			\
> +	if ((j0) < 20) {					\
> +		(ix) &= ~(0x000fffff >> (j0));			\
> +		(lx) = 0;					\
> +	} else {						\
> +		(lx) &= ~((uint32_t)0xffffffff >> ((j0) - 20));	\
> +	}							\
> +	INSERT_WORDS((x), (ix), (lx));				\
> +} while (0)
> +
> +#define	FFLOORL80(x, j0, ix, lx) do {			\
> +	j0 = ix - 0x3fff + 1;				\
> +	if ((j0) < 32) {				\
> +		(lx) = ((lx) >> 32) << 32;		\
> +		(lx) &= ~((((lx) << 32)-1) >> (j0));	\
> +	} else {					\
> +		uint64_t _m;				\
> +		_m = (uint64_t)-1 >> (j0);		\
> +		if ((lx) & _m) (lx) &= ~_m;		\
> +	}						\
> +	INSERT_LDBL80_WORDS((x), (ix), (lx));		\
> +} while (0)
> +
> +#define FFLOORL128(x, ai, ar) do {			\
> +	union IEEEl2bits u;				\
> +	uint64_t m;					\
> +	int e;						\
> +	u.e = (x);					\
> +	e = u.bits.exp - 16383;				\
> +	if (e < 48) {					\
> +		m = ((1llu << 49) - 1) >> (e + 1);	\
> +		u.bits.manh &= ~m;			\
> +		u.bits.manl = 0;			\
> +	} else {					\
> +		m = (uint64_t)-1 >> (e - 48);		\
> +		u.bits.manl &= ~m;			\
> +	}						\
> +	(ai) = u.e;					\
> +	(ar) = (x) - (ai);				\
> +} while (0)
> +
>  #ifdef DEBUG
>  #if defined(__amd64__) || defined(__i386__)
>  #define	breakpoint()	asm("int $3")
> diff --git a/newlib/libm/ld128/Makefile.inc b/newlib/libm/ld128/Makefile.inc
> index 337284d69..3a04b99a1 100644
> --- a/newlib/libm/ld128/Makefile.inc
> +++ b/newlib/libm/ld128/Makefile.inc
> @@ -1,7 +1,8 @@
>  %C%_lsrc = \
>  	%D%/e_powl.c %D%/s_erfl.c %D%/s_exp2l.c %D%/s_expl.c \
>  	%D%/s_logl.c %D%/b_tgammal.c %D%/invtrig.c \
> -	%D%/e_lgammal_r.c %D%/k_cosl.c %D%/k_sinl.c
> +	%D%/e_lgammal_r.c %D%/k_cosl.c %D%/k_sinl.c \
> +	%D%/k_tanl.c %D%/s_sinpil.c %D%/s_cospil.c
>  
>  libm_a_CFLAGS_%C% = -fbuiltin -fno-math-errno
>  
> diff --git a/newlib/libm/ld128/k_cospil.h b/newlib/libm/ld128/k_cospil.h
> new file mode 100644
> index 000000000..592f19229
> --- /dev/null
> +++ b/newlib/libm/ld128/k_cospil.h
> @@ -0,0 +1,42 @@
> +/*-
> + * Copyright (c) 2017 Steven G. Kargl
> + * All rights reserved.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + * 1. Redistributions of source code must retain the above copyright
> + *    notice unmodified, this list of conditions, and the following
> + *    disclaimer.
> + * 2. Redistributions in binary form must reproduce the above copyright
> + *    notice, this list of conditions and the following disclaimer in the
> + *    documentation and/or other materials provided with the distribution.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
> + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
> + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
> + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
> + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
> + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
> + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
> + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
> + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> + */
> +
> +/*
> + * See ../src/k_cospi.c for implementation details.
> + */
> +
> +static inline long double
> +__kernel_cospil(long double x)
> +{
> +	long double hi, lo;
> +
> +	hi = (double)x;
> +	lo = x - hi;
> +	lo = lo * (pi_lo + pi_hi) + hi * pi_lo;
> +	hi *= pi_hi;
> +	_2sumF(hi, lo);
> +	return (__kernel_cosl(hi, lo));
> +}
> diff --git a/newlib/libm/ld128/k_sinpil.h b/newlib/libm/ld128/k_sinpil.h
> new file mode 100644
> index 000000000..fa4e7d633
> --- /dev/null
> +++ b/newlib/libm/ld128/k_sinpil.h
> @@ -0,0 +1,42 @@
> +/*-
> + * Copyright (c) 2017 Steven G. Kargl
> + * All rights reserved.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + * 1. Redistributions of source code must retain the above copyright
> + *    notice unmodified, this list of conditions, and the following
> + *    disclaimer.
> + * 2. Redistributions in binary form must reproduce the above copyright
> + *    notice, this list of conditions and the following disclaimer in the
> + *    documentation and/or other materials provided with the distribution.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
> + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
> + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
> + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
> + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
> + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
> + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
> + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
> + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> + */
> +
> +/*
> + * See ../src/k_sinpi.c for implementation details.
> + */
> +
> +static inline long double
> +__kernel_sinpil(long double x)
> +{
> +	long double hi, lo;
> +
> +	hi = (double)x;
> +	lo = x - hi;
> +	lo = lo * (pi_lo + pi_hi) + hi * pi_lo;
> +	hi *= pi_hi;
> +	_2sumF(hi, lo);
> +	return (__kernel_sinl(hi, lo, 1));
> +}
> diff --git a/newlib/libm/ld128/k_tanl.c b/newlib/libm/ld128/k_tanl.c
> new file mode 100644
> index 000000000..9a58cd264
> --- /dev/null
> +++ b/newlib/libm/ld128/k_tanl.c
> @@ -0,0 +1,114 @@
> +/*
> + * ====================================================
> + * Copyright 2004 Sun Microsystems, Inc.  All Rights Reserved.
> + * Copyright (c) 2008 Steven G. Kargl, David Schultz, Bruce D. Evans.
> + *
> + * Permission to use, copy, modify, and distribute this
> + * software is freely granted, provided that this notice
> + * is preserved.
> + * ====================================================
> + */
> +
> +/*
> + * ld128 version of k_tan.c.  See ../src/k_tan.c for most comments.
> + */
> +
> +#include "math.h"
> +#include "../ld/math_private.h"
> +
> +/*
> + * Domain [-0.67434, 0.67434], range ~[-3.37e-36, 1.982e-37]
> + * |tan(x)/x - t(x)| < 2**-117.8 (XXX should be ~1e-37)
> + *
> + * See ../ld80/k_cosl.c for more details about the polynomial.
> + */
> +static const long double
> +T3 = 0x1.5555555555555555555555555553p-2L,
> +T5 = 0x1.1111111111111111111111111eb5p-3L,
> +T7 = 0x1.ba1ba1ba1ba1ba1ba1ba1b694cd6p-5L,
> +T9 = 0x1.664f4882c10f9f32d6bbe09d8bcdp-6L,
> +T11 = 0x1.226e355e6c23c8f5b4f5762322eep-7L,
> +T13 = 0x1.d6d3d0e157ddfb5fed8e84e27b37p-9L,
> +T15 = 0x1.7da36452b75e2b5fce9ee7c2c92ep-10L,
> +T17 = 0x1.355824803674477dfcf726649efep-11L,
> +T19 = 0x1.f57d7734d1656e0aceb716f614c2p-13L,
> +T21 = 0x1.967e18afcb180ed942dfdc518d6cp-14L,
> +T23 = 0x1.497d8eea21e95bc7e2aa79b9f2cdp-15L,
> +T25 = 0x1.0b132d39f055c81be49eff7afd50p-16L,
> +T27 = 0x1.b0f72d33eff7bfa2fbc1059d90b6p-18L,
> +T29 = 0x1.5ef2daf21d1113df38d0fbc00267p-19L,
> +T31 = 0x1.1c77d6eac0234988cdaa04c96626p-20L,
> +T33 = 0x1.cd2a5a292b180e0bdd701057dfe3p-22L,
> +T35 = 0x1.75c7357d0298c01a31d0a6f7d518p-23L,
> +T37 = 0x1.2f3190f4718a9a520f98f50081fcp-24L,
> +pio4 = 0x1.921fb54442d18469898cc51701b8p-1L,
> +pio4lo = 0x1.cd129024e088a67cc74020bbea60p-116L;
> +
> +static const double
> +T39 =  0.000000028443389121318352,	/*  0x1e8a7592977938.0p-78 */
> +T41 =  0.000000011981013102001973,	/*  0x19baa1b1223219.0p-79 */
> +T43 =  0.0000000038303578044958070,	/*  0x107385dfb24529.0p-80 */
> +T45 =  0.0000000034664378216909893,	/*  0x1dc6c702a05262.0p-81 */
> +T47 = -0.0000000015090641701997785,	/* -0x19ecef3569ebb6.0p-82 */
> +T49 =  0.0000000029449552300483952,	/*  0x194c0668da786a.0p-81 */
> +T51 = -0.0000000022006995706097711,	/* -0x12e763b8845268.0p-81 */
> +T53 =  0.0000000015468200913196612,	/*  0x1a92fc98c29554.0p-82 */
> +T55 = -0.00000000061311613386849674,	/* -0x151106cbc779a9.0p-83 */
> +T57 =  1.4912469681508012e-10;		/*  0x147edbdba6f43a.0p-85 */
> +
> +long double
> +__kernel_tanl(long double x, long double y, int iy) {
> +	long double z, r, v, w, s;
> +	long double osign;
> +	int i;
> +
> +	iy = (iy == 1 ? -1 : 1);	/* XXX recover original interface */
> +	osign = (x >= 0 ? 1.0 : -1.0);	/* XXX slow, probably wrong for -0 */
> +	if (fabsl(x) >= 0.67434) {
> +		if (x < 0) {
> +			x = -x;
> +			y = -y;
> +		}
> +		z = pio4 - x;
> +		w = pio4lo - y;
> +		x = z + w;
> +		y = 0.0;
> +		i = 1;
> +	} else
> +		i = 0;
> +	z = x * x;
> +	w = z * z;
> +	r = T5 + w * (T9 + w * (T13 + w * (T17 + w * (T21 +
> +	    w * (T25 + w * (T29 + w * (T33 +
> +	    w * (T37 + w * (T41 + w * (T45 + w * (T49 + w * (T53 +
> +	    w * T57))))))))))));
> +	v = z * (T7 + w * (T11 + w * (T15 + w * (T19 + w * (T23 +
> +	    w * (T27 + w * (T31 + w * (T35 +
> +	    w * (T39 + w * (T43 + w * (T47 + w * (T51 + w * T55))))))))))));
> +	s = z * x;
> +	r = y + z * (s * (r + v) + y);
> +	r += T3 * s;
> +	w = x + r;
> +	if (i == 1) {
> +		v = (long double) iy;
> +		return osign *
> +			(v - 2.0 * (x - (w * w / (w + v) - r)));
> +	}
> +	if (iy == 1)
> +		return w;
> +	else {
> +		/*
> +		 * if allow error up to 2 ulp, simply return
> +		 * -1.0 / (x+r) here
> +		 */
> +		/* compute -1.0 / (x+r) accurately */
> +		long double a, t;
> +		z = w;
> +		z = z + 0x1p32 - 0x1p32;
> +		v = r - (z - x);	/* z+v = r+x */
> +		t = a = -1.0 / w;	/* a = -1.0/w */
> +		t = t + 0x1p32 - 0x1p32;
> +		s = 1.0 + t * z;
> +		return t + a * (s + t * v);
> +	}
> +}
> diff --git a/newlib/libm/ld128/s_cospil.c b/newlib/libm/ld128/s_cospil.c
> new file mode 100644
> index 000000000..0ef31775f
> --- /dev/null
> +++ b/newlib/libm/ld128/s_cospil.c
> @@ -0,0 +1,108 @@
> +/*-
> + * Copyright (c) 2017-2023 Steven G. Kargl
> + * All rights reserved.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + * 1. Redistributions of source code must retain the above copyright
> + *    notice unmodified, this list of conditions, and the following
> + *    disclaimer.
> + * 2. Redistributions in binary form must reproduce the above copyright
> + *    notice, this list of conditions and the following disclaimer in the
> + *    documentation and/or other materials provided with the distribution.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
> + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
> + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
> + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
> + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
> + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
> + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
> + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
> + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> + */
> +
> +/*
> + * See ../src/s_cospi.c for implementation details.
> + */
> +
> +#include "../ld/fpmath.h"
> +#include "math.h"
> +#include "../ld/math_private.h"
> +
> +/*
> + * pi_hi contains the leading 56 bits of a 169 bit approximation for pi.
> + */
> +static const long double
> +pi_hi = 3.14159265358979322702026593105983920e+00L,
> +pi_lo = 1.14423774522196636802434264184180742e-17L;
> +
> +#include "k_cospil.h"
> +#include "k_sinpil.h"
> +
> +volatile static const double vzero = 0;
> +
> +long double
> +cospil(long double x)
> +{
> +	long double ai, ar, ax, c;
> +
> +	ax = fabsl(x);
> +
> +	if (ax <= 1) {
> +		if (ax < 0.25) {
> +			if (ax < 0x1p-60) {
> +				if ((int)x == 0)
> +					return (1);
> +			}
> +			return (__kernel_cospil(ax));
> +		}
> +
> +		if (ax < 0.5)
> +			c = __kernel_sinpil(0.5 - ax);
> +		else if (ax < 0.75) {
> +			if (ax == 0.5)
> +				return (0);
> +			c = -__kernel_sinpil(ax - 0.5);
> +		} else
> +			c = -__kernel_cospil(1 - ax);
> +		return (c);
> +	}
> +
> +	if (ax < 0x1p112) {
> +		/* Split ax = ai + ar with 0 <= ar < 1. */
> +		FFLOORL128(ax, ai, ar);
> +
> +		if (ar < 0.5) {
> +			if (ar < 0.25)
> +				c = ar == 0 ? 1 : __kernel_cospil(ar);
> +			else
> +				c = __kernel_sinpil(0.5 - ar);
> +		} else {
> +			if (ar < 0.75) {
> +				if (ar == 0.5)
> +					return (0);
> +				c = -__kernel_sinpil(ar - 0.5);
> +			} else
> +				c = -__kernel_cospil(1 - ar);
> +		}
> +		return (fmodl(ai, 2.L) == 0 ? c : -c);
> +	}
> +
> +	if (isinf(x) || isnan(x))
> +		return (vzero / vzero);
> +
> +	/*
> +	 * For |x| >= 0x1p113, it is always an even integer, so return 1.
> +	 */
> +	if (ax >= 0x1p113)
> +		return (1);
> +	/*
> +	 * For 0x1p112 <= |x| < 0x1p113 need to determine if x is an even
> +	 * or odd integer to return 1 or -1.
> +	 */
> +
> +	return (fmodl(ax, 2.L) == 0 ? 1 : -1);
> +}
> diff --git a/newlib/libm/ld128/s_sinpil.c b/newlib/libm/ld128/s_sinpil.c
> new file mode 100644
> index 000000000..30d1881b8
> --- /dev/null
> +++ b/newlib/libm/ld128/s_sinpil.c
> @@ -0,0 +1,111 @@
> +/*-
> + * Copyright (c) 2017-2023 Steven G. Kargl
> + * All rights reserved.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + * 1. Redistributions of source code must retain the above copyright
> + *    notice unmodified, this list of conditions, and the following
> + *    disclaimer.
> + * 2. Redistributions in binary form must reproduce the above copyright
> + *    notice, this list of conditions and the following disclaimer in the
> + *    documentation and/or other materials provided with the distribution.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
> + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
> + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
> + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
> + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
> + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
> + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
> + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
> + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> + */
> +
> +/*
> + * See ../src/s_sinpi.c for implementation details.
> + */
> +
> +#include "../ld/fpmath.h"
> +#include "math.h"
> +#include "../ld/math_private.h"
> +
> +/*
> + * pi_hi contains the leading 56 bits of a 169 bit approximation for pi.
> + */
> +static const long double
> +pi_hi = 3.14159265358979322702026593105983920e+00L,
> +pi_lo = 1.14423774522196636802434264184180742e-17L;
> +
> +#include "k_cospil.h"
> +#include "k_sinpil.h"
> +
> +volatile static const double vzero = 0;
> +
> +long double
> +sinpil(long double x)
> +{
> +	long double ai, ar, ax, hi, lo, s, xhi, xlo;
> +
> +	ax = fabsl(x);
> +
> +	if (ax < 1) {
> +		if (ax < 0.25) {
> +			if (ax < 0x1p-60) {
> +				if (x == 0)
> +					return (x);
> +				hi = (double)x;
> +				hi *= 0x1p113L;
> +				lo = x * 0x1p113L - hi;
> +				s = (pi_lo + pi_hi) * lo + pi_lo * lo +
> +				    pi_hi * hi;
> +				return (s * 0x1p-113L);
> +			}
> +
> +			s = __kernel_sinpil(ax);
> +			return (x < 0 ? -s : s);
> +		}
> +
> +		if (ax < 0.5)
> +			s = __kernel_cospil(0.5 - ax);
> +		else if (ax < 0.75)
> +			s = __kernel_cospil(ax - 0.5);
> +		else
> +			s = __kernel_sinpil(1 - ax);
> +		return (x < 0 ? -s : s);
> +	}
> +
> +	if (ax < 0x1p112) {
> +		/* Split ax = ai + ar with 0 <= ar < 1. */
> +		FFLOORL128(ax, ai, ar);
> +
> +		if (ar == 0) {
> +			s = 0;
> +		} else {
> +			if (ar < 0.5) {
> +				if (ar <= 0.25)
> +					s = __kernel_sinpil(ar);
> +				else
> +					s = __kernel_cospil(0.5 - ar);
> +			} else {
> +				if (ar < 0.75)
> +					s = __kernel_cospil(ar - 0.5);
> +				else
> +					s = __kernel_sinpil(1 - ar);
> +			}
> +
> +			s = fmodl(ai, 2.L) == 0 ? s : -s;
> +		}
> +		return (x < 0 ? -s : s);
> +	}
> +
> +	if (isinf(x) || isnan(x))
> +		return (vzero / vzero);
> +
> +	/*
> +	 * |x| >= 0x1p112 is always an integer, so return +-0.
> +	 */
> +	return (copysignl(0, x));
> +}
> diff --git a/newlib/libm/ld80/Makefile.inc b/newlib/libm/ld80/Makefile.inc
> index 97fbacdda..7bb20f743 100644
> --- a/newlib/libm/ld80/Makefile.inc
> +++ b/newlib/libm/ld80/Makefile.inc
> @@ -1,8 +1,8 @@
>  %C%_lsrc = \
>  	%D%/b_tgammal.c %D%/e_powl.c %D%/s_erfl.c %D%/s_exp2l.c \
>  	%D%/s_expl.c %D%/s_logl.c %D%/s_sinpil.c %D%/s_cospil.c \
> -	%D%/invtrig.c %D%/e_lgammal_r.c %D%/k_cosl.c %D%/k_sinl.c
> -
> +	%D%/invtrig.c %D%/e_lgammal_r.c %D%/k_cosl.c %D%/k_sinl.c \
> +	%D%/k_tanl.c
>  
>  libm_a_CFLAGS_%C% = -fbuiltin -fno-math-errno
>  
> diff --git a/newlib/libm/ld80/k_tanl.c b/newlib/libm/ld80/k_tanl.c
> new file mode 100644
> index 000000000..c55303f01
> --- /dev/null
> +++ b/newlib/libm/ld80/k_tanl.c
> @@ -0,0 +1,119 @@
> +/*
> + * ====================================================
> + * Copyright 2004 Sun Microsystems, Inc.  All Rights Reserved.
> + * Copyright (c) 2008 Steven G. Kargl, David Schultz, Bruce D. Evans.
> + *
> + * Permission to use, copy, modify, and distribute this
> + * software is freely granted, provided that this notice
> + * is preserved.
> + * ====================================================
> + */
> +
> +/*
> + * ld80 version of k_tan.c.  See ../src/k_tan.c for most comments.
> + */
> +
> +#include "math.h"
> +#include "../ld/math_private.h"
> +
> +/*
> + * Domain [-0.67434, 0.67434], range ~[-2.25e-22, 1.921e-22]
> + * |tan(x)/x - t(x)| < 2**-71.9
> + *
> + * See k_cosl.c for more details about the polynomial.
> + */
> +#if defined(__amd64__) || defined(__i386__)
> +/* Long double constants are slow on these arches, and broken on i386. */
> +static const volatile double
> +T3hi =  0.33333333333333331,		/*  0x15555555555555.0p-54 */
> +T3lo =  1.8350121769317163e-17,		/*  0x15280000000000.0p-108 */
> +T5hi =  0.13333333333333336,		/*  0x11111111111112.0p-55 */
> +T5lo =  1.3051083651294260e-17,		/*  0x1e180000000000.0p-109 */
> +T7hi =  0.053968253968250494,		/*  0x1ba1ba1ba1b827.0p-57 */
> +T7lo =  3.1509625637859973e-18,		/*  0x1d100000000000.0p-111 */
> +pio4_hi =  0.78539816339744828,		/*  0x1921fb54442d18.0p-53 */
> +pio4_lo =  3.0628711372715500e-17,	/*  0x11a80000000000.0p-107 */
> +pio4lo_hi = -1.2541394031670831e-20,	/* -0x1d9cceba3f91f2.0p-119 */
> +pio4lo_lo =  6.1493048227390915e-37;	/*  0x1a280000000000.0p-173 */
> +#define	T3	((long double)T3hi + T3lo)
> +#define	T5	((long double)T5hi + T5lo)
> +#define	T7	((long double)T7hi + T7lo)
> +#define	pio4	((long double)pio4_hi + pio4_lo)
> +#define	pio4lo	((long double)pio4lo_hi + pio4lo_lo)
> +#else
> +static const long double
> +T3 =   0.333333333333333333180L,	/*  0xaaaaaaaaaaaaaaa5.0p-65 */
> +T5 =   0.133333333333333372290L,	/*  0x88888888888893c3.0p-66 */
> +T7 =   0.0539682539682504975744L,	/*  0xdd0dd0dd0dc13ba2.0p-68 */
> +pio4 = 0.785398163397448309628L,	/*  0xc90fdaa22168c235.0p-64 */
> +pio4lo = -1.25413940316708300586e-20L;	/* -0xece675d1fc8f8cbb.0p-130 */
> +#endif
> +
> +static const double
> +T9  =  0.021869488536312216,		/*  0x1664f4882cc1c2.0p-58 */
> +T11 =  0.0088632355256619590,		/*  0x1226e355c17612.0p-59 */
> +T13 =  0.0035921281113786528,		/*  0x1d6d3d185d7ff8.0p-61 */
> +T15 =  0.0014558334756312418,		/*  0x17da354aa3f96b.0p-62 */
> +T17 =  0.00059003538700862256,		/*  0x13559358685b83.0p-63 */
> +T19 =  0.00023907843576635544,		/*  0x1f56242026b5be.0p-65 */
> +T21 =  0.000097154625656538905,		/*  0x1977efc26806f4.0p-66 */
> +T23 =  0.000038440165747303162,		/*  0x14275a09b3ceac.0p-67 */
> +T25 =  0.000018082171885432524,		/*  0x12f5e563e5487e.0p-68 */
> +T27 =  0.0000024196006108814377,	/*  0x144c0d80cc6896.0p-71 */
> +T29 =  0.0000078293456938132840,	/*  0x106b59141a6cb3.0p-69 */
> +T31 = -0.0000032609076735050182,	/* -0x1b5abef3ba4b59.0p-71 */
> +T33 =  0.0000023261313142559411;	/*  0x13835436c0c87f.0p-71 */
> +
> +long double
> +__kernel_tanl(long double x, long double y, int iy) {
> +	long double z, r, v, w, s;
> +	long double osign;
> +	int i;
> +
> +	iy = (iy == 1 ? -1 : 1);	/* XXX recover original interface */
> +	osign = (x >= 0 ? 1.0 : -1.0);	/* XXX slow, probably wrong for -0 */
> +	if (fabsl(x) >= 0.67434) {
> +		if (x < 0) {
> +			x = -x;
> +			y = -y;
> +		}
> +		z = pio4 - x;
> +		w = pio4lo - y;
> +		x = z + w;
> +		y = 0.0;
> +		i = 1;
> +	} else
> +		i = 0;
> +	z = x * x;
> +	w = z * z;
> +	r = T5 + w * (T9 + w * (T13 + w * (T17 + w * (T21 +
> +	    w * (T25 + w * (T29 + w * T33))))));
> +	v = z * (T7 + w * (T11 + w * (T15 + w * (T19 + w * (T23 +
> +	    w * (T27 + w * T31))))));
> +	s = z * x;
> +	r = y + z * (s * (r + v) + y);
> +	r += T3 * s;
> +	w = x + r;
> +	if (i == 1) {
> +		v = (long double) iy;
> +		return osign *
> +			(v - 2.0 * (x - (w * w / (w + v) - r)));
> +	}
> +	if (iy == 1)
> +		return w;
> +	else {
> +		/*
> +		 * if allow error up to 2 ulp, simply return
> +		 * -1.0 / (x+r) here
> +		 */
> +		/* compute -1.0 / (x+r) accurately */
> +		long double a, t;
> +		z = w;
> +		z = z + 0x1p32 - 0x1p32;
> +		v = r - (z - x);	/* z+v = r+x */
> +		t = a = -1.0 / w;	/* a = -1.0/w */
> +		t = t + 0x1p32 - 0x1p32;
> +		s = 1.0 + t * z;
> +		return t + a * (s + t * v);
> +	}
> +}
> -- 
> 2.34.1
  
Jeff Johnston July 16, 2024, 7:21 p.m. UTC | #2
Thanks Kito.  Patch applied.

-- Jeff J.

On Tue, Jul 16, 2024 at 5:32 AM Corinna Vinschen <vinschen@redhat.com>
wrote:

>
> Jeff, ping?  I think that looks ok, but it's libm, yuk.
>
> Thanks,
> Corinna
>
> On Jul 10 17:44, Kito Cheng wrote:
> > For RISC-V, AArch64, i386, and x86_64
> >
> > - k_tanl.c is required for tanl; the linker will report `__kernel_tanl`
> >   not found when tanl is called.
> > - s_cospil.c and s_sinpil.c are added for cospil and sinpil, which are
> already
> >   available for ld80 but not for ld128.
> > ---
> >  newlib/Makefile.in             |  97 ++++++++++++++++++++++++---
> >  newlib/libm/ld/math_private.h  |  53 +++++++++++++++
> >  newlib/libm/ld128/Makefile.inc |   3 +-
> >  newlib/libm/ld128/k_cospil.h   |  42 ++++++++++++
> >  newlib/libm/ld128/k_sinpil.h   |  42 ++++++++++++
> >  newlib/libm/ld128/k_tanl.c     | 114 +++++++++++++++++++++++++++++++
> >  newlib/libm/ld128/s_cospil.c   | 108 ++++++++++++++++++++++++++++++
> >  newlib/libm/ld128/s_sinpil.c   | 111 ++++++++++++++++++++++++++++++
> >  newlib/libm/ld80/Makefile.inc  |   4 +-
> >  newlib/libm/ld80/k_tanl.c      | 119 +++++++++++++++++++++++++++++++++
> >  10 files changed, 681 insertions(+), 12 deletions(-)
> >  create mode 100644 newlib/libm/ld128/k_cospil.h
> >  create mode 100644 newlib/libm/ld128/k_sinpil.h
> >  create mode 100644 newlib/libm/ld128/k_tanl.c
> >  create mode 100644 newlib/libm/ld128/s_cospil.c
> >  create mode 100644 newlib/libm/ld128/s_sinpil.c
> >  create mode 100644 newlib/libm/ld80/k_tanl.c
> >
> > diff --git a/newlib/Makefile.in b/newlib/Makefile.in
> > index b45c42c36..a051c2760 100644
> > --- a/newlib/Makefile.in
> > +++ b/newlib/Makefile.in
> > @@ -3244,7 +3244,10 @@ am__objects_159 =
> libm/fenv/libm_a-feclearexcept.$(OBJEXT) \
> >  @HAVE_LIBM_MACHINE_AARCH64_FALSE@@HAVE_LIBM_MACHINE_RISCV_TRUE@
> libm/ld128/libm_a-invtrig.$(OBJEXT) \
> >  @HAVE_LIBM_MACHINE_AARCH64_FALSE@@HAVE_LIBM_MACHINE_RISCV_TRUE@
> libm/ld128/libm_a-e_lgammal_r.$(OBJEXT) \
> >  @HAVE_LIBM_MACHINE_AARCH64_FALSE@@HAVE_LIBM_MACHINE_RISCV_TRUE@
> libm/ld128/libm_a-k_cosl.$(OBJEXT) \
> > -@HAVE_LIBM_MACHINE_AARCH64_FALSE@@HAVE_LIBM_MACHINE_RISCV_TRUE@
> libm/ld128/libm_a-k_sinl.$(OBJEXT)
> > +@HAVE_LIBM_MACHINE_AARCH64_FALSE@@HAVE_LIBM_MACHINE_RISCV_TRUE@
> libm/ld128/libm_a-k_sinl.$(OBJEXT) \
> > +@HAVE_LIBM_MACHINE_AARCH64_FALSE@@HAVE_LIBM_MACHINE_RISCV_TRUE@
> libm/ld128/libm_a-k_tanl.$(OBJEXT) \
> > +@HAVE_LIBM_MACHINE_AARCH64_FALSE@@HAVE_LIBM_MACHINE_RISCV_TRUE@
> libm/ld128/libm_a-s_sinpil.$(OBJEXT) \
> > +@HAVE_LIBM_MACHINE_AARCH64_FALSE@@HAVE_LIBM_MACHINE_RISCV_TRUE@
> libm/ld128/libm_a-s_cospil.$(OBJEXT)
> >  @HAVE_LIBM_MACHINE_AARCH64_TRUE@am__objects_162 =
> libm/ld128/libm_a-e_powl.$(OBJEXT) \
> >  @HAVE_LIBM_MACHINE_AARCH64_TRUE@
>  libm/ld128/libm_a-s_erfl.$(OBJEXT) \
> >  @HAVE_LIBM_MACHINE_AARCH64_TRUE@
>  libm/ld128/libm_a-s_exp2l.$(OBJEXT) \
> > @@ -3254,7 +3257,10 @@ am__objects_159 =
> libm/fenv/libm_a-feclearexcept.$(OBJEXT) \
> >  @HAVE_LIBM_MACHINE_AARCH64_TRUE@
>  libm/ld128/libm_a-invtrig.$(OBJEXT) \
> >  @HAVE_LIBM_MACHINE_AARCH64_TRUE@
>  libm/ld128/libm_a-e_lgammal_r.$(OBJEXT) \
> >  @HAVE_LIBM_MACHINE_AARCH64_TRUE@
>  libm/ld128/libm_a-k_cosl.$(OBJEXT) \
> > -@HAVE_LIBM_MACHINE_AARCH64_TRUE@     libm/ld128/libm_a-k_sinl.$(OBJEXT)
> > +@HAVE_LIBM_MACHINE_AARCH64_TRUE@
>  libm/ld128/libm_a-k_sinl.$(OBJEXT) \
> > +@HAVE_LIBM_MACHINE_AARCH64_TRUE@
>  libm/ld128/libm_a-k_tanl.$(OBJEXT) \
> > +@HAVE_LIBM_MACHINE_AARCH64_TRUE@
>  libm/ld128/libm_a-s_sinpil.$(OBJEXT) \
> > +@HAVE_LIBM_MACHINE_AARCH64_TRUE@
>  libm/ld128/libm_a-s_cospil.$(OBJEXT)
> >  @HAVE_LIBM_MACHINE_AARCH64_TRUE@@HAVE_LONG_DOUBLE_TRUE@am__objects_163
> = $(am__objects_162)
> >  @HAVE_LIBM_MACHINE_AMDGCN_TRUE@am__objects_164 =
> libm/machine/amdgcn/libm_a-v64_mathcnst.$(OBJEXT) \
> >  @HAVE_LIBM_MACHINE_AMDGCN_TRUE@
> libm/machine/amdgcn/libm_a-v64_reent.$(OBJEXT) \
> > @@ -3426,7 +3432,8 @@ am__objects_159 =
> libm/fenv/libm_a-feclearexcept.$(OBJEXT) \
> >  @HAVE_LIBM_MACHINE_I386_FALSE@@HAVE_LIBM_MACHINE_X86_64_TRUE@
> libm/ld80/libm_a-invtrig.$(OBJEXT) \
> >  @HAVE_LIBM_MACHINE_I386_FALSE@@HAVE_LIBM_MACHINE_X86_64_TRUE@
> libm/ld80/libm_a-e_lgammal_r.$(OBJEXT) \
> >  @HAVE_LIBM_MACHINE_I386_FALSE@@HAVE_LIBM_MACHINE_X86_64_TRUE@
> libm/ld80/libm_a-k_cosl.$(OBJEXT) \
> > -@HAVE_LIBM_MACHINE_I386_FALSE@@HAVE_LIBM_MACHINE_X86_64_TRUE@
> libm/ld80/libm_a-k_sinl.$(OBJEXT)
> > +@HAVE_LIBM_MACHINE_I386_FALSE@@HAVE_LIBM_MACHINE_X86_64_TRUE@
> libm/ld80/libm_a-k_sinl.$(OBJEXT) \
> > +@HAVE_LIBM_MACHINE_I386_FALSE@@HAVE_LIBM_MACHINE_X86_64_TRUE@
> libm/ld80/libm_a-k_tanl.$(OBJEXT)
> >  @HAVE_LIBM_MACHINE_I386_TRUE@am__objects_170 =
> libm/ld80/libm_a-b_tgammal.$(OBJEXT) \
> >  @HAVE_LIBM_MACHINE_I386_TRUE@        libm/ld80/libm_a-e_powl.$(OBJEXT)
> \
> >  @HAVE_LIBM_MACHINE_I386_TRUE@        libm/ld80/libm_a-s_erfl.$(OBJEXT)
> \
> > @@ -3438,7 +3445,8 @@ am__objects_159 =
> libm/fenv/libm_a-feclearexcept.$(OBJEXT) \
> >  @HAVE_LIBM_MACHINE_I386_TRUE@
> libm/ld80/libm_a-invtrig.$(OBJEXT) \
> >  @HAVE_LIBM_MACHINE_I386_TRUE@
> libm/ld80/libm_a-e_lgammal_r.$(OBJEXT) \
> >  @HAVE_LIBM_MACHINE_I386_TRUE@        libm/ld80/libm_a-k_cosl.$(OBJEXT)
> \
> > -@HAVE_LIBM_MACHINE_I386_TRUE@        libm/ld80/libm_a-k_sinl.$(OBJEXT)
> > +@HAVE_LIBM_MACHINE_I386_TRUE@        libm/ld80/libm_a-k_sinl.$(OBJEXT)
> \
> > +@HAVE_LIBM_MACHINE_I386_TRUE@        libm/ld80/libm_a-k_tanl.$(OBJEXT)
> >  @HAVE_LIBM_MACHINE_I386_TRUE@@HAVE_LONG_DOUBLE_TRUE@am__objects_171 =
> $(am__objects_170)
> >  @HAVE_LIBM_MACHINE_MIPS_TRUE@am__objects_172 =
> libm/machine/mips/libm_a-feclearexcept.$(OBJEXT) \
> >  @HAVE_LIBM_MACHINE_MIPS_TRUE@
> libm/machine/mips/libm_a-fegetenv.$(OBJEXT) \
> > @@ -3971,7 +3979,6 @@ pdfdir = @pdfdir@
> >  prefix = @prefix@
> >  program_transform_name = @program_transform_name@
> >  psdir = @psdir@
> > -runstatedir = @runstatedir@
> >  sbindir = @sbindir@
> >  shared_machine_dir = @shared_machine_dir@
> >  sharedstatedir = @sharedstatedir@
> > @@ -5066,12 +5073,14 @@ libm_test_test_LDADD = $(CRT0) libm.a libc.a
> >  @HAVE_LIBM_MACHINE_AARCH64_TRUE@libm_ld128_lsrc = \
> >  @HAVE_LIBM_MACHINE_AARCH64_TRUE@     libm/ld128/e_powl.c
> libm/ld128/s_erfl.c libm/ld128/s_exp2l.c libm/ld128/s_expl.c \
> >  @HAVE_LIBM_MACHINE_AARCH64_TRUE@     libm/ld128/s_logl.c
> libm/ld128/b_tgammal.c libm/ld128/invtrig.c \
> > -@HAVE_LIBM_MACHINE_AARCH64_TRUE@     libm/ld128/e_lgammal_r.c
> libm/ld128/k_cosl.c libm/ld128/k_sinl.c
> > +@HAVE_LIBM_MACHINE_AARCH64_TRUE@     libm/ld128/e_lgammal_r.c
> libm/ld128/k_cosl.c libm/ld128/k_sinl.c \
> > +@HAVE_LIBM_MACHINE_AARCH64_TRUE@     libm/ld128/k_tanl.c
> libm/ld128/s_sinpil.c libm/ld128/s_cospil.c
> >
> >  @HAVE_LIBM_MACHINE_RISCV_TRUE@libm_ld128_lsrc = \
> >  @HAVE_LIBM_MACHINE_RISCV_TRUE@       libm/ld128/e_powl.c
> libm/ld128/s_erfl.c libm/ld128/s_exp2l.c libm/ld128/s_expl.c \
> >  @HAVE_LIBM_MACHINE_RISCV_TRUE@       libm/ld128/s_logl.c
> libm/ld128/b_tgammal.c libm/ld128/invtrig.c \
> > -@HAVE_LIBM_MACHINE_RISCV_TRUE@       libm/ld128/e_lgammal_r.c
> libm/ld128/k_cosl.c libm/ld128/k_sinl.c
> > +@HAVE_LIBM_MACHINE_RISCV_TRUE@       libm/ld128/e_lgammal_r.c
> libm/ld128/k_cosl.c libm/ld128/k_sinl.c \
> > +@HAVE_LIBM_MACHINE_RISCV_TRUE@       libm/ld128/k_tanl.c
> libm/ld128/s_sinpil.c libm/ld128/s_cospil.c
> >
> >  @HAVE_LIBM_MACHINE_AARCH64_TRUE@libm_a_CFLAGS_libm_ld128 = -fbuiltin
> -fno-math-errno
> >  @HAVE_LIBM_MACHINE_RISCV_TRUE@libm_a_CFLAGS_libm_ld128 = -fbuiltin
> -fno-math-errno
> > @@ -5212,12 +5221,14 @@ libm_test_test_LDADD = $(CRT0) libm.a libc.a
> >  @HAVE_LIBM_MACHINE_I386_TRUE@libm_ld80_lsrc = \
> >  @HAVE_LIBM_MACHINE_I386_TRUE@        libm/ld80/b_tgammal.c
> libm/ld80/e_powl.c libm/ld80/s_erfl.c libm/ld80/s_exp2l.c \
> >  @HAVE_LIBM_MACHINE_I386_TRUE@        libm/ld80/s_expl.c
> libm/ld80/s_logl.c libm/ld80/s_sinpil.c libm/ld80/s_cospil.c \
> > -@HAVE_LIBM_MACHINE_I386_TRUE@        libm/ld80/invtrig.c
> libm/ld80/e_lgammal_r.c libm/ld80/k_cosl.c libm/ld80/k_sinl.c
> > +@HAVE_LIBM_MACHINE_I386_TRUE@        libm/ld80/invtrig.c
> libm/ld80/e_lgammal_r.c libm/ld80/k_cosl.c libm/ld80/k_sinl.c \
> > +@HAVE_LIBM_MACHINE_I386_TRUE@        libm/ld80/k_tanl.c
> >
> >  @HAVE_LIBM_MACHINE_X86_64_TRUE@libm_ld80_lsrc = \
> >  @HAVE_LIBM_MACHINE_X86_64_TRUE@      libm/ld80/b_tgammal.c
> libm/ld80/e_powl.c libm/ld80/s_erfl.c libm/ld80/s_exp2l.c \
> >  @HAVE_LIBM_MACHINE_X86_64_TRUE@      libm/ld80/s_expl.c
> libm/ld80/s_logl.c libm/ld80/s_sinpil.c libm/ld80/s_cospil.c \
> > -@HAVE_LIBM_MACHINE_X86_64_TRUE@      libm/ld80/invtrig.c
> libm/ld80/e_lgammal_r.c libm/ld80/k_cosl.c libm/ld80/k_sinl.c
> > +@HAVE_LIBM_MACHINE_X86_64_TRUE@      libm/ld80/invtrig.c
> libm/ld80/e_lgammal_r.c libm/ld80/k_cosl.c libm/ld80/k_sinl.c \
> > +@HAVE_LIBM_MACHINE_X86_64_TRUE@      libm/ld80/k_tanl.c
> >
> >  @HAVE_LIBM_MACHINE_I386_TRUE@libm_a_CFLAGS_libm_ld80 = -fbuiltin
> -fno-math-errno
> >  @HAVE_LIBM_MACHINE_X86_64_TRUE@libm_a_CFLAGS_libm_ld80 = -fbuiltin
> -fno-math-errno
> > @@ -11059,6 +11070,12 @@ libm/ld128/libm_a-k_cosl.$(OBJEXT):
> libm/ld128/$(am__dirstamp) \
> >       libm/ld128/$(DEPDIR)/$(am__dirstamp)
> >  libm/ld128/libm_a-k_sinl.$(OBJEXT): libm/ld128/$(am__dirstamp) \
> >       libm/ld128/$(DEPDIR)/$(am__dirstamp)
> > +libm/ld128/libm_a-k_tanl.$(OBJEXT): libm/ld128/$(am__dirstamp) \
> > +     libm/ld128/$(DEPDIR)/$(am__dirstamp)
> > +libm/ld128/libm_a-s_sinpil.$(OBJEXT): libm/ld128/$(am__dirstamp) \
> > +     libm/ld128/$(DEPDIR)/$(am__dirstamp)
> > +libm/ld128/libm_a-s_cospil.$(OBJEXT): libm/ld128/$(am__dirstamp) \
> > +     libm/ld128/$(DEPDIR)/$(am__dirstamp)
> >  libm/machine/amdgcn/$(am__dirstamp):
> >       @$(MKDIR_P) libm/machine/amdgcn
> >       @: > libm/machine/amdgcn/$(am__dirstamp)
> > @@ -11575,6 +11592,8 @@ libm/ld80/libm_a-k_cosl.$(OBJEXT):
> libm/ld80/$(am__dirstamp) \
> >       libm/ld80/$(DEPDIR)/$(am__dirstamp)
> >  libm/ld80/libm_a-k_sinl.$(OBJEXT): libm/ld80/$(am__dirstamp) \
> >       libm/ld80/$(DEPDIR)/$(am__dirstamp)
> > +libm/ld80/libm_a-k_tanl.$(OBJEXT): libm/ld80/$(am__dirstamp) \
> > +     libm/ld80/$(DEPDIR)/$(am__dirstamp)
> >  libm/machine/mips/$(am__dirstamp):
> >       @$(MKDIR_P) libm/machine/mips
> >       @: > libm/machine/mips/$(am__dirstamp)
> > @@ -14427,16 +14446,20 @@ distclean-compile:
> >  @AMDEP_TRUE@@am__include@ @am__quote@libm
> /ld128/$(DEPDIR)/libm_a-invtrig.Po@am__quote@
> >  @AMDEP_TRUE@@am__include@ @am__quote@libm
> /ld128/$(DEPDIR)/libm_a-k_cosl.Po@am__quote@
> >  @AMDEP_TRUE@@am__include@ @am__quote@libm
> /ld128/$(DEPDIR)/libm_a-k_sinl.Po@am__quote@
> > +@AMDEP_TRUE@@am__include@ @am__quote@libm
> /ld128/$(DEPDIR)/libm_a-k_tanl.Po@am__quote@
> > +@AMDEP_TRUE@@am__include@ @am__quote@libm
> /ld128/$(DEPDIR)/libm_a-s_cospil.Po@am__quote@
> >  @AMDEP_TRUE@@am__include@ @am__quote@libm
> /ld128/$(DEPDIR)/libm_a-s_erfl.Po@am__quote@
> >  @AMDEP_TRUE@@am__include@ @am__quote@libm
> /ld128/$(DEPDIR)/libm_a-s_exp2l.Po@am__quote@
> >  @AMDEP_TRUE@@am__include@ @am__quote@libm
> /ld128/$(DEPDIR)/libm_a-s_expl.Po@am__quote@
> >  @AMDEP_TRUE@@am__include@ @am__quote@libm
> /ld128/$(DEPDIR)/libm_a-s_logl.Po@am__quote@
> > +@AMDEP_TRUE@@am__include@ @am__quote@libm
> /ld128/$(DEPDIR)/libm_a-s_sinpil.Po@am__quote@
> >  @AMDEP_TRUE@@am__include@ @am__quote@libm
> /ld80/$(DEPDIR)/libm_a-b_tgammal.Po@am__quote@
> >  @AMDEP_TRUE@@am__include@ @am__quote@libm
> /ld80/$(DEPDIR)/libm_a-e_lgammal_r.Po@am__quote@
> >  @AMDEP_TRUE@@am__include@ @am__quote@libm
> /ld80/$(DEPDIR)/libm_a-e_powl.Po@am__quote@
> >  @AMDEP_TRUE@@am__include@ @am__quote@libm
> /ld80/$(DEPDIR)/libm_a-invtrig.Po@am__quote@
> >  @AMDEP_TRUE@@am__include@ @am__quote@libm
> /ld80/$(DEPDIR)/libm_a-k_cosl.Po@am__quote@
> >  @AMDEP_TRUE@@am__include@ @am__quote@libm
> /ld80/$(DEPDIR)/libm_a-k_sinl.Po@am__quote@
> > +@AMDEP_TRUE@@am__include@ @am__quote@libm
> /ld80/$(DEPDIR)/libm_a-k_tanl.Po@am__quote@
> >  @AMDEP_TRUE@@am__include@ @am__quote@libm
> /ld80/$(DEPDIR)/libm_a-s_cospil.Po@am__quote@
> >  @AMDEP_TRUE@@am__include@ @am__quote@libm
> /ld80/$(DEPDIR)/libm_a-s_erfl.Po@am__quote@
> >  @AMDEP_TRUE@@am__include@ @am__quote@libm
> /ld80/$(DEPDIR)/libm_a-s_exp2l.Po@am__quote@
> > @@ -44350,6 +44373,48 @@ libm/ld128/libm_a-k_sinl.obj:
> libm/ld128/k_sinl.c
> >  @AMDEP_TRUE@@am__fastdepCC_FALSE@    DEPDIR=$(DEPDIR) $(CCDEPMODE)
> $(depcomp) @AMDEPBACKSLASH@
> >  @am__fastdepCC_FALSE@        $(AM_V_CC@am__nodep@)$(CC) $(DEFS)
> $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS)
> $(libm_a_CFLAGS) $(CFLAGS) -c -o libm/ld128/libm_a-k_sinl.obj `if test -f
> 'libm/ld128/k_sinl.c'; then $(CYGPATH_W) 'libm/ld128/k_sinl.c'; else
> $(CYGPATH_W) '$(srcdir)/libm/ld128/k_sinl.c'; fi`
> >
> > +libm/ld128/libm_a-k_tanl.o: libm/ld128/k_tanl.c
> > +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES)
> $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -MT
> libm/ld128/libm_a-k_tanl.o -MD -MP -MF
> libm/ld128/$(DEPDIR)/libm_a-k_tanl.Tpo -c -o libm/ld128/libm_a-k_tanl.o
> `test -f 'libm/ld128/k_tanl.c' || echo '$(srcdir)/'`libm/ld128/k_tanl.c
> > +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv)
> libm/ld128/$(DEPDIR)/libm_a-k_tanl.Tpo libm/ld128/$(DEPDIR)/libm_a-k_tanl.Po
> > +@AMDEP_TRUE@@am__fastdepCC_FALSE@
> $(AM_V_CC)source='libm/ld128/k_tanl.c' object='libm/ld128/libm_a-k_tanl.o'
> libtool=no @AMDEPBACKSLASH@
> > +@AMDEP_TRUE@@am__fastdepCC_FALSE@    DEPDIR=$(DEPDIR) $(CCDEPMODE)
> $(depcomp) @AMDEPBACKSLASH@
> > +@am__fastdepCC_FALSE@        $(AM_V_CC@am__nodep@)$(CC) $(DEFS)
> $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS)
> $(libm_a_CFLAGS) $(CFLAGS) -c -o libm/ld128/libm_a-k_tanl.o `test -f
> 'libm/ld128/k_tanl.c' || echo '$(srcdir)/'`libm/ld128/k_tanl.c
> > +
> > +libm/ld128/libm_a-k_tanl.obj: libm/ld128/k_tanl.c
> > +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES)
> $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -MT
> libm/ld128/libm_a-k_tanl.obj -MD -MP -MF
> libm/ld128/$(DEPDIR)/libm_a-k_tanl.Tpo -c -o libm/ld128/libm_a-k_tanl.obj
> `if test -f 'libm/ld128/k_tanl.c'; then $(CYGPATH_W) 'libm/ld128/k_tanl.c';
> else $(CYGPATH_W) '$(srcdir)/libm/ld128/k_tanl.c'; fi`
> > +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv)
> libm/ld128/$(DEPDIR)/libm_a-k_tanl.Tpo libm/ld128/$(DEPDIR)/libm_a-k_tanl.Po
> > +@AMDEP_TRUE@@am__fastdepCC_FALSE@
> $(AM_V_CC)source='libm/ld128/k_tanl.c'
> object='libm/ld128/libm_a-k_tanl.obj' libtool=no @AMDEPBACKSLASH@
> > +@AMDEP_TRUE@@am__fastdepCC_FALSE@    DEPDIR=$(DEPDIR) $(CCDEPMODE)
> $(depcomp) @AMDEPBACKSLASH@
> > +@am__fastdepCC_FALSE@        $(AM_V_CC@am__nodep@)$(CC) $(DEFS)
> $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS)
> $(libm_a_CFLAGS) $(CFLAGS) -c -o libm/ld128/libm_a-k_tanl.obj `if test -f
> 'libm/ld128/k_tanl.c'; then $(CYGPATH_W) 'libm/ld128/k_tanl.c'; else
> $(CYGPATH_W) '$(srcdir)/libm/ld128/k_tanl.c'; fi`
> > +
> > +libm/ld128/libm_a-s_sinpil.o: libm/ld128/s_sinpil.c
> > +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES)
> $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -MT
> libm/ld128/libm_a-s_sinpil.o -MD -MP -MF
> libm/ld128/$(DEPDIR)/libm_a-s_sinpil.Tpo -c -o libm/ld128/libm_a-s_sinpil.o
> `test -f 'libm/ld128/s_sinpil.c' || echo '$(srcdir)/'`libm/ld128/s_sinpil.c
> > +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv)
> libm/ld128/$(DEPDIR)/libm_a-s_sinpil.Tpo
> libm/ld128/$(DEPDIR)/libm_a-s_sinpil.Po
> > +@AMDEP_TRUE@@am__fastdepCC_FALSE@
> $(AM_V_CC)source='libm/ld128/s_sinpil.c'
> object='libm/ld128/libm_a-s_sinpil.o' libtool=no @AMDEPBACKSLASH@
> > +@AMDEP_TRUE@@am__fastdepCC_FALSE@    DEPDIR=$(DEPDIR) $(CCDEPMODE)
> $(depcomp) @AMDEPBACKSLASH@
> > +@am__fastdepCC_FALSE@        $(AM_V_CC@am__nodep@)$(CC) $(DEFS)
> $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS)
> $(libm_a_CFLAGS) $(CFLAGS) -c -o libm/ld128/libm_a-s_sinpil.o `test -f
> 'libm/ld128/s_sinpil.c' || echo '$(srcdir)/'`libm/ld128/s_sinpil.c
> > +
> > +libm/ld128/libm_a-s_sinpil.obj: libm/ld128/s_sinpil.c
> > +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES)
> $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -MT
> libm/ld128/libm_a-s_sinpil.obj -MD -MP -MF
> libm/ld128/$(DEPDIR)/libm_a-s_sinpil.Tpo -c -o
> libm/ld128/libm_a-s_sinpil.obj `if test -f 'libm/ld128/s_sinpil.c'; then
> $(CYGPATH_W) 'libm/ld128/s_sinpil.c'; else $(CYGPATH_W)
> '$(srcdir)/libm/ld128/s_sinpil.c'; fi`
> > +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv)
> libm/ld128/$(DEPDIR)/libm_a-s_sinpil.Tpo
> libm/ld128/$(DEPDIR)/libm_a-s_sinpil.Po
> > +@AMDEP_TRUE@@am__fastdepCC_FALSE@
> $(AM_V_CC)source='libm/ld128/s_sinpil.c'
> object='libm/ld128/libm_a-s_sinpil.obj' libtool=no @AMDEPBACKSLASH@
> > +@AMDEP_TRUE@@am__fastdepCC_FALSE@    DEPDIR=$(DEPDIR) $(CCDEPMODE)
> $(depcomp) @AMDEPBACKSLASH@
> > +@am__fastdepCC_FALSE@        $(AM_V_CC@am__nodep@)$(CC) $(DEFS)
> $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS)
> $(libm_a_CFLAGS) $(CFLAGS) -c -o libm/ld128/libm_a-s_sinpil.obj `if test -f
> 'libm/ld128/s_sinpil.c'; then $(CYGPATH_W) 'libm/ld128/s_sinpil.c'; else
> $(CYGPATH_W) '$(srcdir)/libm/ld128/s_sinpil.c'; fi`
> > +
> > +libm/ld128/libm_a-s_cospil.o: libm/ld128/s_cospil.c
> > +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES)
> $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -MT
> libm/ld128/libm_a-s_cospil.o -MD -MP -MF
> libm/ld128/$(DEPDIR)/libm_a-s_cospil.Tpo -c -o libm/ld128/libm_a-s_cospil.o
> `test -f 'libm/ld128/s_cospil.c' || echo '$(srcdir)/'`libm/ld128/s_cospil.c
> > +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv)
> libm/ld128/$(DEPDIR)/libm_a-s_cospil.Tpo
> libm/ld128/$(DEPDIR)/libm_a-s_cospil.Po
> > +@AMDEP_TRUE@@am__fastdepCC_FALSE@
> $(AM_V_CC)source='libm/ld128/s_cospil.c'
> object='libm/ld128/libm_a-s_cospil.o' libtool=no @AMDEPBACKSLASH@
> > +@AMDEP_TRUE@@am__fastdepCC_FALSE@    DEPDIR=$(DEPDIR) $(CCDEPMODE)
> $(depcomp) @AMDEPBACKSLASH@
> > +@am__fastdepCC_FALSE@        $(AM_V_CC@am__nodep@)$(CC) $(DEFS)
> $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS)
> $(libm_a_CFLAGS) $(CFLAGS) -c -o libm/ld128/libm_a-s_cospil.o `test -f
> 'libm/ld128/s_cospil.c' || echo '$(srcdir)/'`libm/ld128/s_cospil.c
> > +
> > +libm/ld128/libm_a-s_cospil.obj: libm/ld128/s_cospil.c
> > +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES)
> $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -MT
> libm/ld128/libm_a-s_cospil.obj -MD -MP -MF
> libm/ld128/$(DEPDIR)/libm_a-s_cospil.Tpo -c -o
> libm/ld128/libm_a-s_cospil.obj `if test -f 'libm/ld128/s_cospil.c'; then
> $(CYGPATH_W) 'libm/ld128/s_cospil.c'; else $(CYGPATH_W)
> '$(srcdir)/libm/ld128/s_cospil.c'; fi`
> > +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv)
> libm/ld128/$(DEPDIR)/libm_a-s_cospil.Tpo
> libm/ld128/$(DEPDIR)/libm_a-s_cospil.Po
> > +@AMDEP_TRUE@@am__fastdepCC_FALSE@
> $(AM_V_CC)source='libm/ld128/s_cospil.c'
> object='libm/ld128/libm_a-s_cospil.obj' libtool=no @AMDEPBACKSLASH@
> > +@AMDEP_TRUE@@am__fastdepCC_FALSE@    DEPDIR=$(DEPDIR) $(CCDEPMODE)
> $(depcomp) @AMDEPBACKSLASH@
> > +@am__fastdepCC_FALSE@        $(AM_V_CC@am__nodep@)$(CC) $(DEFS)
> $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS)
> $(libm_a_CFLAGS) $(CFLAGS) -c -o libm/ld128/libm_a-s_cospil.obj `if test -f
> 'libm/ld128/s_cospil.c'; then $(CYGPATH_W) 'libm/ld128/s_cospil.c'; else
> $(CYGPATH_W) '$(srcdir)/libm/ld128/s_cospil.c'; fi`
> > +
> >  libm/machine/amdgcn/libm_a-v64_mathcnst.o:
> libm/machine/amdgcn/v64_mathcnst.c
> >  @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES)
> $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -MT
> libm/machine/amdgcn/libm_a-v64_mathcnst.o -MD -MP -MF
> libm/machine/amdgcn/$(DEPDIR)/libm_a-v64_mathcnst.Tpo -c -o
> libm/machine/amdgcn/libm_a-v64_mathcnst.o `test -f
> 'libm/machine/amdgcn/v64_mathcnst.c' || echo
> '$(srcdir)/'`libm/machine/amdgcn/v64_mathcnst.c
> >  @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv)
> libm/machine/amdgcn/$(DEPDIR)/libm_a-v64_mathcnst.Tpo
> libm/machine/amdgcn/$(DEPDIR)/libm_a-v64_mathcnst.Po
> > @@ -46534,6 +46599,20 @@ libm/ld80/libm_a-k_sinl.obj: libm/ld80/k_sinl.c
> >  @AMDEP_TRUE@@am__fastdepCC_FALSE@    DEPDIR=$(DEPDIR) $(CCDEPMODE)
> $(depcomp) @AMDEPBACKSLASH@
> >  @am__fastdepCC_FALSE@        $(AM_V_CC@am__nodep@)$(CC) $(DEFS)
> $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS)
> $(libm_a_CFLAGS) $(CFLAGS) -c -o libm/ld80/libm_a-k_sinl.obj `if test -f
> 'libm/ld80/k_sinl.c'; then $(CYGPATH_W) 'libm/ld80/k_sinl.c'; else
> $(CYGPATH_W) '$(srcdir)/libm/ld80/k_sinl.c'; fi`
> >
> > +libm/ld80/libm_a-k_tanl.o: libm/ld80/k_tanl.c
> > +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES)
> $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -MT
> libm/ld80/libm_a-k_tanl.o -MD -MP -MF libm/ld80/$(DEPDIR)/libm_a-k_tanl.Tpo
> -c -o libm/ld80/libm_a-k_tanl.o `test -f 'libm/ld80/k_tanl.c' || echo
> '$(srcdir)/'`libm/ld80/k_tanl.c
> > +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv)
> libm/ld80/$(DEPDIR)/libm_a-k_tanl.Tpo libm/ld80/$(DEPDIR)/libm_a-k_tanl.Po
> > +@AMDEP_TRUE@@am__fastdepCC_FALSE@
> $(AM_V_CC)source='libm/ld80/k_tanl.c' object='libm/ld80/libm_a-k_tanl.o'
> libtool=no @AMDEPBACKSLASH@
> > +@AMDEP_TRUE@@am__fastdepCC_FALSE@    DEPDIR=$(DEPDIR) $(CCDEPMODE)
> $(depcomp) @AMDEPBACKSLASH@
> > +@am__fastdepCC_FALSE@        $(AM_V_CC@am__nodep@)$(CC) $(DEFS)
> $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS)
> $(libm_a_CFLAGS) $(CFLAGS) -c -o libm/ld80/libm_a-k_tanl.o `test -f
> 'libm/ld80/k_tanl.c' || echo '$(srcdir)/'`libm/ld80/k_tanl.c
> > +
> > +libm/ld80/libm_a-k_tanl.obj: libm/ld80/k_tanl.c
> > +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES)
> $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -MT
> libm/ld80/libm_a-k_tanl.obj -MD -MP -MF
> libm/ld80/$(DEPDIR)/libm_a-k_tanl.Tpo -c -o libm/ld80/libm_a-k_tanl.obj `if
> test -f 'libm/ld80/k_tanl.c'; then $(CYGPATH_W) 'libm/ld80/k_tanl.c'; else
> $(CYGPATH_W) '$(srcdir)/libm/ld80/k_tanl.c'; fi`
> > +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv)
> libm/ld80/$(DEPDIR)/libm_a-k_tanl.Tpo libm/ld80/$(DEPDIR)/libm_a-k_tanl.Po
> > +@AMDEP_TRUE@@am__fastdepCC_FALSE@
> $(AM_V_CC)source='libm/ld80/k_tanl.c' object='libm/ld80/libm_a-k_tanl.obj'
> libtool=no @AMDEPBACKSLASH@
> > +@AMDEP_TRUE@@am__fastdepCC_FALSE@    DEPDIR=$(DEPDIR) $(CCDEPMODE)
> $(depcomp) @AMDEPBACKSLASH@
> > +@am__fastdepCC_FALSE@        $(AM_V_CC@am__nodep@)$(CC) $(DEFS)
> $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS)
> $(libm_a_CFLAGS) $(CFLAGS) -c -o libm/ld80/libm_a-k_tanl.obj `if test -f
> 'libm/ld80/k_tanl.c'; then $(CYGPATH_W) 'libm/ld80/k_tanl.c'; else
> $(CYGPATH_W) '$(srcdir)/libm/ld80/k_tanl.c'; fi`
> > +
> >  libm/machine/mips/libm_a-feclearexcept.o:
> libm/machine/mips/feclearexcept.c
> >  @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES)
> $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -MT
> libm/machine/mips/libm_a-feclearexcept.o -MD -MP -MF
> libm/machine/mips/$(DEPDIR)/libm_a-feclearexcept.Tpo -c -o
> libm/machine/mips/libm_a-feclearexcept.o `test -f
> 'libm/machine/mips/feclearexcept.c' || echo
> '$(srcdir)/'`libm/machine/mips/feclearexcept.c
> >  @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv)
> libm/machine/mips/$(DEPDIR)/libm_a-feclearexcept.Tpo
> libm/machine/mips/$(DEPDIR)/libm_a-feclearexcept.Po
> > diff --git a/newlib/libm/ld/math_private.h
> b/newlib/libm/ld/math_private.h
> > index c5b88f65e..6d0183e3c 100644
> > --- a/newlib/libm/ld/math_private.h
> > +++ b/newlib/libm/ld/math_private.h
> > @@ -705,6 +705,59 @@ irintl(long double x)
> >  }
> >  #endif
> >
> > +/*
> > + * The following are fast floor macros for 0 <= |x| < 0x1p(N-1), where
> > + * N is the precision of the type of x. These macros are used in the
> > + * half-cycle trignometric functions (e.g., sinpi(x)).
> > + */
> > +#define      FFLOORF(x, j0, ix) do {                 \
> > +     (j0) = (((ix) >> 23) & 0xff) - 0x7f;    \
> > +     (ix) &= ~(0x007fffff >> (j0));          \
> > +     SET_FLOAT_WORD((x), (ix));              \
> > +} while (0)
> > +
> > +#define      FFLOOR(x, j0, ix, lx) do {                              \
> > +     (j0) = (((ix) >> 20) & 0x7ff) - 0x3ff;                  \
> > +     if ((j0) < 20) {                                        \
> > +             (ix) &= ~(0x000fffff >> (j0));                  \
> > +             (lx) = 0;                                       \
> > +     } else {                                                \
> > +             (lx) &= ~((uint32_t)0xffffffff >> ((j0) - 20)); \
> > +     }                                                       \
> > +     INSERT_WORDS((x), (ix), (lx));                          \
> > +} while (0)
> > +
> > +#define      FFLOORL80(x, j0, ix, lx) do {                   \
> > +     j0 = ix - 0x3fff + 1;                           \
> > +     if ((j0) < 32) {                                \
> > +             (lx) = ((lx) >> 32) << 32;              \
> > +             (lx) &= ~((((lx) << 32)-1) >> (j0));    \
> > +     } else {                                        \
> > +             uint64_t _m;                            \
> > +             _m = (uint64_t)-1 >> (j0);              \
> > +             if ((lx) & _m) (lx) &= ~_m;             \
> > +     }                                               \
> > +     INSERT_LDBL80_WORDS((x), (ix), (lx));           \
> > +} while (0)
> > +
> > +#define FFLOORL128(x, ai, ar) do {                   \
> > +     union IEEEl2bits u;                             \
> > +     uint64_t m;                                     \
> > +     int e;                                          \
> > +     u.e = (x);                                      \
> > +     e = u.bits.exp - 16383;                         \
> > +     if (e < 48) {                                   \
> > +             m = ((1llu << 49) - 1) >> (e + 1);      \
> > +             u.bits.manh &= ~m;                      \
> > +             u.bits.manl = 0;                        \
> > +     } else {                                        \
> > +             m = (uint64_t)-1 >> (e - 48);           \
> > +             u.bits.manl &= ~m;                      \
> > +     }                                               \
> > +     (ai) = u.e;                                     \
> > +     (ar) = (x) - (ai);                              \
> > +} while (0)
> > +
> >  #ifdef DEBUG
> >  #if defined(__amd64__) || defined(__i386__)
> >  #define      breakpoint()    asm("int $3")
> > diff --git a/newlib/libm/ld128/Makefile.inc
> b/newlib/libm/ld128/Makefile.inc
> > index 337284d69..3a04b99a1 100644
> > --- a/newlib/libm/ld128/Makefile.inc
> > +++ b/newlib/libm/ld128/Makefile.inc
> > @@ -1,7 +1,8 @@
> >  %C%_lsrc = \
> >       %D%/e_powl.c %D%/s_erfl.c %D%/s_exp2l.c %D%/s_expl.c \
> >       %D%/s_logl.c %D%/b_tgammal.c %D%/invtrig.c \
> > -     %D%/e_lgammal_r.c %D%/k_cosl.c %D%/k_sinl.c
> > +     %D%/e_lgammal_r.c %D%/k_cosl.c %D%/k_sinl.c \
> > +     %D%/k_tanl.c %D%/s_sinpil.c %D%/s_cospil.c
> >
> >  libm_a_CFLAGS_%C% = -fbuiltin -fno-math-errno
> >
> > diff --git a/newlib/libm/ld128/k_cospil.h b/newlib/libm/ld128/k_cospil.h
> > new file mode 100644
> > index 000000000..592f19229
> > --- /dev/null
> > +++ b/newlib/libm/ld128/k_cospil.h
> > @@ -0,0 +1,42 @@
> > +/*-
> > + * Copyright (c) 2017 Steven G. Kargl
> > + * All rights reserved.
> > + *
> > + * Redistribution and use in source and binary forms, with or without
> > + * modification, are permitted provided that the following conditions
> > + * are met:
> > + * 1. Redistributions of source code must retain the above copyright
> > + *    notice unmodified, this list of conditions, and the following
> > + *    disclaimer.
> > + * 2. Redistributions in binary form must reproduce the above copyright
> > + *    notice, this list of conditions and the following disclaimer in
> the
> > + *    documentation and/or other materials provided with the
> distribution.
> > + *
> > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
> > + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
> WARRANTIES
> > + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> DISCLAIMED.
> > + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
> > + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
> BUT
> > + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> USE,
> > + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
> > + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> > + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
> USE OF
> > + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> > + */
> > +
> > +/*
> > + * See ../src/k_cospi.c for implementation details.
> > + */
> > +
> > +static inline long double
> > +__kernel_cospil(long double x)
> > +{
> > +     long double hi, lo;
> > +
> > +     hi = (double)x;
> > +     lo = x - hi;
> > +     lo = lo * (pi_lo + pi_hi) + hi * pi_lo;
> > +     hi *= pi_hi;
> > +     _2sumF(hi, lo);
> > +     return (__kernel_cosl(hi, lo));
> > +}
> > diff --git a/newlib/libm/ld128/k_sinpil.h b/newlib/libm/ld128/k_sinpil.h
> > new file mode 100644
> > index 000000000..fa4e7d633
> > --- /dev/null
> > +++ b/newlib/libm/ld128/k_sinpil.h
> > @@ -0,0 +1,42 @@
> > +/*-
> > + * Copyright (c) 2017 Steven G. Kargl
> > + * All rights reserved.
> > + *
> > + * Redistribution and use in source and binary forms, with or without
> > + * modification, are permitted provided that the following conditions
> > + * are met:
> > + * 1. Redistributions of source code must retain the above copyright
> > + *    notice unmodified, this list of conditions, and the following
> > + *    disclaimer.
> > + * 2. Redistributions in binary form must reproduce the above copyright
> > + *    notice, this list of conditions and the following disclaimer in
> the
> > + *    documentation and/or other materials provided with the
> distribution.
> > + *
> > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
> > + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
> WARRANTIES
> > + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> DISCLAIMED.
> > + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
> > + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
> BUT
> > + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> USE,
> > + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
> > + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> > + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
> USE OF
> > + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> > + */
> > +
> > +/*
> > + * See ../src/k_sinpi.c for implementation details.
> > + */
> > +
> > +static inline long double
> > +__kernel_sinpil(long double x)
> > +{
> > +     long double hi, lo;
> > +
> > +     hi = (double)x;
> > +     lo = x - hi;
> > +     lo = lo * (pi_lo + pi_hi) + hi * pi_lo;
> > +     hi *= pi_hi;
> > +     _2sumF(hi, lo);
> > +     return (__kernel_sinl(hi, lo, 1));
> > +}
> > diff --git a/newlib/libm/ld128/k_tanl.c b/newlib/libm/ld128/k_tanl.c
> > new file mode 100644
> > index 000000000..9a58cd264
> > --- /dev/null
> > +++ b/newlib/libm/ld128/k_tanl.c
> > @@ -0,0 +1,114 @@
> > +/*
> > + * ====================================================
> > + * Copyright 2004 Sun Microsystems, Inc.  All Rights Reserved.
> > + * Copyright (c) 2008 Steven G. Kargl, David Schultz, Bruce D. Evans.
> > + *
> > + * Permission to use, copy, modify, and distribute this
> > + * software is freely granted, provided that this notice
> > + * is preserved.
> > + * ====================================================
> > + */
> > +
> > +/*
> > + * ld128 version of k_tan.c.  See ../src/k_tan.c for most comments.
> > + */
> > +
> > +#include "math.h"
> > +#include "../ld/math_private.h"
> > +
> > +/*
> > + * Domain [-0.67434, 0.67434], range ~[-3.37e-36, 1.982e-37]
> > + * |tan(x)/x - t(x)| < 2**-117.8 (XXX should be ~1e-37)
> > + *
> > + * See ../ld80/k_cosl.c for more details about the polynomial.
> > + */
> > +static const long double
> > +T3 = 0x1.5555555555555555555555555553p-2L,
> > +T5 = 0x1.1111111111111111111111111eb5p-3L,
> > +T7 = 0x1.ba1ba1ba1ba1ba1ba1ba1b694cd6p-5L,
> > +T9 = 0x1.664f4882c10f9f32d6bbe09d8bcdp-6L,
> > +T11 = 0x1.226e355e6c23c8f5b4f5762322eep-7L,
> > +T13 = 0x1.d6d3d0e157ddfb5fed8e84e27b37p-9L,
> > +T15 = 0x1.7da36452b75e2b5fce9ee7c2c92ep-10L,
> > +T17 = 0x1.355824803674477dfcf726649efep-11L,
> > +T19 = 0x1.f57d7734d1656e0aceb716f614c2p-13L,
> > +T21 = 0x1.967e18afcb180ed942dfdc518d6cp-14L,
> > +T23 = 0x1.497d8eea21e95bc7e2aa79b9f2cdp-15L,
> > +T25 = 0x1.0b132d39f055c81be49eff7afd50p-16L,
> > +T27 = 0x1.b0f72d33eff7bfa2fbc1059d90b6p-18L,
> > +T29 = 0x1.5ef2daf21d1113df38d0fbc00267p-19L,
> > +T31 = 0x1.1c77d6eac0234988cdaa04c96626p-20L,
> > +T33 = 0x1.cd2a5a292b180e0bdd701057dfe3p-22L,
> > +T35 = 0x1.75c7357d0298c01a31d0a6f7d518p-23L,
> > +T37 = 0x1.2f3190f4718a9a520f98f50081fcp-24L,
> > +pio4 = 0x1.921fb54442d18469898cc51701b8p-1L,
> > +pio4lo = 0x1.cd129024e088a67cc74020bbea60p-116L;
> > +
> > +static const double
> > +T39 =  0.000000028443389121318352,   /*  0x1e8a7592977938.0p-78 */
> > +T41 =  0.000000011981013102001973,   /*  0x19baa1b1223219.0p-79 */
> > +T43 =  0.0000000038303578044958070,  /*  0x107385dfb24529.0p-80 */
> > +T45 =  0.0000000034664378216909893,  /*  0x1dc6c702a05262.0p-81 */
> > +T47 = -0.0000000015090641701997785,  /* -0x19ecef3569ebb6.0p-82 */
> > +T49 =  0.0000000029449552300483952,  /*  0x194c0668da786a.0p-81 */
> > +T51 = -0.0000000022006995706097711,  /* -0x12e763b8845268.0p-81 */
> > +T53 =  0.0000000015468200913196612,  /*  0x1a92fc98c29554.0p-82 */
> > +T55 = -0.00000000061311613386849674, /* -0x151106cbc779a9.0p-83 */
> > +T57 =  1.4912469681508012e-10;               /*  0x147edbdba6f43a.0p-85
> */
> > +
> > +long double
> > +__kernel_tanl(long double x, long double y, int iy) {
> > +     long double z, r, v, w, s;
> > +     long double osign;
> > +     int i;
> > +
> > +     iy = (iy == 1 ? -1 : 1);        /* XXX recover original interface
> */
> > +     osign = (x >= 0 ? 1.0 : -1.0);  /* XXX slow, probably wrong for -0
> */
> > +     if (fabsl(x) >= 0.67434) {
> > +             if (x < 0) {
> > +                     x = -x;
> > +                     y = -y;
> > +             }
> > +             z = pio4 - x;
> > +             w = pio4lo - y;
> > +             x = z + w;
> > +             y = 0.0;
> > +             i = 1;
> > +     } else
> > +             i = 0;
> > +     z = x * x;
> > +     w = z * z;
> > +     r = T5 + w * (T9 + w * (T13 + w * (T17 + w * (T21 +
> > +         w * (T25 + w * (T29 + w * (T33 +
> > +         w * (T37 + w * (T41 + w * (T45 + w * (T49 + w * (T53 +
> > +         w * T57))))))))))));
> > +     v = z * (T7 + w * (T11 + w * (T15 + w * (T19 + w * (T23 +
> > +         w * (T27 + w * (T31 + w * (T35 +
> > +         w * (T39 + w * (T43 + w * (T47 + w * (T51 + w *
> T55))))))))))));
> > +     s = z * x;
> > +     r = y + z * (s * (r + v) + y);
> > +     r += T3 * s;
> > +     w = x + r;
> > +     if (i == 1) {
> > +             v = (long double) iy;
> > +             return osign *
> > +                     (v - 2.0 * (x - (w * w / (w + v) - r)));
> > +     }
> > +     if (iy == 1)
> > +             return w;
> > +     else {
> > +             /*
> > +              * if allow error up to 2 ulp, simply return
> > +              * -1.0 / (x+r) here
> > +              */
> > +             /* compute -1.0 / (x+r) accurately */
> > +             long double a, t;
> > +             z = w;
> > +             z = z + 0x1p32 - 0x1p32;
> > +             v = r - (z - x);        /* z+v = r+x */
> > +             t = a = -1.0 / w;       /* a = -1.0/w */
> > +             t = t + 0x1p32 - 0x1p32;
> > +             s = 1.0 + t * z;
> > +             return t + a * (s + t * v);
> > +     }
> > +}
> > diff --git a/newlib/libm/ld128/s_cospil.c b/newlib/libm/ld128/s_cospil.c
> > new file mode 100644
> > index 000000000..0ef31775f
> > --- /dev/null
> > +++ b/newlib/libm/ld128/s_cospil.c
> > @@ -0,0 +1,108 @@
> > +/*-
> > + * Copyright (c) 2017-2023 Steven G. Kargl
> > + * All rights reserved.
> > + *
> > + * Redistribution and use in source and binary forms, with or without
> > + * modification, are permitted provided that the following conditions
> > + * are met:
> > + * 1. Redistributions of source code must retain the above copyright
> > + *    notice unmodified, this list of conditions, and the following
> > + *    disclaimer.
> > + * 2. Redistributions in binary form must reproduce the above copyright
> > + *    notice, this list of conditions and the following disclaimer in
> the
> > + *    documentation and/or other materials provided with the
> distribution.
> > + *
> > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
> > + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
> WARRANTIES
> > + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> DISCLAIMED.
> > + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
> > + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
> BUT
> > + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> USE,
> > + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
> > + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> > + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
> USE OF
> > + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> > + */
> > +
> > +/*
> > + * See ../src/s_cospi.c for implementation details.
> > + */
> > +
> > +#include "../ld/fpmath.h"
> > +#include "math.h"
> > +#include "../ld/math_private.h"
> > +
> > +/*
> > + * pi_hi contains the leading 56 bits of a 169 bit approximation for pi.
> > + */
> > +static const long double
> > +pi_hi = 3.14159265358979322702026593105983920e+00L,
> > +pi_lo = 1.14423774522196636802434264184180742e-17L;
> > +
> > +#include "k_cospil.h"
> > +#include "k_sinpil.h"
> > +
> > +volatile static const double vzero = 0;
> > +
> > +long double
> > +cospil(long double x)
> > +{
> > +     long double ai, ar, ax, c;
> > +
> > +     ax = fabsl(x);
> > +
> > +     if (ax <= 1) {
> > +             if (ax < 0.25) {
> > +                     if (ax < 0x1p-60) {
> > +                             if ((int)x == 0)
> > +                                     return (1);
> > +                     }
> > +                     return (__kernel_cospil(ax));
> > +             }
> > +
> > +             if (ax < 0.5)
> > +                     c = __kernel_sinpil(0.5 - ax);
> > +             else if (ax < 0.75) {
> > +                     if (ax == 0.5)
> > +                             return (0);
> > +                     c = -__kernel_sinpil(ax - 0.5);
> > +             } else
> > +                     c = -__kernel_cospil(1 - ax);
> > +             return (c);
> > +     }
> > +
> > +     if (ax < 0x1p112) {
> > +             /* Split ax = ai + ar with 0 <= ar < 1. */
> > +             FFLOORL128(ax, ai, ar);
> > +
> > +             if (ar < 0.5) {
> > +                     if (ar < 0.25)
> > +                             c = ar == 0 ? 1 : __kernel_cospil(ar);
> > +                     else
> > +                             c = __kernel_sinpil(0.5 - ar);
> > +             } else {
> > +                     if (ar < 0.75) {
> > +                             if (ar == 0.5)
> > +                                     return (0);
> > +                             c = -__kernel_sinpil(ar - 0.5);
> > +                     } else
> > +                             c = -__kernel_cospil(1 - ar);
> > +             }
> > +             return (fmodl(ai, 2.L) == 0 ? c : -c);
> > +     }
> > +
> > +     if (isinf(x) || isnan(x))
> > +             return (vzero / vzero);
> > +
> > +     /*
> > +      * For |x| >= 0x1p113, it is always an even integer, so return 1.
> > +      */
> > +     if (ax >= 0x1p113)
> > +             return (1);
> > +     /*
> > +      * For 0x1p112 <= |x| < 0x1p113 need to determine if x is an even
> > +      * or odd integer to return 1 or -1.
> > +      */
> > +
> > +     return (fmodl(ax, 2.L) == 0 ? 1 : -1);
> > +}
> > diff --git a/newlib/libm/ld128/s_sinpil.c b/newlib/libm/ld128/s_sinpil.c
> > new file mode 100644
> > index 000000000..30d1881b8
> > --- /dev/null
> > +++ b/newlib/libm/ld128/s_sinpil.c
> > @@ -0,0 +1,111 @@
> > +/*-
> > + * Copyright (c) 2017-2023 Steven G. Kargl
> > + * All rights reserved.
> > + *
> > + * Redistribution and use in source and binary forms, with or without
> > + * modification, are permitted provided that the following conditions
> > + * are met:
> > + * 1. Redistributions of source code must retain the above copyright
> > + *    notice unmodified, this list of conditions, and the following
> > + *    disclaimer.
> > + * 2. Redistributions in binary form must reproduce the above copyright
> > + *    notice, this list of conditions and the following disclaimer in
> the
> > + *    documentation and/or other materials provided with the
> distribution.
> > + *
> > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
> > + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
> WARRANTIES
> > + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> DISCLAIMED.
> > + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
> > + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
> BUT
> > + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> USE,
> > + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
> > + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> > + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
> USE OF
> > + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> > + */
> > +
> > +/*
> > + * See ../src/s_sinpi.c for implementation details.
> > + */
> > +
> > +#include "../ld/fpmath.h"
> > +#include "math.h"
> > +#include "../ld/math_private.h"
> > +
> > +/*
> > + * pi_hi contains the leading 56 bits of a 169 bit approximation for pi.
> > + */
> > +static const long double
> > +pi_hi = 3.14159265358979322702026593105983920e+00L,
> > +pi_lo = 1.14423774522196636802434264184180742e-17L;
> > +
> > +#include "k_cospil.h"
> > +#include "k_sinpil.h"
> > +
> > +volatile static const double vzero = 0;
> > +
> > +long double
> > +sinpil(long double x)
> > +{
> > +     long double ai, ar, ax, hi, lo, s, xhi, xlo;
> > +
> > +     ax = fabsl(x);
> > +
> > +     if (ax < 1) {
> > +             if (ax < 0.25) {
> > +                     if (ax < 0x1p-60) {
> > +                             if (x == 0)
> > +                                     return (x);
> > +                             hi = (double)x;
> > +                             hi *= 0x1p113L;
> > +                             lo = x * 0x1p113L - hi;
> > +                             s = (pi_lo + pi_hi) * lo + pi_lo * lo +
> > +                                 pi_hi * hi;
> > +                             return (s * 0x1p-113L);
> > +                     }
> > +
> > +                     s = __kernel_sinpil(ax);
> > +                     return (x < 0 ? -s : s);
> > +             }
> > +
> > +             if (ax < 0.5)
> > +                     s = __kernel_cospil(0.5 - ax);
> > +             else if (ax < 0.75)
> > +                     s = __kernel_cospil(ax - 0.5);
> > +             else
> > +                     s = __kernel_sinpil(1 - ax);
> > +             return (x < 0 ? -s : s);
> > +     }
> > +
> > +     if (ax < 0x1p112) {
> > +             /* Split ax = ai + ar with 0 <= ar < 1. */
> > +             FFLOORL128(ax, ai, ar);
> > +
> > +             if (ar == 0) {
> > +                     s = 0;
> > +             } else {
> > +                     if (ar < 0.5) {
> > +                             if (ar <= 0.25)
> > +                                     s = __kernel_sinpil(ar);
> > +                             else
> > +                                     s = __kernel_cospil(0.5 - ar);
> > +                     } else {
> > +                             if (ar < 0.75)
> > +                                     s = __kernel_cospil(ar - 0.5);
> > +                             else
> > +                                     s = __kernel_sinpil(1 - ar);
> > +                     }
> > +
> > +                     s = fmodl(ai, 2.L) == 0 ? s : -s;
> > +             }
> > +             return (x < 0 ? -s : s);
> > +     }
> > +
> > +     if (isinf(x) || isnan(x))
> > +             return (vzero / vzero);
> > +
> > +     /*
> > +      * |x| >= 0x1p112 is always an integer, so return +-0.
> > +      */
> > +     return (copysignl(0, x));
> > +}
> > diff --git a/newlib/libm/ld80/Makefile.inc
> b/newlib/libm/ld80/Makefile.inc
> > index 97fbacdda..7bb20f743 100644
> > --- a/newlib/libm/ld80/Makefile.inc
> > +++ b/newlib/libm/ld80/Makefile.inc
> > @@ -1,8 +1,8 @@
> >  %C%_lsrc = \
> >       %D%/b_tgammal.c %D%/e_powl.c %D%/s_erfl.c %D%/s_exp2l.c \
> >       %D%/s_expl.c %D%/s_logl.c %D%/s_sinpil.c %D%/s_cospil.c \
> > -     %D%/invtrig.c %D%/e_lgammal_r.c %D%/k_cosl.c %D%/k_sinl.c
> > -
> > +     %D%/invtrig.c %D%/e_lgammal_r.c %D%/k_cosl.c %D%/k_sinl.c \
> > +     %D%/k_tanl.c
> >
> >  libm_a_CFLAGS_%C% = -fbuiltin -fno-math-errno
> >
> > diff --git a/newlib/libm/ld80/k_tanl.c b/newlib/libm/ld80/k_tanl.c
> > new file mode 100644
> > index 000000000..c55303f01
> > --- /dev/null
> > +++ b/newlib/libm/ld80/k_tanl.c
> > @@ -0,0 +1,119 @@
> > +/*
> > + * ====================================================
> > + * Copyright 2004 Sun Microsystems, Inc.  All Rights Reserved.
> > + * Copyright (c) 2008 Steven G. Kargl, David Schultz, Bruce D. Evans.
> > + *
> > + * Permission to use, copy, modify, and distribute this
> > + * software is freely granted, provided that this notice
> > + * is preserved.
> > + * ====================================================
> > + */
> > +
> > +/*
> > + * ld80 version of k_tan.c.  See ../src/k_tan.c for most comments.
> > + */
> > +
> > +#include "math.h"
> > +#include "../ld/math_private.h"
> > +
> > +/*
> > + * Domain [-0.67434, 0.67434], range ~[-2.25e-22, 1.921e-22]
> > + * |tan(x)/x - t(x)| < 2**-71.9
> > + *
> > + * See k_cosl.c for more details about the polynomial.
> > + */
> > +#if defined(__amd64__) || defined(__i386__)
> > +/* Long double constants are slow on these arches, and broken on i386.
> */
> > +static const volatile double
> > +T3hi =  0.33333333333333331,         /*  0x15555555555555.0p-54 */
> > +T3lo =  1.8350121769317163e-17,              /*
> 0x15280000000000.0p-108 */
> > +T5hi =  0.13333333333333336,         /*  0x11111111111112.0p-55 */
> > +T5lo =  1.3051083651294260e-17,              /*
> 0x1e180000000000.0p-109 */
> > +T7hi =  0.053968253968250494,                /*  0x1ba1ba1ba1b827.0p-57
> */
> > +T7lo =  3.1509625637859973e-18,              /*
> 0x1d100000000000.0p-111 */
> > +pio4_hi =  0.78539816339744828,              /*  0x1921fb54442d18.0p-53
> */
> > +pio4_lo =  3.0628711372715500e-17,   /*  0x11a80000000000.0p-107 */
> > +pio4lo_hi = -1.2541394031670831e-20, /* -0x1d9cceba3f91f2.0p-119 */
> > +pio4lo_lo =  6.1493048227390915e-37; /*  0x1a280000000000.0p-173 */
> > +#define      T3      ((long double)T3hi + T3lo)
> > +#define      T5      ((long double)T5hi + T5lo)
> > +#define      T7      ((long double)T7hi + T7lo)
> > +#define      pio4    ((long double)pio4_hi + pio4_lo)
> > +#define      pio4lo  ((long double)pio4lo_hi + pio4lo_lo)
> > +#else
> > +static const long double
> > +T3 =   0.333333333333333333180L,     /*  0xaaaaaaaaaaaaaaa5.0p-65 */
> > +T5 =   0.133333333333333372290L,     /*  0x88888888888893c3.0p-66 */
> > +T7 =   0.0539682539682504975744L,    /*  0xdd0dd0dd0dc13ba2.0p-68 */
> > +pio4 = 0.785398163397448309628L,     /*  0xc90fdaa22168c235.0p-64 */
> > +pio4lo = -1.25413940316708300586e-20L;       /*
> -0xece675d1fc8f8cbb.0p-130 */
> > +#endif
> > +
> > +static const double
> > +T9  =  0.021869488536312216,         /*  0x1664f4882cc1c2.0p-58 */
> > +T11 =  0.0088632355256619590,                /*  0x1226e355c17612.0p-59
> */
> > +T13 =  0.0035921281113786528,                /*  0x1d6d3d185d7ff8.0p-61
> */
> > +T15 =  0.0014558334756312418,                /*  0x17da354aa3f96b.0p-62
> */
> > +T17 =  0.00059003538700862256,               /*  0x13559358685b83.0p-63
> */
> > +T19 =  0.00023907843576635544,               /*  0x1f56242026b5be.0p-65
> */
> > +T21 =  0.000097154625656538905,              /*  0x1977efc26806f4.0p-66
> */
> > +T23 =  0.000038440165747303162,              /*  0x14275a09b3ceac.0p-67
> */
> > +T25 =  0.000018082171885432524,              /*  0x12f5e563e5487e.0p-68
> */
> > +T27 =  0.0000024196006108814377,     /*  0x144c0d80cc6896.0p-71 */
> > +T29 =  0.0000078293456938132840,     /*  0x106b59141a6cb3.0p-69 */
> > +T31 = -0.0000032609076735050182,     /* -0x1b5abef3ba4b59.0p-71 */
> > +T33 =  0.0000023261313142559411;     /*  0x13835436c0c87f.0p-71 */
> > +
> > +long double
> > +__kernel_tanl(long double x, long double y, int iy) {
> > +     long double z, r, v, w, s;
> > +     long double osign;
> > +     int i;
> > +
> > +     iy = (iy == 1 ? -1 : 1);        /* XXX recover original interface
> */
> > +     osign = (x >= 0 ? 1.0 : -1.0);  /* XXX slow, probably wrong for -0
> */
> > +     if (fabsl(x) >= 0.67434) {
> > +             if (x < 0) {
> > +                     x = -x;
> > +                     y = -y;
> > +             }
> > +             z = pio4 - x;
> > +             w = pio4lo - y;
> > +             x = z + w;
> > +             y = 0.0;
> > +             i = 1;
> > +     } else
> > +             i = 0;
> > +     z = x * x;
> > +     w = z * z;
> > +     r = T5 + w * (T9 + w * (T13 + w * (T17 + w * (T21 +
> > +         w * (T25 + w * (T29 + w * T33))))));
> > +     v = z * (T7 + w * (T11 + w * (T15 + w * (T19 + w * (T23 +
> > +         w * (T27 + w * T31))))));
> > +     s = z * x;
> > +     r = y + z * (s * (r + v) + y);
> > +     r += T3 * s;
> > +     w = x + r;
> > +     if (i == 1) {
> > +             v = (long double) iy;
> > +             return osign *
> > +                     (v - 2.0 * (x - (w * w / (w + v) - r)));
> > +     }
> > +     if (iy == 1)
> > +             return w;
> > +     else {
> > +             /*
> > +              * if allow error up to 2 ulp, simply return
> > +              * -1.0 / (x+r) here
> > +              */
> > +             /* compute -1.0 / (x+r) accurately */
> > +             long double a, t;
> > +             z = w;
> > +             z = z + 0x1p32 - 0x1p32;
> > +             v = r - (z - x);        /* z+v = r+x */
> > +             t = a = -1.0 / w;       /* a = -1.0/w */
> > +             t = t + 0x1p32 - 0x1p32;
> > +             s = 1.0 + t * z;
> > +             return t + a * (s + t * v);
> > +     }
> > +}
> > --
> > 2.34.1
>
>
  
Joel Sherrill July 16, 2024, 7:39 p.m. UTC | #3
Thanks! I'm thrilled to see issues get fixed for the long double support!

It was a mess to sort out enough to get it in initially.

--joel

On Tue, Jul 16, 2024 at 2:22 PM Jeff Johnston <jjohnstn@redhat.com> wrote:

> Thanks Kito.  Patch applied.
>
> -- Jeff J.
>
> On Tue, Jul 16, 2024 at 5:32 AM Corinna Vinschen <vinschen@redhat.com>
> wrote:
>
>>
>> Jeff, ping?  I think that looks ok, but it's libm, yuk.
>>
>> Thanks,
>> Corinna
>>
>> On Jul 10 17:44, Kito Cheng wrote:
>> > For RISC-V, AArch64, i386, and x86_64
>> >
>> > - k_tanl.c is required for tanl; the linker will report `__kernel_tanl`
>> >   not found when tanl is called.
>> > - s_cospil.c and s_sinpil.c are added for cospil and sinpil, which are
>> already
>> >   available for ld80 but not for ld128.
>> > ---
>> >  newlib/Makefile.in             |  97 ++++++++++++++++++++++++---
>> >  newlib/libm/ld/math_private.h  |  53 +++++++++++++++
>> >  newlib/libm/ld128/Makefile.inc |   3 +-
>> >  newlib/libm/ld128/k_cospil.h   |  42 ++++++++++++
>> >  newlib/libm/ld128/k_sinpil.h   |  42 ++++++++++++
>> >  newlib/libm/ld128/k_tanl.c     | 114 +++++++++++++++++++++++++++++++
>> >  newlib/libm/ld128/s_cospil.c   | 108 ++++++++++++++++++++++++++++++
>> >  newlib/libm/ld128/s_sinpil.c   | 111 ++++++++++++++++++++++++++++++
>> >  newlib/libm/ld80/Makefile.inc  |   4 +-
>> >  newlib/libm/ld80/k_tanl.c      | 119 +++++++++++++++++++++++++++++++++
>> >  10 files changed, 681 insertions(+), 12 deletions(-)
>> >  create mode 100644 newlib/libm/ld128/k_cospil.h
>> >  create mode 100644 newlib/libm/ld128/k_sinpil.h
>> >  create mode 100644 newlib/libm/ld128/k_tanl.c
>> >  create mode 100644 newlib/libm/ld128/s_cospil.c
>> >  create mode 100644 newlib/libm/ld128/s_sinpil.c
>> >  create mode 100644 newlib/libm/ld80/k_tanl.c
>> >
>> > diff --git a/newlib/Makefile.in b/newlib/Makefile.in
>> > index b45c42c36..a051c2760 100644
>> > --- a/newlib/Makefile.in
>> > +++ b/newlib/Makefile.in
>> > @@ -3244,7 +3244,10 @@ am__objects_159 =
>> libm/fenv/libm_a-feclearexcept.$(OBJEXT) \
>> >  @HAVE_LIBM_MACHINE_AARCH64_FALSE@@HAVE_LIBM_MACHINE_RISCV_TRUE@
>> libm/ld128/libm_a-invtrig.$(OBJEXT) \
>> >  @HAVE_LIBM_MACHINE_AARCH64_FALSE@@HAVE_LIBM_MACHINE_RISCV_TRUE@
>> libm/ld128/libm_a-e_lgammal_r.$(OBJEXT) \
>> >  @HAVE_LIBM_MACHINE_AARCH64_FALSE@@HAVE_LIBM_MACHINE_RISCV_TRUE@
>> libm/ld128/libm_a-k_cosl.$(OBJEXT) \
>> > -@HAVE_LIBM_MACHINE_AARCH64_FALSE@@HAVE_LIBM_MACHINE_RISCV_TRUE@
>> libm/ld128/libm_a-k_sinl.$(OBJEXT)
>> > +@HAVE_LIBM_MACHINE_AARCH64_FALSE@@HAVE_LIBM_MACHINE_RISCV_TRUE@
>> libm/ld128/libm_a-k_sinl.$(OBJEXT) \
>> > +@HAVE_LIBM_MACHINE_AARCH64_FALSE@@HAVE_LIBM_MACHINE_RISCV_TRUE@
>> libm/ld128/libm_a-k_tanl.$(OBJEXT) \
>> > +@HAVE_LIBM_MACHINE_AARCH64_FALSE@@HAVE_LIBM_MACHINE_RISCV_TRUE@
>> libm/ld128/libm_a-s_sinpil.$(OBJEXT) \
>> > +@HAVE_LIBM_MACHINE_AARCH64_FALSE@@HAVE_LIBM_MACHINE_RISCV_TRUE@
>> libm/ld128/libm_a-s_cospil.$(OBJEXT)
>> >  @HAVE_LIBM_MACHINE_AARCH64_TRUE@am__objects_162 =
>> libm/ld128/libm_a-e_powl.$(OBJEXT) \
>> >  @HAVE_LIBM_MACHINE_AARCH64_TRUE@
>>  libm/ld128/libm_a-s_erfl.$(OBJEXT) \
>> >  @HAVE_LIBM_MACHINE_AARCH64_TRUE@
>>  libm/ld128/libm_a-s_exp2l.$(OBJEXT) \
>> > @@ -3254,7 +3257,10 @@ am__objects_159 =
>> libm/fenv/libm_a-feclearexcept.$(OBJEXT) \
>> >  @HAVE_LIBM_MACHINE_AARCH64_TRUE@
>>  libm/ld128/libm_a-invtrig.$(OBJEXT) \
>> >  @HAVE_LIBM_MACHINE_AARCH64_TRUE@
>>  libm/ld128/libm_a-e_lgammal_r.$(OBJEXT) \
>> >  @HAVE_LIBM_MACHINE_AARCH64_TRUE@
>>  libm/ld128/libm_a-k_cosl.$(OBJEXT) \
>> > -@HAVE_LIBM_MACHINE_AARCH64_TRUE@
>>  libm/ld128/libm_a-k_sinl.$(OBJEXT)
>> > +@HAVE_LIBM_MACHINE_AARCH64_TRUE@
>>  libm/ld128/libm_a-k_sinl.$(OBJEXT) \
>> > +@HAVE_LIBM_MACHINE_AARCH64_TRUE@
>>  libm/ld128/libm_a-k_tanl.$(OBJEXT) \
>> > +@HAVE_LIBM_MACHINE_AARCH64_TRUE@
>>  libm/ld128/libm_a-s_sinpil.$(OBJEXT) \
>> > +@HAVE_LIBM_MACHINE_AARCH64_TRUE@
>>  libm/ld128/libm_a-s_cospil.$(OBJEXT)
>> >  @HAVE_LIBM_MACHINE_AARCH64_TRUE@@HAVE_LONG_DOUBLE_TRUE@am__objects_163
>> = $(am__objects_162)
>> >  @HAVE_LIBM_MACHINE_AMDGCN_TRUE@am__objects_164 =
>> libm/machine/amdgcn/libm_a-v64_mathcnst.$(OBJEXT) \
>> >  @HAVE_LIBM_MACHINE_AMDGCN_TRUE@
>> libm/machine/amdgcn/libm_a-v64_reent.$(OBJEXT) \
>> > @@ -3426,7 +3432,8 @@ am__objects_159 =
>> libm/fenv/libm_a-feclearexcept.$(OBJEXT) \
>> >  @HAVE_LIBM_MACHINE_I386_FALSE@@HAVE_LIBM_MACHINE_X86_64_TRUE@
>> libm/ld80/libm_a-invtrig.$(OBJEXT) \
>> >  @HAVE_LIBM_MACHINE_I386_FALSE@@HAVE_LIBM_MACHINE_X86_64_TRUE@
>> libm/ld80/libm_a-e_lgammal_r.$(OBJEXT) \
>> >  @HAVE_LIBM_MACHINE_I386_FALSE@@HAVE_LIBM_MACHINE_X86_64_TRUE@
>> libm/ld80/libm_a-k_cosl.$(OBJEXT) \
>> > -@HAVE_LIBM_MACHINE_I386_FALSE@@HAVE_LIBM_MACHINE_X86_64_TRUE@
>> libm/ld80/libm_a-k_sinl.$(OBJEXT)
>> > +@HAVE_LIBM_MACHINE_I386_FALSE@@HAVE_LIBM_MACHINE_X86_64_TRUE@
>> libm/ld80/libm_a-k_sinl.$(OBJEXT) \
>> > +@HAVE_LIBM_MACHINE_I386_FALSE@@HAVE_LIBM_MACHINE_X86_64_TRUE@
>> libm/ld80/libm_a-k_tanl.$(OBJEXT)
>> >  @HAVE_LIBM_MACHINE_I386_TRUE@am__objects_170 =
>> libm/ld80/libm_a-b_tgammal.$(OBJEXT) \
>> >  @HAVE_LIBM_MACHINE_I386_TRUE@
>> libm/ld80/libm_a-e_powl.$(OBJEXT) \
>> >  @HAVE_LIBM_MACHINE_I386_TRUE@
>> libm/ld80/libm_a-s_erfl.$(OBJEXT) \
>> > @@ -3438,7 +3445,8 @@ am__objects_159 =
>> libm/fenv/libm_a-feclearexcept.$(OBJEXT) \
>> >  @HAVE_LIBM_MACHINE_I386_TRUE@
>> libm/ld80/libm_a-invtrig.$(OBJEXT) \
>> >  @HAVE_LIBM_MACHINE_I386_TRUE@
>> libm/ld80/libm_a-e_lgammal_r.$(OBJEXT) \
>> >  @HAVE_LIBM_MACHINE_I386_TRUE@
>> libm/ld80/libm_a-k_cosl.$(OBJEXT) \
>> > -@HAVE_LIBM_MACHINE_I386_TRUE@        libm/ld80/libm_a-k_sinl.$(OBJEXT)
>> > +@HAVE_LIBM_MACHINE_I386_TRUE@
>> libm/ld80/libm_a-k_sinl.$(OBJEXT) \
>> > +@HAVE_LIBM_MACHINE_I386_TRUE@        libm/ld80/libm_a-k_tanl.$(OBJEXT)
>> >  @HAVE_LIBM_MACHINE_I386_TRUE@@HAVE_LONG_DOUBLE_TRUE@am__objects_171 =
>> $(am__objects_170)
>> >  @HAVE_LIBM_MACHINE_MIPS_TRUE@am__objects_172 =
>> libm/machine/mips/libm_a-feclearexcept.$(OBJEXT) \
>> >  @HAVE_LIBM_MACHINE_MIPS_TRUE@
>> libm/machine/mips/libm_a-fegetenv.$(OBJEXT) \
>> > @@ -3971,7 +3979,6 @@ pdfdir = @pdfdir@
>> >  prefix = @prefix@
>> >  program_transform_name = @program_transform_name@
>> >  psdir = @psdir@
>> > -runstatedir = @runstatedir@
>> >  sbindir = @sbindir@
>> >  shared_machine_dir = @shared_machine_dir@
>> >  sharedstatedir = @sharedstatedir@
>> > @@ -5066,12 +5073,14 @@ libm_test_test_LDADD = $(CRT0) libm.a libc.a
>> >  @HAVE_LIBM_MACHINE_AARCH64_TRUE@libm_ld128_lsrc = \
>> >  @HAVE_LIBM_MACHINE_AARCH64_TRUE@     libm/ld128/e_powl.c
>> libm/ld128/s_erfl.c libm/ld128/s_exp2l.c libm/ld128/s_expl.c \
>> >  @HAVE_LIBM_MACHINE_AARCH64_TRUE@     libm/ld128/s_logl.c
>> libm/ld128/b_tgammal.c libm/ld128/invtrig.c \
>> > -@HAVE_LIBM_MACHINE_AARCH64_TRUE@     libm/ld128/e_lgammal_r.c
>> libm/ld128/k_cosl.c libm/ld128/k_sinl.c
>> > +@HAVE_LIBM_MACHINE_AARCH64_TRUE@     libm/ld128/e_lgammal_r.c
>> libm/ld128/k_cosl.c libm/ld128/k_sinl.c \
>> > +@HAVE_LIBM_MACHINE_AARCH64_TRUE@     libm/ld128/k_tanl.c
>> libm/ld128/s_sinpil.c libm/ld128/s_cospil.c
>> >
>> >  @HAVE_LIBM_MACHINE_RISCV_TRUE@libm_ld128_lsrc = \
>> >  @HAVE_LIBM_MACHINE_RISCV_TRUE@       libm/ld128/e_powl.c
>> libm/ld128/s_erfl.c libm/ld128/s_exp2l.c libm/ld128/s_expl.c \
>> >  @HAVE_LIBM_MACHINE_RISCV_TRUE@       libm/ld128/s_logl.c
>> libm/ld128/b_tgammal.c libm/ld128/invtrig.c \
>> > -@HAVE_LIBM_MACHINE_RISCV_TRUE@       libm/ld128/e_lgammal_r.c
>> libm/ld128/k_cosl.c libm/ld128/k_sinl.c
>> > +@HAVE_LIBM_MACHINE_RISCV_TRUE@       libm/ld128/e_lgammal_r.c
>> libm/ld128/k_cosl.c libm/ld128/k_sinl.c \
>> > +@HAVE_LIBM_MACHINE_RISCV_TRUE@       libm/ld128/k_tanl.c
>> libm/ld128/s_sinpil.c libm/ld128/s_cospil.c
>> >
>> >  @HAVE_LIBM_MACHINE_AARCH64_TRUE@libm_a_CFLAGS_libm_ld128 = -fbuiltin
>> -fno-math-errno
>> >  @HAVE_LIBM_MACHINE_RISCV_TRUE@libm_a_CFLAGS_libm_ld128 = -fbuiltin
>> -fno-math-errno
>> > @@ -5212,12 +5221,14 @@ libm_test_test_LDADD = $(CRT0) libm.a libc.a
>> >  @HAVE_LIBM_MACHINE_I386_TRUE@libm_ld80_lsrc = \
>> >  @HAVE_LIBM_MACHINE_I386_TRUE@        libm/ld80/b_tgammal.c
>> libm/ld80/e_powl.c libm/ld80/s_erfl.c libm/ld80/s_exp2l.c \
>> >  @HAVE_LIBM_MACHINE_I386_TRUE@        libm/ld80/s_expl.c
>> libm/ld80/s_logl.c libm/ld80/s_sinpil.c libm/ld80/s_cospil.c \
>> > -@HAVE_LIBM_MACHINE_I386_TRUE@        libm/ld80/invtrig.c
>> libm/ld80/e_lgammal_r.c libm/ld80/k_cosl.c libm/ld80/k_sinl.c
>> > +@HAVE_LIBM_MACHINE_I386_TRUE@        libm/ld80/invtrig.c
>> libm/ld80/e_lgammal_r.c libm/ld80/k_cosl.c libm/ld80/k_sinl.c \
>> > +@HAVE_LIBM_MACHINE_I386_TRUE@        libm/ld80/k_tanl.c
>> >
>> >  @HAVE_LIBM_MACHINE_X86_64_TRUE@libm_ld80_lsrc = \
>> >  @HAVE_LIBM_MACHINE_X86_64_TRUE@      libm/ld80/b_tgammal.c
>> libm/ld80/e_powl.c libm/ld80/s_erfl.c libm/ld80/s_exp2l.c \
>> >  @HAVE_LIBM_MACHINE_X86_64_TRUE@      libm/ld80/s_expl.c
>> libm/ld80/s_logl.c libm/ld80/s_sinpil.c libm/ld80/s_cospil.c \
>> > -@HAVE_LIBM_MACHINE_X86_64_TRUE@      libm/ld80/invtrig.c
>> libm/ld80/e_lgammal_r.c libm/ld80/k_cosl.c libm/ld80/k_sinl.c
>> > +@HAVE_LIBM_MACHINE_X86_64_TRUE@      libm/ld80/invtrig.c
>> libm/ld80/e_lgammal_r.c libm/ld80/k_cosl.c libm/ld80/k_sinl.c \
>> > +@HAVE_LIBM_MACHINE_X86_64_TRUE@      libm/ld80/k_tanl.c
>> >
>> >  @HAVE_LIBM_MACHINE_I386_TRUE@libm_a_CFLAGS_libm_ld80 = -fbuiltin
>> -fno-math-errno
>> >  @HAVE_LIBM_MACHINE_X86_64_TRUE@libm_a_CFLAGS_libm_ld80 = -fbuiltin
>> -fno-math-errno
>> > @@ -11059,6 +11070,12 @@ libm/ld128/libm_a-k_cosl.$(OBJEXT):
>> libm/ld128/$(am__dirstamp) \
>> >       libm/ld128/$(DEPDIR)/$(am__dirstamp)
>> >  libm/ld128/libm_a-k_sinl.$(OBJEXT): libm/ld128/$(am__dirstamp) \
>> >       libm/ld128/$(DEPDIR)/$(am__dirstamp)
>> > +libm/ld128/libm_a-k_tanl.$(OBJEXT): libm/ld128/$(am__dirstamp) \
>> > +     libm/ld128/$(DEPDIR)/$(am__dirstamp)
>> > +libm/ld128/libm_a-s_sinpil.$(OBJEXT): libm/ld128/$(am__dirstamp) \
>> > +     libm/ld128/$(DEPDIR)/$(am__dirstamp)
>> > +libm/ld128/libm_a-s_cospil.$(OBJEXT): libm/ld128/$(am__dirstamp) \
>> > +     libm/ld128/$(DEPDIR)/$(am__dirstamp)
>> >  libm/machine/amdgcn/$(am__dirstamp):
>> >       @$(MKDIR_P) libm/machine/amdgcn
>> >       @: > libm/machine/amdgcn/$(am__dirstamp)
>> > @@ -11575,6 +11592,8 @@ libm/ld80/libm_a-k_cosl.$(OBJEXT):
>> libm/ld80/$(am__dirstamp) \
>> >       libm/ld80/$(DEPDIR)/$(am__dirstamp)
>> >  libm/ld80/libm_a-k_sinl.$(OBJEXT): libm/ld80/$(am__dirstamp) \
>> >       libm/ld80/$(DEPDIR)/$(am__dirstamp)
>> > +libm/ld80/libm_a-k_tanl.$(OBJEXT): libm/ld80/$(am__dirstamp) \
>> > +     libm/ld80/$(DEPDIR)/$(am__dirstamp)
>> >  libm/machine/mips/$(am__dirstamp):
>> >       @$(MKDIR_P) libm/machine/mips
>> >       @: > libm/machine/mips/$(am__dirstamp)
>> > @@ -14427,16 +14446,20 @@ distclean-compile:
>> >  @AMDEP_TRUE@@am__include@ @am__quote@libm
>> /ld128/$(DEPDIR)/libm_a-invtrig.Po@am__quote@
>> >  @AMDEP_TRUE@@am__include@ @am__quote@libm
>> /ld128/$(DEPDIR)/libm_a-k_cosl.Po@am__quote@
>> >  @AMDEP_TRUE@@am__include@ @am__quote@libm
>> /ld128/$(DEPDIR)/libm_a-k_sinl.Po@am__quote@
>> > +@AMDEP_TRUE@@am__include@ @am__quote@libm
>> /ld128/$(DEPDIR)/libm_a-k_tanl.Po@am__quote@
>> > +@AMDEP_TRUE@@am__include@ @am__quote@libm
>> /ld128/$(DEPDIR)/libm_a-s_cospil.Po@am__quote@
>> >  @AMDEP_TRUE@@am__include@ @am__quote@libm
>> /ld128/$(DEPDIR)/libm_a-s_erfl.Po@am__quote@
>> >  @AMDEP_TRUE@@am__include@ @am__quote@libm
>> /ld128/$(DEPDIR)/libm_a-s_exp2l.Po@am__quote@
>> >  @AMDEP_TRUE@@am__include@ @am__quote@libm
>> /ld128/$(DEPDIR)/libm_a-s_expl.Po@am__quote@
>> >  @AMDEP_TRUE@@am__include@ @am__quote@libm
>> /ld128/$(DEPDIR)/libm_a-s_logl.Po@am__quote@
>> > +@AMDEP_TRUE@@am__include@ @am__quote@libm
>> /ld128/$(DEPDIR)/libm_a-s_sinpil.Po@am__quote@
>> >  @AMDEP_TRUE@@am__include@ @am__quote@libm
>> /ld80/$(DEPDIR)/libm_a-b_tgammal.Po@am__quote@
>> >  @AMDEP_TRUE@@am__include@ @am__quote@libm
>> /ld80/$(DEPDIR)/libm_a-e_lgammal_r.Po@am__quote@
>> >  @AMDEP_TRUE@@am__include@ @am__quote@libm
>> /ld80/$(DEPDIR)/libm_a-e_powl.Po@am__quote@
>> >  @AMDEP_TRUE@@am__include@ @am__quote@libm
>> /ld80/$(DEPDIR)/libm_a-invtrig.Po@am__quote@
>> >  @AMDEP_TRUE@@am__include@ @am__quote@libm
>> /ld80/$(DEPDIR)/libm_a-k_cosl.Po@am__quote@
>> >  @AMDEP_TRUE@@am__include@ @am__quote@libm
>> /ld80/$(DEPDIR)/libm_a-k_sinl.Po@am__quote@
>> > +@AMDEP_TRUE@@am__include@ @am__quote@libm
>> /ld80/$(DEPDIR)/libm_a-k_tanl.Po@am__quote@
>> >  @AMDEP_TRUE@@am__include@ @am__quote@libm
>> /ld80/$(DEPDIR)/libm_a-s_cospil.Po@am__quote@
>> >  @AMDEP_TRUE@@am__include@ @am__quote@libm
>> /ld80/$(DEPDIR)/libm_a-s_erfl.Po@am__quote@
>> >  @AMDEP_TRUE@@am__include@ @am__quote@libm
>> /ld80/$(DEPDIR)/libm_a-s_exp2l.Po@am__quote@
>> > @@ -44350,6 +44373,48 @@ libm/ld128/libm_a-k_sinl.obj:
>> libm/ld128/k_sinl.c
>> >  @AMDEP_TRUE@@am__fastdepCC_FALSE@    DEPDIR=$(DEPDIR) $(CCDEPMODE)
>> $(depcomp) @AMDEPBACKSLASH@
>> >  @am__fastdepCC_FALSE@        $(AM_V_CC@am__nodep@)$(CC) $(DEFS)
>> $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS)
>> $(libm_a_CFLAGS) $(CFLAGS) -c -o libm/ld128/libm_a-k_sinl.obj `if test -f
>> 'libm/ld128/k_sinl.c'; then $(CYGPATH_W) 'libm/ld128/k_sinl.c'; else
>> $(CYGPATH_W) '$(srcdir)/libm/ld128/k_sinl.c'; fi`
>> >
>> > +libm/ld128/libm_a-k_tanl.o: libm/ld128/k_tanl.c
>> > +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES)
>> $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -MT
>> libm/ld128/libm_a-k_tanl.o -MD -MP -MF
>> libm/ld128/$(DEPDIR)/libm_a-k_tanl.Tpo -c -o libm/ld128/libm_a-k_tanl.o
>> `test -f 'libm/ld128/k_tanl.c' || echo '$(srcdir)/'`libm/ld128/k_tanl.c
>> > +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv)
>> libm/ld128/$(DEPDIR)/libm_a-k_tanl.Tpo libm/ld128/$(DEPDIR)/libm_a-k_tanl.Po
>> > +@AMDEP_TRUE@@am__fastdepCC_FALSE@
>> $(AM_V_CC)source='libm/ld128/k_tanl.c' object='libm/ld128/libm_a-k_tanl.o'
>> libtool=no @AMDEPBACKSLASH@
>> > +@AMDEP_TRUE@@am__fastdepCC_FALSE@    DEPDIR=$(DEPDIR) $(CCDEPMODE)
>> $(depcomp) @AMDEPBACKSLASH@
>> > +@am__fastdepCC_FALSE@        $(AM_V_CC@am__nodep@)$(CC) $(DEFS)
>> $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS)
>> $(libm_a_CFLAGS) $(CFLAGS) -c -o libm/ld128/libm_a-k_tanl.o `test -f
>> 'libm/ld128/k_tanl.c' || echo '$(srcdir)/'`libm/ld128/k_tanl.c
>> > +
>> > +libm/ld128/libm_a-k_tanl.obj: libm/ld128/k_tanl.c
>> > +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES)
>> $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -MT
>> libm/ld128/libm_a-k_tanl.obj -MD -MP -MF
>> libm/ld128/$(DEPDIR)/libm_a-k_tanl.Tpo -c -o libm/ld128/libm_a-k_tanl.obj
>> `if test -f 'libm/ld128/k_tanl.c'; then $(CYGPATH_W) 'libm/ld128/k_tanl.c';
>> else $(CYGPATH_W) '$(srcdir)/libm/ld128/k_tanl.c'; fi`
>> > +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv)
>> libm/ld128/$(DEPDIR)/libm_a-k_tanl.Tpo libm/ld128/$(DEPDIR)/libm_a-k_tanl.Po
>> > +@AMDEP_TRUE@@am__fastdepCC_FALSE@
>> $(AM_V_CC)source='libm/ld128/k_tanl.c'
>> object='libm/ld128/libm_a-k_tanl.obj' libtool=no @AMDEPBACKSLASH@
>> > +@AMDEP_TRUE@@am__fastdepCC_FALSE@    DEPDIR=$(DEPDIR) $(CCDEPMODE)
>> $(depcomp) @AMDEPBACKSLASH@
>> > +@am__fastdepCC_FALSE@        $(AM_V_CC@am__nodep@)$(CC) $(DEFS)
>> $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS)
>> $(libm_a_CFLAGS) $(CFLAGS) -c -o libm/ld128/libm_a-k_tanl.obj `if test -f
>> 'libm/ld128/k_tanl.c'; then $(CYGPATH_W) 'libm/ld128/k_tanl.c'; else
>> $(CYGPATH_W) '$(srcdir)/libm/ld128/k_tanl.c'; fi`
>> > +
>> > +libm/ld128/libm_a-s_sinpil.o: libm/ld128/s_sinpil.c
>> > +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES)
>> $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -MT
>> libm/ld128/libm_a-s_sinpil.o -MD -MP -MF
>> libm/ld128/$(DEPDIR)/libm_a-s_sinpil.Tpo -c -o libm/ld128/libm_a-s_sinpil.o
>> `test -f 'libm/ld128/s_sinpil.c' || echo '$(srcdir)/'`libm/ld128/s_sinpil.c
>> > +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv)
>> libm/ld128/$(DEPDIR)/libm_a-s_sinpil.Tpo
>> libm/ld128/$(DEPDIR)/libm_a-s_sinpil.Po
>> > +@AMDEP_TRUE@@am__fastdepCC_FALSE@
>> $(AM_V_CC)source='libm/ld128/s_sinpil.c'
>> object='libm/ld128/libm_a-s_sinpil.o' libtool=no @AMDEPBACKSLASH@
>> > +@AMDEP_TRUE@@am__fastdepCC_FALSE@    DEPDIR=$(DEPDIR) $(CCDEPMODE)
>> $(depcomp) @AMDEPBACKSLASH@
>> > +@am__fastdepCC_FALSE@        $(AM_V_CC@am__nodep@)$(CC) $(DEFS)
>> $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS)
>> $(libm_a_CFLAGS) $(CFLAGS) -c -o libm/ld128/libm_a-s_sinpil.o `test -f
>> 'libm/ld128/s_sinpil.c' || echo '$(srcdir)/'`libm/ld128/s_sinpil.c
>> > +
>> > +libm/ld128/libm_a-s_sinpil.obj: libm/ld128/s_sinpil.c
>> > +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES)
>> $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -MT
>> libm/ld128/libm_a-s_sinpil.obj -MD -MP -MF
>> libm/ld128/$(DEPDIR)/libm_a-s_sinpil.Tpo -c -o
>> libm/ld128/libm_a-s_sinpil.obj `if test -f 'libm/ld128/s_sinpil.c'; then
>> $(CYGPATH_W) 'libm/ld128/s_sinpil.c'; else $(CYGPATH_W)
>> '$(srcdir)/libm/ld128/s_sinpil.c'; fi`
>> > +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv)
>> libm/ld128/$(DEPDIR)/libm_a-s_sinpil.Tpo
>> libm/ld128/$(DEPDIR)/libm_a-s_sinpil.Po
>> > +@AMDEP_TRUE@@am__fastdepCC_FALSE@
>> $(AM_V_CC)source='libm/ld128/s_sinpil.c'
>> object='libm/ld128/libm_a-s_sinpil.obj' libtool=no @AMDEPBACKSLASH@
>> > +@AMDEP_TRUE@@am__fastdepCC_FALSE@    DEPDIR=$(DEPDIR) $(CCDEPMODE)
>> $(depcomp) @AMDEPBACKSLASH@
>> > +@am__fastdepCC_FALSE@        $(AM_V_CC@am__nodep@)$(CC) $(DEFS)
>> $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS)
>> $(libm_a_CFLAGS) $(CFLAGS) -c -o libm/ld128/libm_a-s_sinpil.obj `if test -f
>> 'libm/ld128/s_sinpil.c'; then $(CYGPATH_W) 'libm/ld128/s_sinpil.c'; else
>> $(CYGPATH_W) '$(srcdir)/libm/ld128/s_sinpil.c'; fi`
>> > +
>> > +libm/ld128/libm_a-s_cospil.o: libm/ld128/s_cospil.c
>> > +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES)
>> $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -MT
>> libm/ld128/libm_a-s_cospil.o -MD -MP -MF
>> libm/ld128/$(DEPDIR)/libm_a-s_cospil.Tpo -c -o libm/ld128/libm_a-s_cospil.o
>> `test -f 'libm/ld128/s_cospil.c' || echo '$(srcdir)/'`libm/ld128/s_cospil.c
>> > +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv)
>> libm/ld128/$(DEPDIR)/libm_a-s_cospil.Tpo
>> libm/ld128/$(DEPDIR)/libm_a-s_cospil.Po
>> > +@AMDEP_TRUE@@am__fastdepCC_FALSE@
>> $(AM_V_CC)source='libm/ld128/s_cospil.c'
>> object='libm/ld128/libm_a-s_cospil.o' libtool=no @AMDEPBACKSLASH@
>> > +@AMDEP_TRUE@@am__fastdepCC_FALSE@    DEPDIR=$(DEPDIR) $(CCDEPMODE)
>> $(depcomp) @AMDEPBACKSLASH@
>> > +@am__fastdepCC_FALSE@        $(AM_V_CC@am__nodep@)$(CC) $(DEFS)
>> $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS)
>> $(libm_a_CFLAGS) $(CFLAGS) -c -o libm/ld128/libm_a-s_cospil.o `test -f
>> 'libm/ld128/s_cospil.c' || echo '$(srcdir)/'`libm/ld128/s_cospil.c
>> > +
>> > +libm/ld128/libm_a-s_cospil.obj: libm/ld128/s_cospil.c
>> > +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES)
>> $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -MT
>> libm/ld128/libm_a-s_cospil.obj -MD -MP -MF
>> libm/ld128/$(DEPDIR)/libm_a-s_cospil.Tpo -c -o
>> libm/ld128/libm_a-s_cospil.obj `if test -f 'libm/ld128/s_cospil.c'; then
>> $(CYGPATH_W) 'libm/ld128/s_cospil.c'; else $(CYGPATH_W)
>> '$(srcdir)/libm/ld128/s_cospil.c'; fi`
>> > +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv)
>> libm/ld128/$(DEPDIR)/libm_a-s_cospil.Tpo
>> libm/ld128/$(DEPDIR)/libm_a-s_cospil.Po
>> > +@AMDEP_TRUE@@am__fastdepCC_FALSE@
>> $(AM_V_CC)source='libm/ld128/s_cospil.c'
>> object='libm/ld128/libm_a-s_cospil.obj' libtool=no @AMDEPBACKSLASH@
>> > +@AMDEP_TRUE@@am__fastdepCC_FALSE@    DEPDIR=$(DEPDIR) $(CCDEPMODE)
>> $(depcomp) @AMDEPBACKSLASH@
>> > +@am__fastdepCC_FALSE@        $(AM_V_CC@am__nodep@)$(CC) $(DEFS)
>> $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS)
>> $(libm_a_CFLAGS) $(CFLAGS) -c -o libm/ld128/libm_a-s_cospil.obj `if test -f
>> 'libm/ld128/s_cospil.c'; then $(CYGPATH_W) 'libm/ld128/s_cospil.c'; else
>> $(CYGPATH_W) '$(srcdir)/libm/ld128/s_cospil.c'; fi`
>> > +
>> >  libm/machine/amdgcn/libm_a-v64_mathcnst.o:
>> libm/machine/amdgcn/v64_mathcnst.c
>> >  @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES)
>> $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -MT
>> libm/machine/amdgcn/libm_a-v64_mathcnst.o -MD -MP -MF
>> libm/machine/amdgcn/$(DEPDIR)/libm_a-v64_mathcnst.Tpo -c -o
>> libm/machine/amdgcn/libm_a-v64_mathcnst.o `test -f
>> 'libm/machine/amdgcn/v64_mathcnst.c' || echo
>> '$(srcdir)/'`libm/machine/amdgcn/v64_mathcnst.c
>> >  @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv)
>> libm/machine/amdgcn/$(DEPDIR)/libm_a-v64_mathcnst.Tpo
>> libm/machine/amdgcn/$(DEPDIR)/libm_a-v64_mathcnst.Po
>> > @@ -46534,6 +46599,20 @@ libm/ld80/libm_a-k_sinl.obj: libm/ld80/k_sinl.c
>> >  @AMDEP_TRUE@@am__fastdepCC_FALSE@    DEPDIR=$(DEPDIR) $(CCDEPMODE)
>> $(depcomp) @AMDEPBACKSLASH@
>> >  @am__fastdepCC_FALSE@        $(AM_V_CC@am__nodep@)$(CC) $(DEFS)
>> $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS)
>> $(libm_a_CFLAGS) $(CFLAGS) -c -o libm/ld80/libm_a-k_sinl.obj `if test -f
>> 'libm/ld80/k_sinl.c'; then $(CYGPATH_W) 'libm/ld80/k_sinl.c'; else
>> $(CYGPATH_W) '$(srcdir)/libm/ld80/k_sinl.c'; fi`
>> >
>> > +libm/ld80/libm_a-k_tanl.o: libm/ld80/k_tanl.c
>> > +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES)
>> $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -MT
>> libm/ld80/libm_a-k_tanl.o -MD -MP -MF libm/ld80/$(DEPDIR)/libm_a-k_tanl.Tpo
>> -c -o libm/ld80/libm_a-k_tanl.o `test -f 'libm/ld80/k_tanl.c' || echo
>> '$(srcdir)/'`libm/ld80/k_tanl.c
>> > +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv)
>> libm/ld80/$(DEPDIR)/libm_a-k_tanl.Tpo libm/ld80/$(DEPDIR)/libm_a-k_tanl.Po
>> > +@AMDEP_TRUE@@am__fastdepCC_FALSE@
>> $(AM_V_CC)source='libm/ld80/k_tanl.c' object='libm/ld80/libm_a-k_tanl.o'
>> libtool=no @AMDEPBACKSLASH@
>> > +@AMDEP_TRUE@@am__fastdepCC_FALSE@    DEPDIR=$(DEPDIR) $(CCDEPMODE)
>> $(depcomp) @AMDEPBACKSLASH@
>> > +@am__fastdepCC_FALSE@        $(AM_V_CC@am__nodep@)$(CC) $(DEFS)
>> $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS)
>> $(libm_a_CFLAGS) $(CFLAGS) -c -o libm/ld80/libm_a-k_tanl.o `test -f
>> 'libm/ld80/k_tanl.c' || echo '$(srcdir)/'`libm/ld80/k_tanl.c
>> > +
>> > +libm/ld80/libm_a-k_tanl.obj: libm/ld80/k_tanl.c
>> > +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES)
>> $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -MT
>> libm/ld80/libm_a-k_tanl.obj -MD -MP -MF
>> libm/ld80/$(DEPDIR)/libm_a-k_tanl.Tpo -c -o libm/ld80/libm_a-k_tanl.obj `if
>> test -f 'libm/ld80/k_tanl.c'; then $(CYGPATH_W) 'libm/ld80/k_tanl.c'; else
>> $(CYGPATH_W) '$(srcdir)/libm/ld80/k_tanl.c'; fi`
>> > +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv)
>> libm/ld80/$(DEPDIR)/libm_a-k_tanl.Tpo libm/ld80/$(DEPDIR)/libm_a-k_tanl.Po
>> > +@AMDEP_TRUE@@am__fastdepCC_FALSE@
>> $(AM_V_CC)source='libm/ld80/k_tanl.c' object='libm/ld80/libm_a-k_tanl.obj'
>> libtool=no @AMDEPBACKSLASH@
>> > +@AMDEP_TRUE@@am__fastdepCC_FALSE@    DEPDIR=$(DEPDIR) $(CCDEPMODE)
>> $(depcomp) @AMDEPBACKSLASH@
>> > +@am__fastdepCC_FALSE@        $(AM_V_CC@am__nodep@)$(CC) $(DEFS)
>> $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS)
>> $(libm_a_CFLAGS) $(CFLAGS) -c -o libm/ld80/libm_a-k_tanl.obj `if test -f
>> 'libm/ld80/k_tanl.c'; then $(CYGPATH_W) 'libm/ld80/k_tanl.c'; else
>> $(CYGPATH_W) '$(srcdir)/libm/ld80/k_tanl.c'; fi`
>> > +
>> >  libm/machine/mips/libm_a-feclearexcept.o:
>> libm/machine/mips/feclearexcept.c
>> >  @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES)
>> $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -MT
>> libm/machine/mips/libm_a-feclearexcept.o -MD -MP -MF
>> libm/machine/mips/$(DEPDIR)/libm_a-feclearexcept.Tpo -c -o
>> libm/machine/mips/libm_a-feclearexcept.o `test -f
>> 'libm/machine/mips/feclearexcept.c' || echo
>> '$(srcdir)/'`libm/machine/mips/feclearexcept.c
>> >  @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv)
>> libm/machine/mips/$(DEPDIR)/libm_a-feclearexcept.Tpo
>> libm/machine/mips/$(DEPDIR)/libm_a-feclearexcept.Po
>> > diff --git a/newlib/libm/ld/math_private.h
>> b/newlib/libm/ld/math_private.h
>> > index c5b88f65e..6d0183e3c 100644
>> > --- a/newlib/libm/ld/math_private.h
>> > +++ b/newlib/libm/ld/math_private.h
>> > @@ -705,6 +705,59 @@ irintl(long double x)
>> >  }
>> >  #endif
>> >
>> > +/*
>> > + * The following are fast floor macros for 0 <= |x| < 0x1p(N-1), where
>> > + * N is the precision of the type of x. These macros are used in the
>> > + * half-cycle trignometric functions (e.g., sinpi(x)).
>> > + */
>> > +#define      FFLOORF(x, j0, ix) do {                 \
>> > +     (j0) = (((ix) >> 23) & 0xff) - 0x7f;    \
>> > +     (ix) &= ~(0x007fffff >> (j0));          \
>> > +     SET_FLOAT_WORD((x), (ix));              \
>> > +} while (0)
>> > +
>> > +#define      FFLOOR(x, j0, ix, lx) do {                              \
>> > +     (j0) = (((ix) >> 20) & 0x7ff) - 0x3ff;                  \
>> > +     if ((j0) < 20) {                                        \
>> > +             (ix) &= ~(0x000fffff >> (j0));                  \
>> > +             (lx) = 0;                                       \
>> > +     } else {                                                \
>> > +             (lx) &= ~((uint32_t)0xffffffff >> ((j0) - 20)); \
>> > +     }                                                       \
>> > +     INSERT_WORDS((x), (ix), (lx));                          \
>> > +} while (0)
>> > +
>> > +#define      FFLOORL80(x, j0, ix, lx) do {                   \
>> > +     j0 = ix - 0x3fff + 1;                           \
>> > +     if ((j0) < 32) {                                \
>> > +             (lx) = ((lx) >> 32) << 32;              \
>> > +             (lx) &= ~((((lx) << 32)-1) >> (j0));    \
>> > +     } else {                                        \
>> > +             uint64_t _m;                            \
>> > +             _m = (uint64_t)-1 >> (j0);              \
>> > +             if ((lx) & _m) (lx) &= ~_m;             \
>> > +     }                                               \
>> > +     INSERT_LDBL80_WORDS((x), (ix), (lx));           \
>> > +} while (0)
>> > +
>> > +#define FFLOORL128(x, ai, ar) do {                   \
>> > +     union IEEEl2bits u;                             \
>> > +     uint64_t m;                                     \
>> > +     int e;                                          \
>> > +     u.e = (x);                                      \
>> > +     e = u.bits.exp - 16383;                         \
>> > +     if (e < 48) {                                   \
>> > +             m = ((1llu << 49) - 1) >> (e + 1);      \
>> > +             u.bits.manh &= ~m;                      \
>> > +             u.bits.manl = 0;                        \
>> > +     } else {                                        \
>> > +             m = (uint64_t)-1 >> (e - 48);           \
>> > +             u.bits.manl &= ~m;                      \
>> > +     }                                               \
>> > +     (ai) = u.e;                                     \
>> > +     (ar) = (x) - (ai);                              \
>> > +} while (0)
>> > +
>> >  #ifdef DEBUG
>> >  #if defined(__amd64__) || defined(__i386__)
>> >  #define      breakpoint()    asm("int $3")
>> > diff --git a/newlib/libm/ld128/Makefile.inc
>> b/newlib/libm/ld128/Makefile.inc
>> > index 337284d69..3a04b99a1 100644
>> > --- a/newlib/libm/ld128/Makefile.inc
>> > +++ b/newlib/libm/ld128/Makefile.inc
>> > @@ -1,7 +1,8 @@
>> >  %C%_lsrc = \
>> >       %D%/e_powl.c %D%/s_erfl.c %D%/s_exp2l.c %D%/s_expl.c \
>> >       %D%/s_logl.c %D%/b_tgammal.c %D%/invtrig.c \
>> > -     %D%/e_lgammal_r.c %D%/k_cosl.c %D%/k_sinl.c
>> > +     %D%/e_lgammal_r.c %D%/k_cosl.c %D%/k_sinl.c \
>> > +     %D%/k_tanl.c %D%/s_sinpil.c %D%/s_cospil.c
>> >
>> >  libm_a_CFLAGS_%C% = -fbuiltin -fno-math-errno
>> >
>> > diff --git a/newlib/libm/ld128/k_cospil.h b/newlib/libm/ld128/k_cospil.h
>> > new file mode 100644
>> > index 000000000..592f19229
>> > --- /dev/null
>> > +++ b/newlib/libm/ld128/k_cospil.h
>> > @@ -0,0 +1,42 @@
>> > +/*-
>> > + * Copyright (c) 2017 Steven G. Kargl
>> > + * All rights reserved.
>> > + *
>> > + * Redistribution and use in source and binary forms, with or without
>> > + * modification, are permitted provided that the following conditions
>> > + * are met:
>> > + * 1. Redistributions of source code must retain the above copyright
>> > + *    notice unmodified, this list of conditions, and the following
>> > + *    disclaimer.
>> > + * 2. Redistributions in binary form must reproduce the above copyright
>> > + *    notice, this list of conditions and the following disclaimer in
>> the
>> > + *    documentation and/or other materials provided with the
>> distribution.
>> > + *
>> > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
>> > + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
>> WARRANTIES
>> > + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
>> DISCLAIMED.
>> > + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
>> > + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
>> (INCLUDING, BUT
>> > + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
>> OF USE,
>> > + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
>> ANY
>> > + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
>> > + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
>> USE OF
>> > + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
>> > + */
>> > +
>> > +/*
>> > + * See ../src/k_cospi.c for implementation details.
>> > + */
>> > +
>> > +static inline long double
>> > +__kernel_cospil(long double x)
>> > +{
>> > +     long double hi, lo;
>> > +
>> > +     hi = (double)x;
>> > +     lo = x - hi;
>> > +     lo = lo * (pi_lo + pi_hi) + hi * pi_lo;
>> > +     hi *= pi_hi;
>> > +     _2sumF(hi, lo);
>> > +     return (__kernel_cosl(hi, lo));
>> > +}
>> > diff --git a/newlib/libm/ld128/k_sinpil.h b/newlib/libm/ld128/k_sinpil.h
>> > new file mode 100644
>> > index 000000000..fa4e7d633
>> > --- /dev/null
>> > +++ b/newlib/libm/ld128/k_sinpil.h
>> > @@ -0,0 +1,42 @@
>> > +/*-
>> > + * Copyright (c) 2017 Steven G. Kargl
>> > + * All rights reserved.
>> > + *
>> > + * Redistribution and use in source and binary forms, with or without
>> > + * modification, are permitted provided that the following conditions
>> > + * are met:
>> > + * 1. Redistributions of source code must retain the above copyright
>> > + *    notice unmodified, this list of conditions, and the following
>> > + *    disclaimer.
>> > + * 2. Redistributions in binary form must reproduce the above copyright
>> > + *    notice, this list of conditions and the following disclaimer in
>> the
>> > + *    documentation and/or other materials provided with the
>> distribution.
>> > + *
>> > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
>> > + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
>> WARRANTIES
>> > + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
>> DISCLAIMED.
>> > + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
>> > + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
>> (INCLUDING, BUT
>> > + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
>> OF USE,
>> > + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
>> ANY
>> > + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
>> > + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
>> USE OF
>> > + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
>> > + */
>> > +
>> > +/*
>> > + * See ../src/k_sinpi.c for implementation details.
>> > + */
>> > +
>> > +static inline long double
>> > +__kernel_sinpil(long double x)
>> > +{
>> > +     long double hi, lo;
>> > +
>> > +     hi = (double)x;
>> > +     lo = x - hi;
>> > +     lo = lo * (pi_lo + pi_hi) + hi * pi_lo;
>> > +     hi *= pi_hi;
>> > +     _2sumF(hi, lo);
>> > +     return (__kernel_sinl(hi, lo, 1));
>> > +}
>> > diff --git a/newlib/libm/ld128/k_tanl.c b/newlib/libm/ld128/k_tanl.c
>> > new file mode 100644
>> > index 000000000..9a58cd264
>> > --- /dev/null
>> > +++ b/newlib/libm/ld128/k_tanl.c
>> > @@ -0,0 +1,114 @@
>> > +/*
>> > + * ====================================================
>> > + * Copyright 2004 Sun Microsystems, Inc.  All Rights Reserved.
>> > + * Copyright (c) 2008 Steven G. Kargl, David Schultz, Bruce D. Evans.
>> > + *
>> > + * Permission to use, copy, modify, and distribute this
>> > + * software is freely granted, provided that this notice
>> > + * is preserved.
>> > + * ====================================================
>> > + */
>> > +
>> > +/*
>> > + * ld128 version of k_tan.c.  See ../src/k_tan.c for most comments.
>> > + */
>> > +
>> > +#include "math.h"
>> > +#include "../ld/math_private.h"
>> > +
>> > +/*
>> > + * Domain [-0.67434, 0.67434], range ~[-3.37e-36, 1.982e-37]
>> > + * |tan(x)/x - t(x)| < 2**-117.8 (XXX should be ~1e-37)
>> > + *
>> > + * See ../ld80/k_cosl.c for more details about the polynomial.
>> > + */
>> > +static const long double
>> > +T3 = 0x1.5555555555555555555555555553p-2L,
>> > +T5 = 0x1.1111111111111111111111111eb5p-3L,
>> > +T7 = 0x1.ba1ba1ba1ba1ba1ba1ba1b694cd6p-5L,
>> > +T9 = 0x1.664f4882c10f9f32d6bbe09d8bcdp-6L,
>> > +T11 = 0x1.226e355e6c23c8f5b4f5762322eep-7L,
>> > +T13 = 0x1.d6d3d0e157ddfb5fed8e84e27b37p-9L,
>> > +T15 = 0x1.7da36452b75e2b5fce9ee7c2c92ep-10L,
>> > +T17 = 0x1.355824803674477dfcf726649efep-11L,
>> > +T19 = 0x1.f57d7734d1656e0aceb716f614c2p-13L,
>> > +T21 = 0x1.967e18afcb180ed942dfdc518d6cp-14L,
>> > +T23 = 0x1.497d8eea21e95bc7e2aa79b9f2cdp-15L,
>> > +T25 = 0x1.0b132d39f055c81be49eff7afd50p-16L,
>> > +T27 = 0x1.b0f72d33eff7bfa2fbc1059d90b6p-18L,
>> > +T29 = 0x1.5ef2daf21d1113df38d0fbc00267p-19L,
>> > +T31 = 0x1.1c77d6eac0234988cdaa04c96626p-20L,
>> > +T33 = 0x1.cd2a5a292b180e0bdd701057dfe3p-22L,
>> > +T35 = 0x1.75c7357d0298c01a31d0a6f7d518p-23L,
>> > +T37 = 0x1.2f3190f4718a9a520f98f50081fcp-24L,
>> > +pio4 = 0x1.921fb54442d18469898cc51701b8p-1L,
>> > +pio4lo = 0x1.cd129024e088a67cc74020bbea60p-116L;
>> > +
>> > +static const double
>> > +T39 =  0.000000028443389121318352,   /*  0x1e8a7592977938.0p-78 */
>> > +T41 =  0.000000011981013102001973,   /*  0x19baa1b1223219.0p-79 */
>> > +T43 =  0.0000000038303578044958070,  /*  0x107385dfb24529.0p-80 */
>> > +T45 =  0.0000000034664378216909893,  /*  0x1dc6c702a05262.0p-81 */
>> > +T47 = -0.0000000015090641701997785,  /* -0x19ecef3569ebb6.0p-82 */
>> > +T49 =  0.0000000029449552300483952,  /*  0x194c0668da786a.0p-81 */
>> > +T51 = -0.0000000022006995706097711,  /* -0x12e763b8845268.0p-81 */
>> > +T53 =  0.0000000015468200913196612,  /*  0x1a92fc98c29554.0p-82 */
>> > +T55 = -0.00000000061311613386849674, /* -0x151106cbc779a9.0p-83 */
>> > +T57 =  1.4912469681508012e-10;               /*
>> 0x147edbdba6f43a.0p-85 */
>> > +
>> > +long double
>> > +__kernel_tanl(long double x, long double y, int iy) {
>> > +     long double z, r, v, w, s;
>> > +     long double osign;
>> > +     int i;
>> > +
>> > +     iy = (iy == 1 ? -1 : 1);        /* XXX recover original interface
>> */
>> > +     osign = (x >= 0 ? 1.0 : -1.0);  /* XXX slow, probably wrong for
>> -0 */
>> > +     if (fabsl(x) >= 0.67434) {
>> > +             if (x < 0) {
>> > +                     x = -x;
>> > +                     y = -y;
>> > +             }
>> > +             z = pio4 - x;
>> > +             w = pio4lo - y;
>> > +             x = z + w;
>> > +             y = 0.0;
>> > +             i = 1;
>> > +     } else
>> > +             i = 0;
>> > +     z = x * x;
>> > +     w = z * z;
>> > +     r = T5 + w * (T9 + w * (T13 + w * (T17 + w * (T21 +
>> > +         w * (T25 + w * (T29 + w * (T33 +
>> > +         w * (T37 + w * (T41 + w * (T45 + w * (T49 + w * (T53 +
>> > +         w * T57))))))))))));
>> > +     v = z * (T7 + w * (T11 + w * (T15 + w * (T19 + w * (T23 +
>> > +         w * (T27 + w * (T31 + w * (T35 +
>> > +         w * (T39 + w * (T43 + w * (T47 + w * (T51 + w *
>> T55))))))))))));
>> > +     s = z * x;
>> > +     r = y + z * (s * (r + v) + y);
>> > +     r += T3 * s;
>> > +     w = x + r;
>> > +     if (i == 1) {
>> > +             v = (long double) iy;
>> > +             return osign *
>> > +                     (v - 2.0 * (x - (w * w / (w + v) - r)));
>> > +     }
>> > +     if (iy == 1)
>> > +             return w;
>> > +     else {
>> > +             /*
>> > +              * if allow error up to 2 ulp, simply return
>> > +              * -1.0 / (x+r) here
>> > +              */
>> > +             /* compute -1.0 / (x+r) accurately */
>> > +             long double a, t;
>> > +             z = w;
>> > +             z = z + 0x1p32 - 0x1p32;
>> > +             v = r - (z - x);        /* z+v = r+x */
>> > +             t = a = -1.0 / w;       /* a = -1.0/w */
>> > +             t = t + 0x1p32 - 0x1p32;
>> > +             s = 1.0 + t * z;
>> > +             return t + a * (s + t * v);
>> > +     }
>> > +}
>> > diff --git a/newlib/libm/ld128/s_cospil.c b/newlib/libm/ld128/s_cospil.c
>> > new file mode 100644
>> > index 000000000..0ef31775f
>> > --- /dev/null
>> > +++ b/newlib/libm/ld128/s_cospil.c
>> > @@ -0,0 +1,108 @@
>> > +/*-
>> > + * Copyright (c) 2017-2023 Steven G. Kargl
>> > + * All rights reserved.
>> > + *
>> > + * Redistribution and use in source and binary forms, with or without
>> > + * modification, are permitted provided that the following conditions
>> > + * are met:
>> > + * 1. Redistributions of source code must retain the above copyright
>> > + *    notice unmodified, this list of conditions, and the following
>> > + *    disclaimer.
>> > + * 2. Redistributions in binary form must reproduce the above copyright
>> > + *    notice, this list of conditions and the following disclaimer in
>> the
>> > + *    documentation and/or other materials provided with the
>> distribution.
>> > + *
>> > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
>> > + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
>> WARRANTIES
>> > + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
>> DISCLAIMED.
>> > + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
>> > + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
>> (INCLUDING, BUT
>> > + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
>> OF USE,
>> > + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
>> ANY
>> > + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
>> > + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
>> USE OF
>> > + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
>> > + */
>> > +
>> > +/*
>> > + * See ../src/s_cospi.c for implementation details.
>> > + */
>> > +
>> > +#include "../ld/fpmath.h"
>> > +#include "math.h"
>> > +#include "../ld/math_private.h"
>> > +
>> > +/*
>> > + * pi_hi contains the leading 56 bits of a 169 bit approximation for
>> pi.
>> > + */
>> > +static const long double
>> > +pi_hi = 3.14159265358979322702026593105983920e+00L,
>> > +pi_lo = 1.14423774522196636802434264184180742e-17L;
>> > +
>> > +#include "k_cospil.h"
>> > +#include "k_sinpil.h"
>> > +
>> > +volatile static const double vzero = 0;
>> > +
>> > +long double
>> > +cospil(long double x)
>> > +{
>> > +     long double ai, ar, ax, c;
>> > +
>> > +     ax = fabsl(x);
>> > +
>> > +     if (ax <= 1) {
>> > +             if (ax < 0.25) {
>> > +                     if (ax < 0x1p-60) {
>> > +                             if ((int)x == 0)
>> > +                                     return (1);
>> > +                     }
>> > +                     return (__kernel_cospil(ax));
>> > +             }
>> > +
>> > +             if (ax < 0.5)
>> > +                     c = __kernel_sinpil(0.5 - ax);
>> > +             else if (ax < 0.75) {
>> > +                     if (ax == 0.5)
>> > +                             return (0);
>> > +                     c = -__kernel_sinpil(ax - 0.5);
>> > +             } else
>> > +                     c = -__kernel_cospil(1 - ax);
>> > +             return (c);
>> > +     }
>> > +
>> > +     if (ax < 0x1p112) {
>> > +             /* Split ax = ai + ar with 0 <= ar < 1. */
>> > +             FFLOORL128(ax, ai, ar);
>> > +
>> > +             if (ar < 0.5) {
>> > +                     if (ar < 0.25)
>> > +                             c = ar == 0 ? 1 : __kernel_cospil(ar);
>> > +                     else
>> > +                             c = __kernel_sinpil(0.5 - ar);
>> > +             } else {
>> > +                     if (ar < 0.75) {
>> > +                             if (ar == 0.5)
>> > +                                     return (0);
>> > +                             c = -__kernel_sinpil(ar - 0.5);
>> > +                     } else
>> > +                             c = -__kernel_cospil(1 - ar);
>> > +             }
>> > +             return (fmodl(ai, 2.L) == 0 ? c : -c);
>> > +     }
>> > +
>> > +     if (isinf(x) || isnan(x))
>> > +             return (vzero / vzero);
>> > +
>> > +     /*
>> > +      * For |x| >= 0x1p113, it is always an even integer, so return 1.
>> > +      */
>> > +     if (ax >= 0x1p113)
>> > +             return (1);
>> > +     /*
>> > +      * For 0x1p112 <= |x| < 0x1p113 need to determine if x is an even
>> > +      * or odd integer to return 1 or -1.
>> > +      */
>> > +
>> > +     return (fmodl(ax, 2.L) == 0 ? 1 : -1);
>> > +}
>> > diff --git a/newlib/libm/ld128/s_sinpil.c b/newlib/libm/ld128/s_sinpil.c
>> > new file mode 100644
>> > index 000000000..30d1881b8
>> > --- /dev/null
>> > +++ b/newlib/libm/ld128/s_sinpil.c
>> > @@ -0,0 +1,111 @@
>> > +/*-
>> > + * Copyright (c) 2017-2023 Steven G. Kargl
>> > + * All rights reserved.
>> > + *
>> > + * Redistribution and use in source and binary forms, with or without
>> > + * modification, are permitted provided that the following conditions
>> > + * are met:
>> > + * 1. Redistributions of source code must retain the above copyright
>> > + *    notice unmodified, this list of conditions, and the following
>> > + *    disclaimer.
>> > + * 2. Redistributions in binary form must reproduce the above copyright
>> > + *    notice, this list of conditions and the following disclaimer in
>> the
>> > + *    documentation and/or other materials provided with the
>> distribution.
>> > + *
>> > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
>> > + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
>> WARRANTIES
>> > + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
>> DISCLAIMED.
>> > + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
>> > + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
>> (INCLUDING, BUT
>> > + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
>> OF USE,
>> > + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
>> ANY
>> > + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
>> > + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
>> USE OF
>> > + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
>> > + */
>> > +
>> > +/*
>> > + * See ../src/s_sinpi.c for implementation details.
>> > + */
>> > +
>> > +#include "../ld/fpmath.h"
>> > +#include "math.h"
>> > +#include "../ld/math_private.h"
>> > +
>> > +/*
>> > + * pi_hi contains the leading 56 bits of a 169 bit approximation for
>> pi.
>> > + */
>> > +static const long double
>> > +pi_hi = 3.14159265358979322702026593105983920e+00L,
>> > +pi_lo = 1.14423774522196636802434264184180742e-17L;
>> > +
>> > +#include "k_cospil.h"
>> > +#include "k_sinpil.h"
>> > +
>> > +volatile static const double vzero = 0;
>> > +
>> > +long double
>> > +sinpil(long double x)
>> > +{
>> > +     long double ai, ar, ax, hi, lo, s, xhi, xlo;
>> > +
>> > +     ax = fabsl(x);
>> > +
>> > +     if (ax < 1) {
>> > +             if (ax < 0.25) {
>> > +                     if (ax < 0x1p-60) {
>> > +                             if (x == 0)
>> > +                                     return (x);
>> > +                             hi = (double)x;
>> > +                             hi *= 0x1p113L;
>> > +                             lo = x * 0x1p113L - hi;
>> > +                             s = (pi_lo + pi_hi) * lo + pi_lo * lo +
>> > +                                 pi_hi * hi;
>> > +                             return (s * 0x1p-113L);
>> > +                     }
>> > +
>> > +                     s = __kernel_sinpil(ax);
>> > +                     return (x < 0 ? -s : s);
>> > +             }
>> > +
>> > +             if (ax < 0.5)
>> > +                     s = __kernel_cospil(0.5 - ax);
>> > +             else if (ax < 0.75)
>> > +                     s = __kernel_cospil(ax - 0.5);
>> > +             else
>> > +                     s = __kernel_sinpil(1 - ax);
>> > +             return (x < 0 ? -s : s);
>> > +     }
>> > +
>> > +     if (ax < 0x1p112) {
>> > +             /* Split ax = ai + ar with 0 <= ar < 1. */
>> > +             FFLOORL128(ax, ai, ar);
>> > +
>> > +             if (ar == 0) {
>> > +                     s = 0;
>> > +             } else {
>> > +                     if (ar < 0.5) {
>> > +                             if (ar <= 0.25)
>> > +                                     s = __kernel_sinpil(ar);
>> > +                             else
>> > +                                     s = __kernel_cospil(0.5 - ar);
>> > +                     } else {
>> > +                             if (ar < 0.75)
>> > +                                     s = __kernel_cospil(ar - 0.5);
>> > +                             else
>> > +                                     s = __kernel_sinpil(1 - ar);
>> > +                     }
>> > +
>> > +                     s = fmodl(ai, 2.L) == 0 ? s : -s;
>> > +             }
>> > +             return (x < 0 ? -s : s);
>> > +     }
>> > +
>> > +     if (isinf(x) || isnan(x))
>> > +             return (vzero / vzero);
>> > +
>> > +     /*
>> > +      * |x| >= 0x1p112 is always an integer, so return +-0.
>> > +      */
>> > +     return (copysignl(0, x));
>> > +}
>> > diff --git a/newlib/libm/ld80/Makefile.inc
>> b/newlib/libm/ld80/Makefile.inc
>> > index 97fbacdda..7bb20f743 100644
>> > --- a/newlib/libm/ld80/Makefile.inc
>> > +++ b/newlib/libm/ld80/Makefile.inc
>> > @@ -1,8 +1,8 @@
>> >  %C%_lsrc = \
>> >       %D%/b_tgammal.c %D%/e_powl.c %D%/s_erfl.c %D%/s_exp2l.c \
>> >       %D%/s_expl.c %D%/s_logl.c %D%/s_sinpil.c %D%/s_cospil.c \
>> > -     %D%/invtrig.c %D%/e_lgammal_r.c %D%/k_cosl.c %D%/k_sinl.c
>> > -
>> > +     %D%/invtrig.c %D%/e_lgammal_r.c %D%/k_cosl.c %D%/k_sinl.c \
>> > +     %D%/k_tanl.c
>> >
>> >  libm_a_CFLAGS_%C% = -fbuiltin -fno-math-errno
>> >
>> > diff --git a/newlib/libm/ld80/k_tanl.c b/newlib/libm/ld80/k_tanl.c
>> > new file mode 100644
>> > index 000000000..c55303f01
>> > --- /dev/null
>> > +++ b/newlib/libm/ld80/k_tanl.c
>> > @@ -0,0 +1,119 @@
>> > +/*
>> > + * ====================================================
>> > + * Copyright 2004 Sun Microsystems, Inc.  All Rights Reserved.
>> > + * Copyright (c) 2008 Steven G. Kargl, David Schultz, Bruce D. Evans.
>> > + *
>> > + * Permission to use, copy, modify, and distribute this
>> > + * software is freely granted, provided that this notice
>> > + * is preserved.
>> > + * ====================================================
>> > + */
>> > +
>> > +/*
>> > + * ld80 version of k_tan.c.  See ../src/k_tan.c for most comments.
>> > + */
>> > +
>> > +#include "math.h"
>> > +#include "../ld/math_private.h"
>> > +
>> > +/*
>> > + * Domain [-0.67434, 0.67434], range ~[-2.25e-22, 1.921e-22]
>> > + * |tan(x)/x - t(x)| < 2**-71.9
>> > + *
>> > + * See k_cosl.c for more details about the polynomial.
>> > + */
>> > +#if defined(__amd64__) || defined(__i386__)
>> > +/* Long double constants are slow on these arches, and broken on i386.
>> */
>> > +static const volatile double
>> > +T3hi =  0.33333333333333331,         /*  0x15555555555555.0p-54 */
>> > +T3lo =  1.8350121769317163e-17,              /*
>> 0x15280000000000.0p-108 */
>> > +T5hi =  0.13333333333333336,         /*  0x11111111111112.0p-55 */
>> > +T5lo =  1.3051083651294260e-17,              /*
>> 0x1e180000000000.0p-109 */
>> > +T7hi =  0.053968253968250494,                /*
>> 0x1ba1ba1ba1b827.0p-57 */
>> > +T7lo =  3.1509625637859973e-18,              /*
>> 0x1d100000000000.0p-111 */
>> > +pio4_hi =  0.78539816339744828,              /*
>> 0x1921fb54442d18.0p-53 */
>> > +pio4_lo =  3.0628711372715500e-17,   /*  0x11a80000000000.0p-107 */
>> > +pio4lo_hi = -1.2541394031670831e-20, /* -0x1d9cceba3f91f2.0p-119 */
>> > +pio4lo_lo =  6.1493048227390915e-37; /*  0x1a280000000000.0p-173 */
>> > +#define      T3      ((long double)T3hi + T3lo)
>> > +#define      T5      ((long double)T5hi + T5lo)
>> > +#define      T7      ((long double)T7hi + T7lo)
>> > +#define      pio4    ((long double)pio4_hi + pio4_lo)
>> > +#define      pio4lo  ((long double)pio4lo_hi + pio4lo_lo)
>> > +#else
>> > +static const long double
>> > +T3 =   0.333333333333333333180L,     /*  0xaaaaaaaaaaaaaaa5.0p-65 */
>> > +T5 =   0.133333333333333372290L,     /*  0x88888888888893c3.0p-66 */
>> > +T7 =   0.0539682539682504975744L,    /*  0xdd0dd0dd0dc13ba2.0p-68 */
>> > +pio4 = 0.785398163397448309628L,     /*  0xc90fdaa22168c235.0p-64 */
>> > +pio4lo = -1.25413940316708300586e-20L;       /*
>> -0xece675d1fc8f8cbb.0p-130 */
>> > +#endif
>> > +
>> > +static const double
>> > +T9  =  0.021869488536312216,         /*  0x1664f4882cc1c2.0p-58 */
>> > +T11 =  0.0088632355256619590,                /*
>> 0x1226e355c17612.0p-59 */
>> > +T13 =  0.0035921281113786528,                /*
>> 0x1d6d3d185d7ff8.0p-61 */
>> > +T15 =  0.0014558334756312418,                /*
>> 0x17da354aa3f96b.0p-62 */
>> > +T17 =  0.00059003538700862256,               /*
>> 0x13559358685b83.0p-63 */
>> > +T19 =  0.00023907843576635544,               /*
>> 0x1f56242026b5be.0p-65 */
>> > +T21 =  0.000097154625656538905,              /*
>> 0x1977efc26806f4.0p-66 */
>> > +T23 =  0.000038440165747303162,              /*
>> 0x14275a09b3ceac.0p-67 */
>> > +T25 =  0.000018082171885432524,              /*
>> 0x12f5e563e5487e.0p-68 */
>> > +T27 =  0.0000024196006108814377,     /*  0x144c0d80cc6896.0p-71 */
>> > +T29 =  0.0000078293456938132840,     /*  0x106b59141a6cb3.0p-69 */
>> > +T31 = -0.0000032609076735050182,     /* -0x1b5abef3ba4b59.0p-71 */
>> > +T33 =  0.0000023261313142559411;     /*  0x13835436c0c87f.0p-71 */
>> > +
>> > +long double
>> > +__kernel_tanl(long double x, long double y, int iy) {
>> > +     long double z, r, v, w, s;
>> > +     long double osign;
>> > +     int i;
>> > +
>> > +     iy = (iy == 1 ? -1 : 1);        /* XXX recover original interface
>> */
>> > +     osign = (x >= 0 ? 1.0 : -1.0);  /* XXX slow, probably wrong for
>> -0 */
>> > +     if (fabsl(x) >= 0.67434) {
>> > +             if (x < 0) {
>> > +                     x = -x;
>> > +                     y = -y;
>> > +             }
>> > +             z = pio4 - x;
>> > +             w = pio4lo - y;
>> > +             x = z + w;
>> > +             y = 0.0;
>> > +             i = 1;
>> > +     } else
>> > +             i = 0;
>> > +     z = x * x;
>> > +     w = z * z;
>> > +     r = T5 + w * (T9 + w * (T13 + w * (T17 + w * (T21 +
>> > +         w * (T25 + w * (T29 + w * T33))))));
>> > +     v = z * (T7 + w * (T11 + w * (T15 + w * (T19 + w * (T23 +
>> > +         w * (T27 + w * T31))))));
>> > +     s = z * x;
>> > +     r = y + z * (s * (r + v) + y);
>> > +     r += T3 * s;
>> > +     w = x + r;
>> > +     if (i == 1) {
>> > +             v = (long double) iy;
>> > +             return osign *
>> > +                     (v - 2.0 * (x - (w * w / (w + v) - r)));
>> > +     }
>> > +     if (iy == 1)
>> > +             return w;
>> > +     else {
>> > +             /*
>> > +              * if allow error up to 2 ulp, simply return
>> > +              * -1.0 / (x+r) here
>> > +              */
>> > +             /* compute -1.0 / (x+r) accurately */
>> > +             long double a, t;
>> > +             z = w;
>> > +             z = z + 0x1p32 - 0x1p32;
>> > +             v = r - (z - x);        /* z+v = r+x */
>> > +             t = a = -1.0 / w;       /* a = -1.0/w */
>> > +             t = t + 0x1p32 - 0x1p32;
>> > +             s = 1.0 + t * z;
>> > +             return t + a * (s + t * v);
>> > +     }
>> > +}
>> > --
>> > 2.34.1
>>
>>
  

Patch

diff --git a/newlib/Makefile.in b/newlib/Makefile.in
index b45c42c36..a051c2760 100644
--- a/newlib/Makefile.in
+++ b/newlib/Makefile.in
@@ -3244,7 +3244,10 @@  am__objects_159 = libm/fenv/libm_a-feclearexcept.$(OBJEXT) \
 @HAVE_LIBM_MACHINE_AARCH64_FALSE@@HAVE_LIBM_MACHINE_RISCV_TRUE@	libm/ld128/libm_a-invtrig.$(OBJEXT) \
 @HAVE_LIBM_MACHINE_AARCH64_FALSE@@HAVE_LIBM_MACHINE_RISCV_TRUE@	libm/ld128/libm_a-e_lgammal_r.$(OBJEXT) \
 @HAVE_LIBM_MACHINE_AARCH64_FALSE@@HAVE_LIBM_MACHINE_RISCV_TRUE@	libm/ld128/libm_a-k_cosl.$(OBJEXT) \
-@HAVE_LIBM_MACHINE_AARCH64_FALSE@@HAVE_LIBM_MACHINE_RISCV_TRUE@	libm/ld128/libm_a-k_sinl.$(OBJEXT)
+@HAVE_LIBM_MACHINE_AARCH64_FALSE@@HAVE_LIBM_MACHINE_RISCV_TRUE@	libm/ld128/libm_a-k_sinl.$(OBJEXT) \
+@HAVE_LIBM_MACHINE_AARCH64_FALSE@@HAVE_LIBM_MACHINE_RISCV_TRUE@	libm/ld128/libm_a-k_tanl.$(OBJEXT) \
+@HAVE_LIBM_MACHINE_AARCH64_FALSE@@HAVE_LIBM_MACHINE_RISCV_TRUE@	libm/ld128/libm_a-s_sinpil.$(OBJEXT) \
+@HAVE_LIBM_MACHINE_AARCH64_FALSE@@HAVE_LIBM_MACHINE_RISCV_TRUE@	libm/ld128/libm_a-s_cospil.$(OBJEXT)
 @HAVE_LIBM_MACHINE_AARCH64_TRUE@am__objects_162 = libm/ld128/libm_a-e_powl.$(OBJEXT) \
 @HAVE_LIBM_MACHINE_AARCH64_TRUE@	libm/ld128/libm_a-s_erfl.$(OBJEXT) \
 @HAVE_LIBM_MACHINE_AARCH64_TRUE@	libm/ld128/libm_a-s_exp2l.$(OBJEXT) \
@@ -3254,7 +3257,10 @@  am__objects_159 = libm/fenv/libm_a-feclearexcept.$(OBJEXT) \
 @HAVE_LIBM_MACHINE_AARCH64_TRUE@	libm/ld128/libm_a-invtrig.$(OBJEXT) \
 @HAVE_LIBM_MACHINE_AARCH64_TRUE@	libm/ld128/libm_a-e_lgammal_r.$(OBJEXT) \
 @HAVE_LIBM_MACHINE_AARCH64_TRUE@	libm/ld128/libm_a-k_cosl.$(OBJEXT) \
-@HAVE_LIBM_MACHINE_AARCH64_TRUE@	libm/ld128/libm_a-k_sinl.$(OBJEXT)
+@HAVE_LIBM_MACHINE_AARCH64_TRUE@	libm/ld128/libm_a-k_sinl.$(OBJEXT) \
+@HAVE_LIBM_MACHINE_AARCH64_TRUE@	libm/ld128/libm_a-k_tanl.$(OBJEXT) \
+@HAVE_LIBM_MACHINE_AARCH64_TRUE@	libm/ld128/libm_a-s_sinpil.$(OBJEXT) \
+@HAVE_LIBM_MACHINE_AARCH64_TRUE@	libm/ld128/libm_a-s_cospil.$(OBJEXT)
 @HAVE_LIBM_MACHINE_AARCH64_TRUE@@HAVE_LONG_DOUBLE_TRUE@am__objects_163 = $(am__objects_162)
 @HAVE_LIBM_MACHINE_AMDGCN_TRUE@am__objects_164 = libm/machine/amdgcn/libm_a-v64_mathcnst.$(OBJEXT) \
 @HAVE_LIBM_MACHINE_AMDGCN_TRUE@	libm/machine/amdgcn/libm_a-v64_reent.$(OBJEXT) \
@@ -3426,7 +3432,8 @@  am__objects_159 = libm/fenv/libm_a-feclearexcept.$(OBJEXT) \
 @HAVE_LIBM_MACHINE_I386_FALSE@@HAVE_LIBM_MACHINE_X86_64_TRUE@	libm/ld80/libm_a-invtrig.$(OBJEXT) \
 @HAVE_LIBM_MACHINE_I386_FALSE@@HAVE_LIBM_MACHINE_X86_64_TRUE@	libm/ld80/libm_a-e_lgammal_r.$(OBJEXT) \
 @HAVE_LIBM_MACHINE_I386_FALSE@@HAVE_LIBM_MACHINE_X86_64_TRUE@	libm/ld80/libm_a-k_cosl.$(OBJEXT) \
-@HAVE_LIBM_MACHINE_I386_FALSE@@HAVE_LIBM_MACHINE_X86_64_TRUE@	libm/ld80/libm_a-k_sinl.$(OBJEXT)
+@HAVE_LIBM_MACHINE_I386_FALSE@@HAVE_LIBM_MACHINE_X86_64_TRUE@	libm/ld80/libm_a-k_sinl.$(OBJEXT) \
+@HAVE_LIBM_MACHINE_I386_FALSE@@HAVE_LIBM_MACHINE_X86_64_TRUE@	libm/ld80/libm_a-k_tanl.$(OBJEXT)
 @HAVE_LIBM_MACHINE_I386_TRUE@am__objects_170 = libm/ld80/libm_a-b_tgammal.$(OBJEXT) \
 @HAVE_LIBM_MACHINE_I386_TRUE@	libm/ld80/libm_a-e_powl.$(OBJEXT) \
 @HAVE_LIBM_MACHINE_I386_TRUE@	libm/ld80/libm_a-s_erfl.$(OBJEXT) \
@@ -3438,7 +3445,8 @@  am__objects_159 = libm/fenv/libm_a-feclearexcept.$(OBJEXT) \
 @HAVE_LIBM_MACHINE_I386_TRUE@	libm/ld80/libm_a-invtrig.$(OBJEXT) \
 @HAVE_LIBM_MACHINE_I386_TRUE@	libm/ld80/libm_a-e_lgammal_r.$(OBJEXT) \
 @HAVE_LIBM_MACHINE_I386_TRUE@	libm/ld80/libm_a-k_cosl.$(OBJEXT) \
-@HAVE_LIBM_MACHINE_I386_TRUE@	libm/ld80/libm_a-k_sinl.$(OBJEXT)
+@HAVE_LIBM_MACHINE_I386_TRUE@	libm/ld80/libm_a-k_sinl.$(OBJEXT) \
+@HAVE_LIBM_MACHINE_I386_TRUE@	libm/ld80/libm_a-k_tanl.$(OBJEXT)
 @HAVE_LIBM_MACHINE_I386_TRUE@@HAVE_LONG_DOUBLE_TRUE@am__objects_171 = $(am__objects_170)
 @HAVE_LIBM_MACHINE_MIPS_TRUE@am__objects_172 = libm/machine/mips/libm_a-feclearexcept.$(OBJEXT) \
 @HAVE_LIBM_MACHINE_MIPS_TRUE@	libm/machine/mips/libm_a-fegetenv.$(OBJEXT) \
@@ -3971,7 +3979,6 @@  pdfdir = @pdfdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
-runstatedir = @runstatedir@
 sbindir = @sbindir@
 shared_machine_dir = @shared_machine_dir@
 sharedstatedir = @sharedstatedir@
@@ -5066,12 +5073,14 @@  libm_test_test_LDADD = $(CRT0) libm.a libc.a
 @HAVE_LIBM_MACHINE_AARCH64_TRUE@libm_ld128_lsrc = \
 @HAVE_LIBM_MACHINE_AARCH64_TRUE@	libm/ld128/e_powl.c libm/ld128/s_erfl.c libm/ld128/s_exp2l.c libm/ld128/s_expl.c \
 @HAVE_LIBM_MACHINE_AARCH64_TRUE@	libm/ld128/s_logl.c libm/ld128/b_tgammal.c libm/ld128/invtrig.c \
-@HAVE_LIBM_MACHINE_AARCH64_TRUE@	libm/ld128/e_lgammal_r.c libm/ld128/k_cosl.c libm/ld128/k_sinl.c
+@HAVE_LIBM_MACHINE_AARCH64_TRUE@	libm/ld128/e_lgammal_r.c libm/ld128/k_cosl.c libm/ld128/k_sinl.c \
+@HAVE_LIBM_MACHINE_AARCH64_TRUE@	libm/ld128/k_tanl.c libm/ld128/s_sinpil.c libm/ld128/s_cospil.c
 
 @HAVE_LIBM_MACHINE_RISCV_TRUE@libm_ld128_lsrc = \
 @HAVE_LIBM_MACHINE_RISCV_TRUE@	libm/ld128/e_powl.c libm/ld128/s_erfl.c libm/ld128/s_exp2l.c libm/ld128/s_expl.c \
 @HAVE_LIBM_MACHINE_RISCV_TRUE@	libm/ld128/s_logl.c libm/ld128/b_tgammal.c libm/ld128/invtrig.c \
-@HAVE_LIBM_MACHINE_RISCV_TRUE@	libm/ld128/e_lgammal_r.c libm/ld128/k_cosl.c libm/ld128/k_sinl.c
+@HAVE_LIBM_MACHINE_RISCV_TRUE@	libm/ld128/e_lgammal_r.c libm/ld128/k_cosl.c libm/ld128/k_sinl.c \
+@HAVE_LIBM_MACHINE_RISCV_TRUE@	libm/ld128/k_tanl.c libm/ld128/s_sinpil.c libm/ld128/s_cospil.c
 
 @HAVE_LIBM_MACHINE_AARCH64_TRUE@libm_a_CFLAGS_libm_ld128 = -fbuiltin -fno-math-errno
 @HAVE_LIBM_MACHINE_RISCV_TRUE@libm_a_CFLAGS_libm_ld128 = -fbuiltin -fno-math-errno
@@ -5212,12 +5221,14 @@  libm_test_test_LDADD = $(CRT0) libm.a libc.a
 @HAVE_LIBM_MACHINE_I386_TRUE@libm_ld80_lsrc = \
 @HAVE_LIBM_MACHINE_I386_TRUE@	libm/ld80/b_tgammal.c libm/ld80/e_powl.c libm/ld80/s_erfl.c libm/ld80/s_exp2l.c \
 @HAVE_LIBM_MACHINE_I386_TRUE@	libm/ld80/s_expl.c libm/ld80/s_logl.c libm/ld80/s_sinpil.c libm/ld80/s_cospil.c \
-@HAVE_LIBM_MACHINE_I386_TRUE@	libm/ld80/invtrig.c libm/ld80/e_lgammal_r.c libm/ld80/k_cosl.c libm/ld80/k_sinl.c
+@HAVE_LIBM_MACHINE_I386_TRUE@	libm/ld80/invtrig.c libm/ld80/e_lgammal_r.c libm/ld80/k_cosl.c libm/ld80/k_sinl.c \
+@HAVE_LIBM_MACHINE_I386_TRUE@	libm/ld80/k_tanl.c
 
 @HAVE_LIBM_MACHINE_X86_64_TRUE@libm_ld80_lsrc = \
 @HAVE_LIBM_MACHINE_X86_64_TRUE@	libm/ld80/b_tgammal.c libm/ld80/e_powl.c libm/ld80/s_erfl.c libm/ld80/s_exp2l.c \
 @HAVE_LIBM_MACHINE_X86_64_TRUE@	libm/ld80/s_expl.c libm/ld80/s_logl.c libm/ld80/s_sinpil.c libm/ld80/s_cospil.c \
-@HAVE_LIBM_MACHINE_X86_64_TRUE@	libm/ld80/invtrig.c libm/ld80/e_lgammal_r.c libm/ld80/k_cosl.c libm/ld80/k_sinl.c
+@HAVE_LIBM_MACHINE_X86_64_TRUE@	libm/ld80/invtrig.c libm/ld80/e_lgammal_r.c libm/ld80/k_cosl.c libm/ld80/k_sinl.c \
+@HAVE_LIBM_MACHINE_X86_64_TRUE@	libm/ld80/k_tanl.c
 
 @HAVE_LIBM_MACHINE_I386_TRUE@libm_a_CFLAGS_libm_ld80 = -fbuiltin -fno-math-errno
 @HAVE_LIBM_MACHINE_X86_64_TRUE@libm_a_CFLAGS_libm_ld80 = -fbuiltin -fno-math-errno
@@ -11059,6 +11070,12 @@  libm/ld128/libm_a-k_cosl.$(OBJEXT): libm/ld128/$(am__dirstamp) \
 	libm/ld128/$(DEPDIR)/$(am__dirstamp)
 libm/ld128/libm_a-k_sinl.$(OBJEXT): libm/ld128/$(am__dirstamp) \
 	libm/ld128/$(DEPDIR)/$(am__dirstamp)
+libm/ld128/libm_a-k_tanl.$(OBJEXT): libm/ld128/$(am__dirstamp) \
+	libm/ld128/$(DEPDIR)/$(am__dirstamp)
+libm/ld128/libm_a-s_sinpil.$(OBJEXT): libm/ld128/$(am__dirstamp) \
+	libm/ld128/$(DEPDIR)/$(am__dirstamp)
+libm/ld128/libm_a-s_cospil.$(OBJEXT): libm/ld128/$(am__dirstamp) \
+	libm/ld128/$(DEPDIR)/$(am__dirstamp)
 libm/machine/amdgcn/$(am__dirstamp):
 	@$(MKDIR_P) libm/machine/amdgcn
 	@: > libm/machine/amdgcn/$(am__dirstamp)
@@ -11575,6 +11592,8 @@  libm/ld80/libm_a-k_cosl.$(OBJEXT): libm/ld80/$(am__dirstamp) \
 	libm/ld80/$(DEPDIR)/$(am__dirstamp)
 libm/ld80/libm_a-k_sinl.$(OBJEXT): libm/ld80/$(am__dirstamp) \
 	libm/ld80/$(DEPDIR)/$(am__dirstamp)
+libm/ld80/libm_a-k_tanl.$(OBJEXT): libm/ld80/$(am__dirstamp) \
+	libm/ld80/$(DEPDIR)/$(am__dirstamp)
 libm/machine/mips/$(am__dirstamp):
 	@$(MKDIR_P) libm/machine/mips
 	@: > libm/machine/mips/$(am__dirstamp)
@@ -14427,16 +14446,20 @@  distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@libm/ld128/$(DEPDIR)/libm_a-invtrig.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@libm/ld128/$(DEPDIR)/libm_a-k_cosl.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@libm/ld128/$(DEPDIR)/libm_a-k_sinl.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libm/ld128/$(DEPDIR)/libm_a-k_tanl.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libm/ld128/$(DEPDIR)/libm_a-s_cospil.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@libm/ld128/$(DEPDIR)/libm_a-s_erfl.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@libm/ld128/$(DEPDIR)/libm_a-s_exp2l.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@libm/ld128/$(DEPDIR)/libm_a-s_expl.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@libm/ld128/$(DEPDIR)/libm_a-s_logl.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libm/ld128/$(DEPDIR)/libm_a-s_sinpil.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@libm/ld80/$(DEPDIR)/libm_a-b_tgammal.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@libm/ld80/$(DEPDIR)/libm_a-e_lgammal_r.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@libm/ld80/$(DEPDIR)/libm_a-e_powl.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@libm/ld80/$(DEPDIR)/libm_a-invtrig.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@libm/ld80/$(DEPDIR)/libm_a-k_cosl.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@libm/ld80/$(DEPDIR)/libm_a-k_sinl.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libm/ld80/$(DEPDIR)/libm_a-k_tanl.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@libm/ld80/$(DEPDIR)/libm_a-s_cospil.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@libm/ld80/$(DEPDIR)/libm_a-s_erfl.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@libm/ld80/$(DEPDIR)/libm_a-s_exp2l.Po@am__quote@
@@ -44350,6 +44373,48 @@  libm/ld128/libm_a-k_sinl.obj: libm/ld128/k_sinl.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -c -o libm/ld128/libm_a-k_sinl.obj `if test -f 'libm/ld128/k_sinl.c'; then $(CYGPATH_W) 'libm/ld128/k_sinl.c'; else $(CYGPATH_W) '$(srcdir)/libm/ld128/k_sinl.c'; fi`
 
+libm/ld128/libm_a-k_tanl.o: libm/ld128/k_tanl.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -MT libm/ld128/libm_a-k_tanl.o -MD -MP -MF libm/ld128/$(DEPDIR)/libm_a-k_tanl.Tpo -c -o libm/ld128/libm_a-k_tanl.o `test -f 'libm/ld128/k_tanl.c' || echo '$(srcdir)/'`libm/ld128/k_tanl.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) libm/ld128/$(DEPDIR)/libm_a-k_tanl.Tpo libm/ld128/$(DEPDIR)/libm_a-k_tanl.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='libm/ld128/k_tanl.c' object='libm/ld128/libm_a-k_tanl.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -c -o libm/ld128/libm_a-k_tanl.o `test -f 'libm/ld128/k_tanl.c' || echo '$(srcdir)/'`libm/ld128/k_tanl.c
+
+libm/ld128/libm_a-k_tanl.obj: libm/ld128/k_tanl.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -MT libm/ld128/libm_a-k_tanl.obj -MD -MP -MF libm/ld128/$(DEPDIR)/libm_a-k_tanl.Tpo -c -o libm/ld128/libm_a-k_tanl.obj `if test -f 'libm/ld128/k_tanl.c'; then $(CYGPATH_W) 'libm/ld128/k_tanl.c'; else $(CYGPATH_W) '$(srcdir)/libm/ld128/k_tanl.c'; fi`
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) libm/ld128/$(DEPDIR)/libm_a-k_tanl.Tpo libm/ld128/$(DEPDIR)/libm_a-k_tanl.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='libm/ld128/k_tanl.c' object='libm/ld128/libm_a-k_tanl.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -c -o libm/ld128/libm_a-k_tanl.obj `if test -f 'libm/ld128/k_tanl.c'; then $(CYGPATH_W) 'libm/ld128/k_tanl.c'; else $(CYGPATH_W) '$(srcdir)/libm/ld128/k_tanl.c'; fi`
+
+libm/ld128/libm_a-s_sinpil.o: libm/ld128/s_sinpil.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -MT libm/ld128/libm_a-s_sinpil.o -MD -MP -MF libm/ld128/$(DEPDIR)/libm_a-s_sinpil.Tpo -c -o libm/ld128/libm_a-s_sinpil.o `test -f 'libm/ld128/s_sinpil.c' || echo '$(srcdir)/'`libm/ld128/s_sinpil.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) libm/ld128/$(DEPDIR)/libm_a-s_sinpil.Tpo libm/ld128/$(DEPDIR)/libm_a-s_sinpil.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='libm/ld128/s_sinpil.c' object='libm/ld128/libm_a-s_sinpil.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -c -o libm/ld128/libm_a-s_sinpil.o `test -f 'libm/ld128/s_sinpil.c' || echo '$(srcdir)/'`libm/ld128/s_sinpil.c
+
+libm/ld128/libm_a-s_sinpil.obj: libm/ld128/s_sinpil.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -MT libm/ld128/libm_a-s_sinpil.obj -MD -MP -MF libm/ld128/$(DEPDIR)/libm_a-s_sinpil.Tpo -c -o libm/ld128/libm_a-s_sinpil.obj `if test -f 'libm/ld128/s_sinpil.c'; then $(CYGPATH_W) 'libm/ld128/s_sinpil.c'; else $(CYGPATH_W) '$(srcdir)/libm/ld128/s_sinpil.c'; fi`
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) libm/ld128/$(DEPDIR)/libm_a-s_sinpil.Tpo libm/ld128/$(DEPDIR)/libm_a-s_sinpil.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='libm/ld128/s_sinpil.c' object='libm/ld128/libm_a-s_sinpil.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -c -o libm/ld128/libm_a-s_sinpil.obj `if test -f 'libm/ld128/s_sinpil.c'; then $(CYGPATH_W) 'libm/ld128/s_sinpil.c'; else $(CYGPATH_W) '$(srcdir)/libm/ld128/s_sinpil.c'; fi`
+
+libm/ld128/libm_a-s_cospil.o: libm/ld128/s_cospil.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -MT libm/ld128/libm_a-s_cospil.o -MD -MP -MF libm/ld128/$(DEPDIR)/libm_a-s_cospil.Tpo -c -o libm/ld128/libm_a-s_cospil.o `test -f 'libm/ld128/s_cospil.c' || echo '$(srcdir)/'`libm/ld128/s_cospil.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) libm/ld128/$(DEPDIR)/libm_a-s_cospil.Tpo libm/ld128/$(DEPDIR)/libm_a-s_cospil.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='libm/ld128/s_cospil.c' object='libm/ld128/libm_a-s_cospil.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -c -o libm/ld128/libm_a-s_cospil.o `test -f 'libm/ld128/s_cospil.c' || echo '$(srcdir)/'`libm/ld128/s_cospil.c
+
+libm/ld128/libm_a-s_cospil.obj: libm/ld128/s_cospil.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -MT libm/ld128/libm_a-s_cospil.obj -MD -MP -MF libm/ld128/$(DEPDIR)/libm_a-s_cospil.Tpo -c -o libm/ld128/libm_a-s_cospil.obj `if test -f 'libm/ld128/s_cospil.c'; then $(CYGPATH_W) 'libm/ld128/s_cospil.c'; else $(CYGPATH_W) '$(srcdir)/libm/ld128/s_cospil.c'; fi`
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) libm/ld128/$(DEPDIR)/libm_a-s_cospil.Tpo libm/ld128/$(DEPDIR)/libm_a-s_cospil.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='libm/ld128/s_cospil.c' object='libm/ld128/libm_a-s_cospil.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -c -o libm/ld128/libm_a-s_cospil.obj `if test -f 'libm/ld128/s_cospil.c'; then $(CYGPATH_W) 'libm/ld128/s_cospil.c'; else $(CYGPATH_W) '$(srcdir)/libm/ld128/s_cospil.c'; fi`
+
 libm/machine/amdgcn/libm_a-v64_mathcnst.o: libm/machine/amdgcn/v64_mathcnst.c
 @am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -MT libm/machine/amdgcn/libm_a-v64_mathcnst.o -MD -MP -MF libm/machine/amdgcn/$(DEPDIR)/libm_a-v64_mathcnst.Tpo -c -o libm/machine/amdgcn/libm_a-v64_mathcnst.o `test -f 'libm/machine/amdgcn/v64_mathcnst.c' || echo '$(srcdir)/'`libm/machine/amdgcn/v64_mathcnst.c
 @am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) libm/machine/amdgcn/$(DEPDIR)/libm_a-v64_mathcnst.Tpo libm/machine/amdgcn/$(DEPDIR)/libm_a-v64_mathcnst.Po
@@ -46534,6 +46599,20 @@  libm/ld80/libm_a-k_sinl.obj: libm/ld80/k_sinl.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -c -o libm/ld80/libm_a-k_sinl.obj `if test -f 'libm/ld80/k_sinl.c'; then $(CYGPATH_W) 'libm/ld80/k_sinl.c'; else $(CYGPATH_W) '$(srcdir)/libm/ld80/k_sinl.c'; fi`
 
+libm/ld80/libm_a-k_tanl.o: libm/ld80/k_tanl.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -MT libm/ld80/libm_a-k_tanl.o -MD -MP -MF libm/ld80/$(DEPDIR)/libm_a-k_tanl.Tpo -c -o libm/ld80/libm_a-k_tanl.o `test -f 'libm/ld80/k_tanl.c' || echo '$(srcdir)/'`libm/ld80/k_tanl.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) libm/ld80/$(DEPDIR)/libm_a-k_tanl.Tpo libm/ld80/$(DEPDIR)/libm_a-k_tanl.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='libm/ld80/k_tanl.c' object='libm/ld80/libm_a-k_tanl.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -c -o libm/ld80/libm_a-k_tanl.o `test -f 'libm/ld80/k_tanl.c' || echo '$(srcdir)/'`libm/ld80/k_tanl.c
+
+libm/ld80/libm_a-k_tanl.obj: libm/ld80/k_tanl.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -MT libm/ld80/libm_a-k_tanl.obj -MD -MP -MF libm/ld80/$(DEPDIR)/libm_a-k_tanl.Tpo -c -o libm/ld80/libm_a-k_tanl.obj `if test -f 'libm/ld80/k_tanl.c'; then $(CYGPATH_W) 'libm/ld80/k_tanl.c'; else $(CYGPATH_W) '$(srcdir)/libm/ld80/k_tanl.c'; fi`
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) libm/ld80/$(DEPDIR)/libm_a-k_tanl.Tpo libm/ld80/$(DEPDIR)/libm_a-k_tanl.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='libm/ld80/k_tanl.c' object='libm/ld80/libm_a-k_tanl.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -c -o libm/ld80/libm_a-k_tanl.obj `if test -f 'libm/ld80/k_tanl.c'; then $(CYGPATH_W) 'libm/ld80/k_tanl.c'; else $(CYGPATH_W) '$(srcdir)/libm/ld80/k_tanl.c'; fi`
+
 libm/machine/mips/libm_a-feclearexcept.o: libm/machine/mips/feclearexcept.c
 @am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libm_a_CPPFLAGS) $(CPPFLAGS) $(libm_a_CFLAGS) $(CFLAGS) -MT libm/machine/mips/libm_a-feclearexcept.o -MD -MP -MF libm/machine/mips/$(DEPDIR)/libm_a-feclearexcept.Tpo -c -o libm/machine/mips/libm_a-feclearexcept.o `test -f 'libm/machine/mips/feclearexcept.c' || echo '$(srcdir)/'`libm/machine/mips/feclearexcept.c
 @am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) libm/machine/mips/$(DEPDIR)/libm_a-feclearexcept.Tpo libm/machine/mips/$(DEPDIR)/libm_a-feclearexcept.Po
diff --git a/newlib/libm/ld/math_private.h b/newlib/libm/ld/math_private.h
index c5b88f65e..6d0183e3c 100644
--- a/newlib/libm/ld/math_private.h
+++ b/newlib/libm/ld/math_private.h
@@ -705,6 +705,59 @@  irintl(long double x)
 }
 #endif
 
+/*
+ * The following are fast floor macros for 0 <= |x| < 0x1p(N-1), where
+ * N is the precision of the type of x. These macros are used in the
+ * half-cycle trignometric functions (e.g., sinpi(x)).
+ */
+#define	FFLOORF(x, j0, ix) do {			\
+	(j0) = (((ix) >> 23) & 0xff) - 0x7f;	\
+	(ix) &= ~(0x007fffff >> (j0));		\
+	SET_FLOAT_WORD((x), (ix));		\
+} while (0)
+
+#define	FFLOOR(x, j0, ix, lx) do {				\
+	(j0) = (((ix) >> 20) & 0x7ff) - 0x3ff;			\
+	if ((j0) < 20) {					\
+		(ix) &= ~(0x000fffff >> (j0));			\
+		(lx) = 0;					\
+	} else {						\
+		(lx) &= ~((uint32_t)0xffffffff >> ((j0) - 20));	\
+	}							\
+	INSERT_WORDS((x), (ix), (lx));				\
+} while (0)
+
+#define	FFLOORL80(x, j0, ix, lx) do {			\
+	j0 = ix - 0x3fff + 1;				\
+	if ((j0) < 32) {				\
+		(lx) = ((lx) >> 32) << 32;		\
+		(lx) &= ~((((lx) << 32)-1) >> (j0));	\
+	} else {					\
+		uint64_t _m;				\
+		_m = (uint64_t)-1 >> (j0);		\
+		if ((lx) & _m) (lx) &= ~_m;		\
+	}						\
+	INSERT_LDBL80_WORDS((x), (ix), (lx));		\
+} while (0)
+
+#define FFLOORL128(x, ai, ar) do {			\
+	union IEEEl2bits u;				\
+	uint64_t m;					\
+	int e;						\
+	u.e = (x);					\
+	e = u.bits.exp - 16383;				\
+	if (e < 48) {					\
+		m = ((1llu << 49) - 1) >> (e + 1);	\
+		u.bits.manh &= ~m;			\
+		u.bits.manl = 0;			\
+	} else {					\
+		m = (uint64_t)-1 >> (e - 48);		\
+		u.bits.manl &= ~m;			\
+	}						\
+	(ai) = u.e;					\
+	(ar) = (x) - (ai);				\
+} while (0)
+
 #ifdef DEBUG
 #if defined(__amd64__) || defined(__i386__)
 #define	breakpoint()	asm("int $3")
diff --git a/newlib/libm/ld128/Makefile.inc b/newlib/libm/ld128/Makefile.inc
index 337284d69..3a04b99a1 100644
--- a/newlib/libm/ld128/Makefile.inc
+++ b/newlib/libm/ld128/Makefile.inc
@@ -1,7 +1,8 @@ 
 %C%_lsrc = \
 	%D%/e_powl.c %D%/s_erfl.c %D%/s_exp2l.c %D%/s_expl.c \
 	%D%/s_logl.c %D%/b_tgammal.c %D%/invtrig.c \
-	%D%/e_lgammal_r.c %D%/k_cosl.c %D%/k_sinl.c
+	%D%/e_lgammal_r.c %D%/k_cosl.c %D%/k_sinl.c \
+	%D%/k_tanl.c %D%/s_sinpil.c %D%/s_cospil.c
 
 libm_a_CFLAGS_%C% = -fbuiltin -fno-math-errno
 
diff --git a/newlib/libm/ld128/k_cospil.h b/newlib/libm/ld128/k_cospil.h
new file mode 100644
index 000000000..592f19229
--- /dev/null
+++ b/newlib/libm/ld128/k_cospil.h
@@ -0,0 +1,42 @@ 
+/*-
+ * Copyright (c) 2017 Steven G. Kargl
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice unmodified, this list of conditions, and the following
+ *    disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * See ../src/k_cospi.c for implementation details.
+ */
+
+static inline long double
+__kernel_cospil(long double x)
+{
+	long double hi, lo;
+
+	hi = (double)x;
+	lo = x - hi;
+	lo = lo * (pi_lo + pi_hi) + hi * pi_lo;
+	hi *= pi_hi;
+	_2sumF(hi, lo);
+	return (__kernel_cosl(hi, lo));
+}
diff --git a/newlib/libm/ld128/k_sinpil.h b/newlib/libm/ld128/k_sinpil.h
new file mode 100644
index 000000000..fa4e7d633
--- /dev/null
+++ b/newlib/libm/ld128/k_sinpil.h
@@ -0,0 +1,42 @@ 
+/*-
+ * Copyright (c) 2017 Steven G. Kargl
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice unmodified, this list of conditions, and the following
+ *    disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * See ../src/k_sinpi.c for implementation details.
+ */
+
+static inline long double
+__kernel_sinpil(long double x)
+{
+	long double hi, lo;
+
+	hi = (double)x;
+	lo = x - hi;
+	lo = lo * (pi_lo + pi_hi) + hi * pi_lo;
+	hi *= pi_hi;
+	_2sumF(hi, lo);
+	return (__kernel_sinl(hi, lo, 1));
+}
diff --git a/newlib/libm/ld128/k_tanl.c b/newlib/libm/ld128/k_tanl.c
new file mode 100644
index 000000000..9a58cd264
--- /dev/null
+++ b/newlib/libm/ld128/k_tanl.c
@@ -0,0 +1,114 @@ 
+/*
+ * ====================================================
+ * Copyright 2004 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright (c) 2008 Steven G. Kargl, David Schultz, Bruce D. Evans.
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ * ld128 version of k_tan.c.  See ../src/k_tan.c for most comments.
+ */
+
+#include "math.h"
+#include "../ld/math_private.h"
+
+/*
+ * Domain [-0.67434, 0.67434], range ~[-3.37e-36, 1.982e-37]
+ * |tan(x)/x - t(x)| < 2**-117.8 (XXX should be ~1e-37)
+ *
+ * See ../ld80/k_cosl.c for more details about the polynomial.
+ */
+static const long double
+T3 = 0x1.5555555555555555555555555553p-2L,
+T5 = 0x1.1111111111111111111111111eb5p-3L,
+T7 = 0x1.ba1ba1ba1ba1ba1ba1ba1b694cd6p-5L,
+T9 = 0x1.664f4882c10f9f32d6bbe09d8bcdp-6L,
+T11 = 0x1.226e355e6c23c8f5b4f5762322eep-7L,
+T13 = 0x1.d6d3d0e157ddfb5fed8e84e27b37p-9L,
+T15 = 0x1.7da36452b75e2b5fce9ee7c2c92ep-10L,
+T17 = 0x1.355824803674477dfcf726649efep-11L,
+T19 = 0x1.f57d7734d1656e0aceb716f614c2p-13L,
+T21 = 0x1.967e18afcb180ed942dfdc518d6cp-14L,
+T23 = 0x1.497d8eea21e95bc7e2aa79b9f2cdp-15L,
+T25 = 0x1.0b132d39f055c81be49eff7afd50p-16L,
+T27 = 0x1.b0f72d33eff7bfa2fbc1059d90b6p-18L,
+T29 = 0x1.5ef2daf21d1113df38d0fbc00267p-19L,
+T31 = 0x1.1c77d6eac0234988cdaa04c96626p-20L,
+T33 = 0x1.cd2a5a292b180e0bdd701057dfe3p-22L,
+T35 = 0x1.75c7357d0298c01a31d0a6f7d518p-23L,
+T37 = 0x1.2f3190f4718a9a520f98f50081fcp-24L,
+pio4 = 0x1.921fb54442d18469898cc51701b8p-1L,
+pio4lo = 0x1.cd129024e088a67cc74020bbea60p-116L;
+
+static const double
+T39 =  0.000000028443389121318352,	/*  0x1e8a7592977938.0p-78 */
+T41 =  0.000000011981013102001973,	/*  0x19baa1b1223219.0p-79 */
+T43 =  0.0000000038303578044958070,	/*  0x107385dfb24529.0p-80 */
+T45 =  0.0000000034664378216909893,	/*  0x1dc6c702a05262.0p-81 */
+T47 = -0.0000000015090641701997785,	/* -0x19ecef3569ebb6.0p-82 */
+T49 =  0.0000000029449552300483952,	/*  0x194c0668da786a.0p-81 */
+T51 = -0.0000000022006995706097711,	/* -0x12e763b8845268.0p-81 */
+T53 =  0.0000000015468200913196612,	/*  0x1a92fc98c29554.0p-82 */
+T55 = -0.00000000061311613386849674,	/* -0x151106cbc779a9.0p-83 */
+T57 =  1.4912469681508012e-10;		/*  0x147edbdba6f43a.0p-85 */
+
+long double
+__kernel_tanl(long double x, long double y, int iy) {
+	long double z, r, v, w, s;
+	long double osign;
+	int i;
+
+	iy = (iy == 1 ? -1 : 1);	/* XXX recover original interface */
+	osign = (x >= 0 ? 1.0 : -1.0);	/* XXX slow, probably wrong for -0 */
+	if (fabsl(x) >= 0.67434) {
+		if (x < 0) {
+			x = -x;
+			y = -y;
+		}
+		z = pio4 - x;
+		w = pio4lo - y;
+		x = z + w;
+		y = 0.0;
+		i = 1;
+	} else
+		i = 0;
+	z = x * x;
+	w = z * z;
+	r = T5 + w * (T9 + w * (T13 + w * (T17 + w * (T21 +
+	    w * (T25 + w * (T29 + w * (T33 +
+	    w * (T37 + w * (T41 + w * (T45 + w * (T49 + w * (T53 +
+	    w * T57))))))))))));
+	v = z * (T7 + w * (T11 + w * (T15 + w * (T19 + w * (T23 +
+	    w * (T27 + w * (T31 + w * (T35 +
+	    w * (T39 + w * (T43 + w * (T47 + w * (T51 + w * T55))))))))))));
+	s = z * x;
+	r = y + z * (s * (r + v) + y);
+	r += T3 * s;
+	w = x + r;
+	if (i == 1) {
+		v = (long double) iy;
+		return osign *
+			(v - 2.0 * (x - (w * w / (w + v) - r)));
+	}
+	if (iy == 1)
+		return w;
+	else {
+		/*
+		 * if allow error up to 2 ulp, simply return
+		 * -1.0 / (x+r) here
+		 */
+		/* compute -1.0 / (x+r) accurately */
+		long double a, t;
+		z = w;
+		z = z + 0x1p32 - 0x1p32;
+		v = r - (z - x);	/* z+v = r+x */
+		t = a = -1.0 / w;	/* a = -1.0/w */
+		t = t + 0x1p32 - 0x1p32;
+		s = 1.0 + t * z;
+		return t + a * (s + t * v);
+	}
+}
diff --git a/newlib/libm/ld128/s_cospil.c b/newlib/libm/ld128/s_cospil.c
new file mode 100644
index 000000000..0ef31775f
--- /dev/null
+++ b/newlib/libm/ld128/s_cospil.c
@@ -0,0 +1,108 @@ 
+/*-
+ * Copyright (c) 2017-2023 Steven G. Kargl
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice unmodified, this list of conditions, and the following
+ *    disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * See ../src/s_cospi.c for implementation details.
+ */
+
+#include "../ld/fpmath.h"
+#include "math.h"
+#include "../ld/math_private.h"
+
+/*
+ * pi_hi contains the leading 56 bits of a 169 bit approximation for pi.
+ */
+static const long double
+pi_hi = 3.14159265358979322702026593105983920e+00L,
+pi_lo = 1.14423774522196636802434264184180742e-17L;
+
+#include "k_cospil.h"
+#include "k_sinpil.h"
+
+volatile static const double vzero = 0;
+
+long double
+cospil(long double x)
+{
+	long double ai, ar, ax, c;
+
+	ax = fabsl(x);
+
+	if (ax <= 1) {
+		if (ax < 0.25) {
+			if (ax < 0x1p-60) {
+				if ((int)x == 0)
+					return (1);
+			}
+			return (__kernel_cospil(ax));
+		}
+
+		if (ax < 0.5)
+			c = __kernel_sinpil(0.5 - ax);
+		else if (ax < 0.75) {
+			if (ax == 0.5)
+				return (0);
+			c = -__kernel_sinpil(ax - 0.5);
+		} else
+			c = -__kernel_cospil(1 - ax);
+		return (c);
+	}
+
+	if (ax < 0x1p112) {
+		/* Split ax = ai + ar with 0 <= ar < 1. */
+		FFLOORL128(ax, ai, ar);
+
+		if (ar < 0.5) {
+			if (ar < 0.25)
+				c = ar == 0 ? 1 : __kernel_cospil(ar);
+			else
+				c = __kernel_sinpil(0.5 - ar);
+		} else {
+			if (ar < 0.75) {
+				if (ar == 0.5)
+					return (0);
+				c = -__kernel_sinpil(ar - 0.5);
+			} else
+				c = -__kernel_cospil(1 - ar);
+		}
+		return (fmodl(ai, 2.L) == 0 ? c : -c);
+	}
+
+	if (isinf(x) || isnan(x))
+		return (vzero / vzero);
+
+	/*
+	 * For |x| >= 0x1p113, it is always an even integer, so return 1.
+	 */
+	if (ax >= 0x1p113)
+		return (1);
+	/*
+	 * For 0x1p112 <= |x| < 0x1p113 need to determine if x is an even
+	 * or odd integer to return 1 or -1.
+	 */
+
+	return (fmodl(ax, 2.L) == 0 ? 1 : -1);
+}
diff --git a/newlib/libm/ld128/s_sinpil.c b/newlib/libm/ld128/s_sinpil.c
new file mode 100644
index 000000000..30d1881b8
--- /dev/null
+++ b/newlib/libm/ld128/s_sinpil.c
@@ -0,0 +1,111 @@ 
+/*-
+ * Copyright (c) 2017-2023 Steven G. Kargl
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice unmodified, this list of conditions, and the following
+ *    disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * See ../src/s_sinpi.c for implementation details.
+ */
+
+#include "../ld/fpmath.h"
+#include "math.h"
+#include "../ld/math_private.h"
+
+/*
+ * pi_hi contains the leading 56 bits of a 169 bit approximation for pi.
+ */
+static const long double
+pi_hi = 3.14159265358979322702026593105983920e+00L,
+pi_lo = 1.14423774522196636802434264184180742e-17L;
+
+#include "k_cospil.h"
+#include "k_sinpil.h"
+
+volatile static const double vzero = 0;
+
+long double
+sinpil(long double x)
+{
+	long double ai, ar, ax, hi, lo, s, xhi, xlo;
+
+	ax = fabsl(x);
+
+	if (ax < 1) {
+		if (ax < 0.25) {
+			if (ax < 0x1p-60) {
+				if (x == 0)
+					return (x);
+				hi = (double)x;
+				hi *= 0x1p113L;
+				lo = x * 0x1p113L - hi;
+				s = (pi_lo + pi_hi) * lo + pi_lo * lo +
+				    pi_hi * hi;
+				return (s * 0x1p-113L);
+			}
+
+			s = __kernel_sinpil(ax);
+			return (x < 0 ? -s : s);
+		}
+
+		if (ax < 0.5)
+			s = __kernel_cospil(0.5 - ax);
+		else if (ax < 0.75)
+			s = __kernel_cospil(ax - 0.5);
+		else
+			s = __kernel_sinpil(1 - ax);
+		return (x < 0 ? -s : s);
+	}
+
+	if (ax < 0x1p112) {
+		/* Split ax = ai + ar with 0 <= ar < 1. */
+		FFLOORL128(ax, ai, ar);
+
+		if (ar == 0) {
+			s = 0;
+		} else {
+			if (ar < 0.5) {
+				if (ar <= 0.25)
+					s = __kernel_sinpil(ar);
+				else
+					s = __kernel_cospil(0.5 - ar);
+			} else {
+				if (ar < 0.75)
+					s = __kernel_cospil(ar - 0.5);
+				else
+					s = __kernel_sinpil(1 - ar);
+			}
+
+			s = fmodl(ai, 2.L) == 0 ? s : -s;
+		}
+		return (x < 0 ? -s : s);
+	}
+
+	if (isinf(x) || isnan(x))
+		return (vzero / vzero);
+
+	/*
+	 * |x| >= 0x1p112 is always an integer, so return +-0.
+	 */
+	return (copysignl(0, x));
+}
diff --git a/newlib/libm/ld80/Makefile.inc b/newlib/libm/ld80/Makefile.inc
index 97fbacdda..7bb20f743 100644
--- a/newlib/libm/ld80/Makefile.inc
+++ b/newlib/libm/ld80/Makefile.inc
@@ -1,8 +1,8 @@ 
 %C%_lsrc = \
 	%D%/b_tgammal.c %D%/e_powl.c %D%/s_erfl.c %D%/s_exp2l.c \
 	%D%/s_expl.c %D%/s_logl.c %D%/s_sinpil.c %D%/s_cospil.c \
-	%D%/invtrig.c %D%/e_lgammal_r.c %D%/k_cosl.c %D%/k_sinl.c
-
+	%D%/invtrig.c %D%/e_lgammal_r.c %D%/k_cosl.c %D%/k_sinl.c \
+	%D%/k_tanl.c
 
 libm_a_CFLAGS_%C% = -fbuiltin -fno-math-errno
 
diff --git a/newlib/libm/ld80/k_tanl.c b/newlib/libm/ld80/k_tanl.c
new file mode 100644
index 000000000..c55303f01
--- /dev/null
+++ b/newlib/libm/ld80/k_tanl.c
@@ -0,0 +1,119 @@ 
+/*
+ * ====================================================
+ * Copyright 2004 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright (c) 2008 Steven G. Kargl, David Schultz, Bruce D. Evans.
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ * ld80 version of k_tan.c.  See ../src/k_tan.c for most comments.
+ */
+
+#include "math.h"
+#include "../ld/math_private.h"
+
+/*
+ * Domain [-0.67434, 0.67434], range ~[-2.25e-22, 1.921e-22]
+ * |tan(x)/x - t(x)| < 2**-71.9
+ *
+ * See k_cosl.c for more details about the polynomial.
+ */
+#if defined(__amd64__) || defined(__i386__)
+/* Long double constants are slow on these arches, and broken on i386. */
+static const volatile double
+T3hi =  0.33333333333333331,		/*  0x15555555555555.0p-54 */
+T3lo =  1.8350121769317163e-17,		/*  0x15280000000000.0p-108 */
+T5hi =  0.13333333333333336,		/*  0x11111111111112.0p-55 */
+T5lo =  1.3051083651294260e-17,		/*  0x1e180000000000.0p-109 */
+T7hi =  0.053968253968250494,		/*  0x1ba1ba1ba1b827.0p-57 */
+T7lo =  3.1509625637859973e-18,		/*  0x1d100000000000.0p-111 */
+pio4_hi =  0.78539816339744828,		/*  0x1921fb54442d18.0p-53 */
+pio4_lo =  3.0628711372715500e-17,	/*  0x11a80000000000.0p-107 */
+pio4lo_hi = -1.2541394031670831e-20,	/* -0x1d9cceba3f91f2.0p-119 */
+pio4lo_lo =  6.1493048227390915e-37;	/*  0x1a280000000000.0p-173 */
+#define	T3	((long double)T3hi + T3lo)
+#define	T5	((long double)T5hi + T5lo)
+#define	T7	((long double)T7hi + T7lo)
+#define	pio4	((long double)pio4_hi + pio4_lo)
+#define	pio4lo	((long double)pio4lo_hi + pio4lo_lo)
+#else
+static const long double
+T3 =   0.333333333333333333180L,	/*  0xaaaaaaaaaaaaaaa5.0p-65 */
+T5 =   0.133333333333333372290L,	/*  0x88888888888893c3.0p-66 */
+T7 =   0.0539682539682504975744L,	/*  0xdd0dd0dd0dc13ba2.0p-68 */
+pio4 = 0.785398163397448309628L,	/*  0xc90fdaa22168c235.0p-64 */
+pio4lo = -1.25413940316708300586e-20L;	/* -0xece675d1fc8f8cbb.0p-130 */
+#endif
+
+static const double
+T9  =  0.021869488536312216,		/*  0x1664f4882cc1c2.0p-58 */
+T11 =  0.0088632355256619590,		/*  0x1226e355c17612.0p-59 */
+T13 =  0.0035921281113786528,		/*  0x1d6d3d185d7ff8.0p-61 */
+T15 =  0.0014558334756312418,		/*  0x17da354aa3f96b.0p-62 */
+T17 =  0.00059003538700862256,		/*  0x13559358685b83.0p-63 */
+T19 =  0.00023907843576635544,		/*  0x1f56242026b5be.0p-65 */
+T21 =  0.000097154625656538905,		/*  0x1977efc26806f4.0p-66 */
+T23 =  0.000038440165747303162,		/*  0x14275a09b3ceac.0p-67 */
+T25 =  0.000018082171885432524,		/*  0x12f5e563e5487e.0p-68 */
+T27 =  0.0000024196006108814377,	/*  0x144c0d80cc6896.0p-71 */
+T29 =  0.0000078293456938132840,	/*  0x106b59141a6cb3.0p-69 */
+T31 = -0.0000032609076735050182,	/* -0x1b5abef3ba4b59.0p-71 */
+T33 =  0.0000023261313142559411;	/*  0x13835436c0c87f.0p-71 */
+
+long double
+__kernel_tanl(long double x, long double y, int iy) {
+	long double z, r, v, w, s;
+	long double osign;
+	int i;
+
+	iy = (iy == 1 ? -1 : 1);	/* XXX recover original interface */
+	osign = (x >= 0 ? 1.0 : -1.0);	/* XXX slow, probably wrong for -0 */
+	if (fabsl(x) >= 0.67434) {
+		if (x < 0) {
+			x = -x;
+			y = -y;
+		}
+		z = pio4 - x;
+		w = pio4lo - y;
+		x = z + w;
+		y = 0.0;
+		i = 1;
+	} else
+		i = 0;
+	z = x * x;
+	w = z * z;
+	r = T5 + w * (T9 + w * (T13 + w * (T17 + w * (T21 +
+	    w * (T25 + w * (T29 + w * T33))))));
+	v = z * (T7 + w * (T11 + w * (T15 + w * (T19 + w * (T23 +
+	    w * (T27 + w * T31))))));
+	s = z * x;
+	r = y + z * (s * (r + v) + y);
+	r += T3 * s;
+	w = x + r;
+	if (i == 1) {
+		v = (long double) iy;
+		return osign *
+			(v - 2.0 * (x - (w * w / (w + v) - r)));
+	}
+	if (iy == 1)
+		return w;
+	else {
+		/*
+		 * if allow error up to 2 ulp, simply return
+		 * -1.0 / (x+r) here
+		 */
+		/* compute -1.0 / (x+r) accurately */
+		long double a, t;
+		z = w;
+		z = z + 0x1p32 - 0x1p32;
+		v = r - (z - x);	/* z+v = r+x */
+		t = a = -1.0 / w;	/* a = -1.0/w */
+		t = t + 0x1p32 - 0x1p32;
+		s = 1.0 + t * z;
+		return t + a * (s + t * v);
+	}
+}