summaryrefslogtreecommitdiff
path: root/sysdeps/ieee754/float128
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2018-12-27 16:47:27 +0000
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2018-12-27 16:47:27 +0000
commit075f984a3aa393417f049bddd5afcee83396dde0 (patch)
tree62170b965c34ed46b18567ceb847141d3aac15ef /sysdeps/ieee754/float128
parent64c3bdb6f9bb3e5ebd004acf08d89371f4c0d26e (diff)
parent963c37d5c0eb62b38f8764b23931c0dcdd497a13 (diff)
Merge commit 'refs/top-bases/t/ifaddrs_v6' into t/ifaddrs_v6t/ifaddrs_v6
Diffstat (limited to 'sysdeps/ieee754/float128')
-rw-r--r--sysdeps/ieee754/float128/Makeconfig4
-rw-r--r--sysdeps/ieee754/float128/Makefile12
-rw-r--r--sysdeps/ieee754/float128/Versions51
-rw-r--r--sysdeps/ieee754/float128/e_acosf128.c2
-rw-r--r--sysdeps/ieee754/float128/e_acoshf128.c2
-rw-r--r--sysdeps/ieee754/float128/e_asinf128.c2
-rw-r--r--sysdeps/ieee754/float128/e_atan2f128.c2
-rw-r--r--sysdeps/ieee754/float128/e_atanhf128.c2
-rw-r--r--sysdeps/ieee754/float128/e_coshf128.c2
-rw-r--r--sysdeps/ieee754/float128/e_exp10f128.c2
-rw-r--r--sysdeps/ieee754/float128/e_expf128.c2
-rw-r--r--sysdeps/ieee754/float128/e_fmodf128.c2
-rw-r--r--sysdeps/ieee754/float128/e_gammaf128_r.c2
-rw-r--r--sysdeps/ieee754/float128/e_hypotf128.c2
-rw-r--r--sysdeps/ieee754/float128/e_ilogbf128.c2
-rw-r--r--sysdeps/ieee754/float128/e_j0f128.c2
-rw-r--r--sysdeps/ieee754/float128/e_j1f128.c2
-rw-r--r--sysdeps/ieee754/float128/e_jnf128.c2
-rw-r--r--sysdeps/ieee754/float128/e_lgammaf128_r.c2
-rw-r--r--sysdeps/ieee754/float128/e_log10f128.c2
-rw-r--r--sysdeps/ieee754/float128/e_log2f128.c2
-rw-r--r--sysdeps/ieee754/float128/e_logf128.c2
-rw-r--r--sysdeps/ieee754/float128/e_powf128.c2
-rw-r--r--sysdeps/ieee754/float128/e_rem_pio2f128.c2
-rw-r--r--sysdeps/ieee754/float128/e_remainderf128.c2
-rw-r--r--sysdeps/ieee754/float128/e_scalbf128.c1
-rw-r--r--sysdeps/ieee754/float128/e_sinhf128.c2
-rw-r--r--sysdeps/ieee754/float128/float1282mpn.c20
-rw-r--r--sysdeps/ieee754/float128/float128_private.h366
-rw-r--r--sysdeps/ieee754/float128/gamma_productf128.c2
-rw-r--r--sysdeps/ieee754/float128/ieee754_float128.h140
-rw-r--r--sysdeps/ieee754/float128/k_cosf128.c2
-rw-r--r--sysdeps/ieee754/float128/k_sincosf128.c2
-rw-r--r--sysdeps/ieee754/float128/k_sinf128.c2
-rw-r--r--sysdeps/ieee754/float128/k_tanf128.c2
-rw-r--r--sysdeps/ieee754/float128/lgamma_negf128.c2
-rw-r--r--sysdeps/ieee754/float128/lgamma_productf128.c2
-rw-r--r--sysdeps/ieee754/float128/math-nan-payload-float128.h34
-rw-r--r--sysdeps/ieee754/float128/mpn2float128.c54
-rw-r--r--sysdeps/ieee754/float128/s_asinhf128.c2
-rw-r--r--sysdeps/ieee754/float128/s_atanf128.c2
-rw-r--r--sysdeps/ieee754/float128/s_cbrtf128.c2
-rw-r--r--sysdeps/ieee754/float128/s_ceilf128.c2
-rw-r--r--sysdeps/ieee754/float128/s_copysignf128.c2
-rw-r--r--sysdeps/ieee754/float128/s_cosf128.c2
-rw-r--r--sysdeps/ieee754/float128/s_erff128.c2
-rw-r--r--sysdeps/ieee754/float128/s_expm1f128.c2
-rw-r--r--sysdeps/ieee754/float128/s_f32addf128.c6
-rw-r--r--sysdeps/ieee754/float128/s_f32divf128.c6
-rw-r--r--sysdeps/ieee754/float128/s_f32mulf128.c6
-rw-r--r--sysdeps/ieee754/float128/s_f32subf128.c6
-rw-r--r--sysdeps/ieee754/float128/s_f64addf128.c10
-rw-r--r--sysdeps/ieee754/float128/s_f64divf128.c10
-rw-r--r--sysdeps/ieee754/float128/s_f64mulf128.c10
-rw-r--r--sysdeps/ieee754/float128/s_f64subf128.c10
-rw-r--r--sysdeps/ieee754/float128/s_f64xaddf128.c2
-rw-r--r--sysdeps/ieee754/float128/s_f64xdivf128.c2
-rw-r--r--sysdeps/ieee754/float128/s_f64xmulf128.c2
-rw-r--r--sysdeps/ieee754/float128/s_f64xsubf128.c2
-rw-r--r--sysdeps/ieee754/float128/s_fabsf128.c2
-rw-r--r--sysdeps/ieee754/float128/s_finitef128.c2
-rw-r--r--sysdeps/ieee754/float128/s_floorf128.c2
-rw-r--r--sysdeps/ieee754/float128/s_fmaf128.c2
-rw-r--r--sysdeps/ieee754/float128/s_fpclassifyf128.c2
-rw-r--r--sysdeps/ieee754/float128/s_frexpf128.c2
-rw-r--r--sysdeps/ieee754/float128/s_fromfpf128.c6
-rw-r--r--sysdeps/ieee754/float128/s_fromfpxf128.c6
-rw-r--r--sysdeps/ieee754/float128/s_getpayloadf128.c2
-rw-r--r--sysdeps/ieee754/float128/s_isinff128.c2
-rw-r--r--sysdeps/ieee754/float128/s_isnanf128.c2
-rw-r--r--sysdeps/ieee754/float128/s_issignalingf128.c2
-rw-r--r--sysdeps/ieee754/float128/s_llrintf128.c2
-rw-r--r--sysdeps/ieee754/float128/s_llroundf128.c2
-rw-r--r--sysdeps/ieee754/float128/s_log1pf128.c2
-rw-r--r--sysdeps/ieee754/float128/s_logbf128.c2
-rw-r--r--sysdeps/ieee754/float128/s_lrintf128.c2
-rw-r--r--sysdeps/ieee754/float128/s_lroundf128.c2
-rw-r--r--sysdeps/ieee754/float128/s_modff128.c2
-rw-r--r--sysdeps/ieee754/float128/s_nearbyintf128.c2
-rw-r--r--sysdeps/ieee754/float128/s_nextafterf128.c2
-rw-r--r--sysdeps/ieee754/float128/s_nexttowardf128.c1
-rw-r--r--sysdeps/ieee754/float128/s_nextupf128.c2
-rw-r--r--sysdeps/ieee754/float128/s_remquof128.c2
-rw-r--r--sysdeps/ieee754/float128/s_rintf128.c2
-rw-r--r--sysdeps/ieee754/float128/s_roundevenf128.c2
-rw-r--r--sysdeps/ieee754/float128/s_roundf128.c2
-rw-r--r--sysdeps/ieee754/float128/s_scalblnf128.c2
-rw-r--r--sysdeps/ieee754/float128/s_scalbnf128.c2
-rw-r--r--sysdeps/ieee754/float128/s_setpayloadf128.c5
-rw-r--r--sysdeps/ieee754/float128/s_setpayloadsigf128.c5
-rw-r--r--sysdeps/ieee754/float128/s_signbitf128.c37
-rw-r--r--sysdeps/ieee754/float128/s_significandf128.c1
-rw-r--r--sysdeps/ieee754/float128/s_sincosf128.c2
-rw-r--r--sysdeps/ieee754/float128/s_sinf128.c2
-rw-r--r--sysdeps/ieee754/float128/s_tanf128.c2
-rw-r--r--sysdeps/ieee754/float128/s_tanhf128.c2
-rw-r--r--sysdeps/ieee754/float128/s_totalorderf128.c2
-rw-r--r--sysdeps/ieee754/float128/s_totalordermagf128.c2
-rw-r--r--sysdeps/ieee754/float128/s_truncf128.c2
-rw-r--r--sysdeps/ieee754/float128/s_ufromfpf128.c6
-rw-r--r--sysdeps/ieee754/float128/s_ufromfpxf128.c6
-rw-r--r--sysdeps/ieee754/float128/strfromf128.c36
-rw-r--r--sysdeps/ieee754/float128/strtof128.c51
-rw-r--r--sysdeps/ieee754/float128/strtof128_l.c58
-rw-r--r--sysdeps/ieee754/float128/strtof128_nan.c26
-rw-r--r--sysdeps/ieee754/float128/t_sincosf128.c2
-rw-r--r--sysdeps/ieee754/float128/wcstof128.c27
-rw-r--r--sysdeps/ieee754/float128/wcstof128_l.c27
-rw-r--r--sysdeps/ieee754/float128/wcstof128_nan.c23
-rw-r--r--sysdeps/ieee754/float128/x2y2m1f128.c2
110 files changed, 1221 insertions, 0 deletions
diff --git a/sysdeps/ieee754/float128/Makeconfig b/sysdeps/ieee754/float128/Makeconfig
new file mode 100644
index 0000000000..a493ff1d41
--- /dev/null
+++ b/sysdeps/ieee754/float128/Makeconfig
@@ -0,0 +1,4 @@
+# Include this earlier so it can be used earlier in Makefiles,
+# and sysdep/ makefiles.
+float128-fcts = yes
+float64x-alias-fcts = yes
diff --git a/sysdeps/ieee754/float128/Makefile b/sysdeps/ieee754/float128/Makefile
new file mode 100644
index 0000000000..571a841809
--- /dev/null
+++ b/sysdeps/ieee754/float128/Makefile
@@ -0,0 +1,12 @@
+ifeq ($(subdir),stdlib)
+routines += float1282mpn strfromf128
+routines += strtof128 strtof128_l strtof128_nan mpn2float128
+
+# The strfrom class of functions call __printf_fp in order to convert the
+# floating-point value to characters. This requires the value of IO_MTSAFE_IO.
+CFLAGS-strfromf128.c += $(libio-mtsafe)
+endif
+
+ifeq ($(subdir),wcsmbs)
+routines += wcstof128_l wcstof128 wcstof128_nan
+endif
diff --git a/sysdeps/ieee754/float128/Versions b/sysdeps/ieee754/float128/Versions
new file mode 100644
index 0000000000..2eebc6f1b0
--- /dev/null
+++ b/sysdeps/ieee754/float128/Versions
@@ -0,0 +1,51 @@
+%include <float128-abi.h>
+%ifndef FLOAT128_VERSION
+% error "float128-abi.h must define FLOAT128_VERSION"
+%endif
+libc {
+ FLOAT128_VERSION {
+ __strtof128_internal;
+ __wcstof128_internal;
+ }
+ GLIBC_PRIVATE {
+ # For __nanf128.
+ __strtof128_nan;
+ }
+}
+libm {
+ FLOAT128_VERSION {
+ __acosf128_finite;
+ __acoshf128_finite;
+ __asinf128_finite;
+ __atan2f128_finite;
+ __atanhf128_finite;
+ __coshf128_finite;
+ __exp10f128_finite;
+ __exp2f128_finite;
+ __expf128_finite;
+ __finitef128;
+ __fmodf128_finite;
+ __fpclassifyf128;
+ __gammaf128_r_finite;
+ __hypotf128_finite;
+ __iseqsigf128;
+ __isinff128;
+ __isnanf128;
+ __issignalingf128;
+ __j0f128_finite;
+ __j1f128_finite;
+ __jnf128_finite;
+ __lgammaf128_r_finite;
+ __log10f128_finite;
+ __log2f128_finite;
+ __logf128_finite;
+ __powf128_finite;
+ __remainderf128_finite;
+ __signbitf128;
+ __sinhf128_finite;
+ __sqrtf128_finite;
+ __y0f128_finite;
+ __y1f128_finite;
+ __ynf128_finite;
+ }
+}
diff --git a/sysdeps/ieee754/float128/e_acosf128.c b/sysdeps/ieee754/float128/e_acosf128.c
new file mode 100644
index 0000000000..7ddf7dcdf1
--- /dev/null
+++ b/sysdeps/ieee754/float128/e_acosf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/e_acosl.c"
diff --git a/sysdeps/ieee754/float128/e_acoshf128.c b/sysdeps/ieee754/float128/e_acoshf128.c
new file mode 100644
index 0000000000..f6dd40cd88
--- /dev/null
+++ b/sysdeps/ieee754/float128/e_acoshf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/e_acoshl.c"
diff --git a/sysdeps/ieee754/float128/e_asinf128.c b/sysdeps/ieee754/float128/e_asinf128.c
new file mode 100644
index 0000000000..133ab8d875
--- /dev/null
+++ b/sysdeps/ieee754/float128/e_asinf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/e_asinl.c"
diff --git a/sysdeps/ieee754/float128/e_atan2f128.c b/sysdeps/ieee754/float128/e_atan2f128.c
new file mode 100644
index 0000000000..9aa740f770
--- /dev/null
+++ b/sysdeps/ieee754/float128/e_atan2f128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/e_atan2l.c"
diff --git a/sysdeps/ieee754/float128/e_atanhf128.c b/sysdeps/ieee754/float128/e_atanhf128.c
new file mode 100644
index 0000000000..f26c8d54d2
--- /dev/null
+++ b/sysdeps/ieee754/float128/e_atanhf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/e_atanhl.c"
diff --git a/sysdeps/ieee754/float128/e_coshf128.c b/sysdeps/ieee754/float128/e_coshf128.c
new file mode 100644
index 0000000000..2abf067f64
--- /dev/null
+++ b/sysdeps/ieee754/float128/e_coshf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/e_coshl.c"
diff --git a/sysdeps/ieee754/float128/e_exp10f128.c b/sysdeps/ieee754/float128/e_exp10f128.c
new file mode 100644
index 0000000000..b3468d256b
--- /dev/null
+++ b/sysdeps/ieee754/float128/e_exp10f128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/e_exp10l.c"
diff --git a/sysdeps/ieee754/float128/e_expf128.c b/sysdeps/ieee754/float128/e_expf128.c
new file mode 100644
index 0000000000..b727b17cc9
--- /dev/null
+++ b/sysdeps/ieee754/float128/e_expf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/e_expl.c"
diff --git a/sysdeps/ieee754/float128/e_fmodf128.c b/sysdeps/ieee754/float128/e_fmodf128.c
new file mode 100644
index 0000000000..ed8a7491ed
--- /dev/null
+++ b/sysdeps/ieee754/float128/e_fmodf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/e_fmodl.c"
diff --git a/sysdeps/ieee754/float128/e_gammaf128_r.c b/sysdeps/ieee754/float128/e_gammaf128_r.c
new file mode 100644
index 0000000000..895ac6374d
--- /dev/null
+++ b/sysdeps/ieee754/float128/e_gammaf128_r.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/e_gammal_r.c"
diff --git a/sysdeps/ieee754/float128/e_hypotf128.c b/sysdeps/ieee754/float128/e_hypotf128.c
new file mode 100644
index 0000000000..1f06555505
--- /dev/null
+++ b/sysdeps/ieee754/float128/e_hypotf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/e_hypotl.c"
diff --git a/sysdeps/ieee754/float128/e_ilogbf128.c b/sysdeps/ieee754/float128/e_ilogbf128.c
new file mode 100644
index 0000000000..2861801854
--- /dev/null
+++ b/sysdeps/ieee754/float128/e_ilogbf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/e_ilogbl.c"
diff --git a/sysdeps/ieee754/float128/e_j0f128.c b/sysdeps/ieee754/float128/e_j0f128.c
new file mode 100644
index 0000000000..b624b5c596
--- /dev/null
+++ b/sysdeps/ieee754/float128/e_j0f128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/e_j0l.c"
diff --git a/sysdeps/ieee754/float128/e_j1f128.c b/sysdeps/ieee754/float128/e_j1f128.c
new file mode 100644
index 0000000000..445428e742
--- /dev/null
+++ b/sysdeps/ieee754/float128/e_j1f128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/e_j1l.c"
diff --git a/sysdeps/ieee754/float128/e_jnf128.c b/sysdeps/ieee754/float128/e_jnf128.c
new file mode 100644
index 0000000000..7854e11a1a
--- /dev/null
+++ b/sysdeps/ieee754/float128/e_jnf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/e_jnl.c"
diff --git a/sysdeps/ieee754/float128/e_lgammaf128_r.c b/sysdeps/ieee754/float128/e_lgammaf128_r.c
new file mode 100644
index 0000000000..3517ac32af
--- /dev/null
+++ b/sysdeps/ieee754/float128/e_lgammaf128_r.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/e_lgammal_r.c"
diff --git a/sysdeps/ieee754/float128/e_log10f128.c b/sysdeps/ieee754/float128/e_log10f128.c
new file mode 100644
index 0000000000..1c3341e412
--- /dev/null
+++ b/sysdeps/ieee754/float128/e_log10f128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/e_log10l.c"
diff --git a/sysdeps/ieee754/float128/e_log2f128.c b/sysdeps/ieee754/float128/e_log2f128.c
new file mode 100644
index 0000000000..36becaadc4
--- /dev/null
+++ b/sysdeps/ieee754/float128/e_log2f128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/e_log2l.c"
diff --git a/sysdeps/ieee754/float128/e_logf128.c b/sysdeps/ieee754/float128/e_logf128.c
new file mode 100644
index 0000000000..b0c9975caf
--- /dev/null
+++ b/sysdeps/ieee754/float128/e_logf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/e_logl.c"
diff --git a/sysdeps/ieee754/float128/e_powf128.c b/sysdeps/ieee754/float128/e_powf128.c
new file mode 100644
index 0000000000..3afaf7f6a6
--- /dev/null
+++ b/sysdeps/ieee754/float128/e_powf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/e_powl.c"
diff --git a/sysdeps/ieee754/float128/e_rem_pio2f128.c b/sysdeps/ieee754/float128/e_rem_pio2f128.c
new file mode 100644
index 0000000000..86c2ca1024
--- /dev/null
+++ b/sysdeps/ieee754/float128/e_rem_pio2f128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/e_rem_pio2l.c"
diff --git a/sysdeps/ieee754/float128/e_remainderf128.c b/sysdeps/ieee754/float128/e_remainderf128.c
new file mode 100644
index 0000000000..90c18f8493
--- /dev/null
+++ b/sysdeps/ieee754/float128/e_remainderf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/e_remainderl.c"
diff --git a/sysdeps/ieee754/float128/e_scalbf128.c b/sysdeps/ieee754/float128/e_scalbf128.c
new file mode 100644
index 0000000000..067b724164
--- /dev/null
+++ b/sysdeps/ieee754/float128/e_scalbf128.c
@@ -0,0 +1 @@
+/* Not defined for _FloatN types. */
diff --git a/sysdeps/ieee754/float128/e_sinhf128.c b/sysdeps/ieee754/float128/e_sinhf128.c
new file mode 100644
index 0000000000..42a54e0015
--- /dev/null
+++ b/sysdeps/ieee754/float128/e_sinhf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/e_sinhl.c"
diff --git a/sysdeps/ieee754/float128/float1282mpn.c b/sysdeps/ieee754/float128/float1282mpn.c
new file mode 100644
index 0000000000..49e8972221
--- /dev/null
+++ b/sysdeps/ieee754/float128/float1282mpn.c
@@ -0,0 +1,20 @@
+/* Convert a _Float128 type to multiprecision.
+ Copyright (C) 2017-2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <float128_private.h>
+#include "../ldbl-128/ldbl2mpn.c"
diff --git a/sysdeps/ieee754/float128/float128_private.h b/sysdeps/ieee754/float128/float128_private.h
new file mode 100644
index 0000000000..9dd15601e6
--- /dev/null
+++ b/sysdeps/ieee754/float128/float128_private.h
@@ -0,0 +1,366 @@
+/* _Float128 overrides for building ldbl-128 as _Float128.
+ Copyright (C) 2017-2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+/* This must be included before the function renames below. */
+#include <gmp.h>
+#include <math.h>
+#undef HUGE_VALL
+#define HUGE_VALL HUGE_VAL_F128
+#include <math/mul_splitl.h>
+
+/* This must be included before the renames of types and macros from
+ it. */
+#include <ieee754.h>
+
+/* Renames derived from math_private.h. */
+#include <math_private.h>
+#include <ieee754_float128.h>
+#define ieee854_long_double_shape_type ieee854_float128_shape_type
+#define ieee854_long_double ieee854_float128
+
+#undef GET_LDOUBLE_LSW64
+#undef GET_LDOUBLE_MSW64
+#undef GET_LDOUBLE_WORDS64
+#undef SET_LDOUBLE_LSW64
+#undef SET_LDOUBLE_MSW64
+#undef SET_LDOUBLE_WORDS64
+#define GET_LDOUBLE_LSW64(x,y) GET_FLOAT128_LSW64 (x, y)
+#define GET_LDOUBLE_MSW64(x,y) GET_FLOAT128_MSW64 (x, y)
+#define GET_LDOUBLE_WORDS64(x,y,z) GET_FLOAT128_WORDS64 (x, y, z)
+#define SET_LDOUBLE_LSW64(x,y) SET_FLOAT128_LSW64 (x, y)
+#define SET_LDOUBLE_MSW64(x,y) SET_FLOAT128_MSW64 (x, y)
+#define SET_LDOUBLE_WORDS64(x,y,z) SET_FLOAT128_WORDS64 (x, y, z)
+
+#undef IEEE854_LONG_DOUBLE_BIAS
+#define IEEE854_LONG_DOUBLE_BIAS IEEE854_FLOAT128_BIAS
+
+#ifdef SET_RESTORE_ROUNDF128
+# undef SET_RESTORE_ROUNDL
+# define SET_RESTORE_ROUNDL(RM) SET_RESTORE_ROUNDF128 (RM)
+#endif
+
+#ifdef libc_feholdexcept_setroundf128
+# undef libc_feholdexcept_setroundl
+# define libc_feholdexcept_setroundl(ENV, RM) \
+ libc_feholdexcept_setroundf128 (ENV, RM)
+#endif
+
+#ifdef libc_feupdateenv_testf128
+# undef libc_feupdateenv_testl
+# define libc_feupdateenv_testl(ENV, EX) libc_feupdateenv_testf128 (ENV, EX)
+#endif
+
+/* misc macros from the header below. */
+#include <fix-fp-int-convert-overflow.h>
+#undef FIX_LDBL_LONG_CONVERT_OVERFLOW
+#undef FIX_LDBL_LLONG_CONVERT_OVERFLOW
+#define FIX_LDBL_LONG_CONVERT_OVERFLOW FIX_FLT128_LONG_CONVERT_OVERFLOW
+#define FIX_LDBL_LLONG_CONVERT_OVERFLOW FIX_FLT128_LLONG_CONVERT_OVERFLOW
+
+
+/* float.h constants. */
+#include <float.h>
+#undef LDBL_DIG
+#undef LDBL_EPSILON
+#undef LDBL_MANT_DIG
+#undef LDBL_MAX
+#undef LDBL_MAX_10_EXP
+#undef LDBL_MAX_EXP
+#undef LDBL_MIN
+#undef LDBL_MIN_10_EXP
+#undef LDBL_MIN_EXP
+#undef LDBL_TRUE_MIN
+#define LDBL_DIG FLT128_DIG
+#define LDBL_EPSILON FLT128_EPSILON
+#define LDBL_MANT_DIG FLT128_MANT_DIG
+#define LDBL_MAX FLT128_MAX
+#define LDBL_MAX_10_EXP FLT128_MAX_10_EXP
+#define LDBL_MAX_EXP FLT128_MAX_EXP
+#define LDBL_MIN FLT128_MIN
+#define LDBL_MIN_10_EXP FLT128_MIN_10_EXP
+#define LDBL_MIN_EXP FLT128_MIN_EXP
+#define LDBL_TRUE_MIN FLT128_TRUE_MIN
+
+
+/* math.h GNU constants. */
+#undef M_El
+#undef M_LOG2El
+#undef M_LOG10El
+#undef M_LN2l
+#undef M_LN10l
+#undef M_PIl
+#undef M_PI_2l
+#undef M_PI_4l
+#undef M_1_PIl
+#undef M_2_PIl
+#undef M_2_SQRTPIl
+#undef M_SQRT2l
+#undef M_SQRT1_2l
+#define M_El M_Ef128
+#define M_LOG2El M_LOG2Ef128
+#define M_LOG10El M_LOG10Ef128
+#define M_LN2l M_LN2f128
+#define M_LN10l M_LN10f128
+#define M_PIl M_PIf128
+#define M_PI_2l M_PI_2f128
+#define M_PI_4l M_PI_4f128
+#define M_1_PIl M_1_PIf128
+#define M_2_PIl M_2_PIf128
+#define M_2_SQRTPIl M_2_SQRTPIf128
+#define M_SQRT2l M_SQRT2f128
+#define M_SQRT1_2l M_SQRT1_2f128
+
+
+#include <libm-alias-ldouble.h>
+#include <libm-alias-float128.h>
+#undef libm_alias_ldouble_r
+#define libm_alias_ldouble_r(from, to, r) libm_alias_float128_r (from, to, r)
+
+
+#include <math/math-narrow.h>
+#undef libm_alias_float_ldouble
+#define libm_alias_float_ldouble(func) libm_alias_float32_float128 (func)
+#undef libm_alias_double_ldouble
+#define libm_alias_double_ldouble(func) libm_alias_float64_float128 (func)
+
+
+/* IEEE function renames. */
+#define __ieee754_acoshl __ieee754_acoshf128
+#define __ieee754_acosl __ieee754_acosf128
+#define __ieee754_asinhl __ieee754_asinhf128
+#define __ieee754_asinl __ieee754_asinf128
+#define __ieee754_atan2l __ieee754_atan2f128
+#define __ieee754_atanhl __ieee754_atanhf128
+#define __ieee754_coshl __ieee754_coshf128
+#define __ieee754_cosl __ieee754_cosf128
+#define __ieee754_exp10l __ieee754_exp10f128
+#define __ieee754_exp2l __ieee754_exp2f128
+#define __ieee754_expl __ieee754_expf128
+#define __ieee754_fmodl __ieee754_fmodf128
+#define __ieee754_gammal_r __ieee754_gammaf128_r
+#define __ieee754_hypotl __ieee754_hypotf128
+#define __ieee754_ilogbl __ieee754_ilogbf128
+#define __ieee754_j0l __ieee754_j0f128
+#define __ieee754_j1l __ieee754_j1f128
+#define __ieee754_jnl __ieee754_jnf128
+#define __ieee754_lgammal_r __ieee754_lgammaf128_r
+#define __ieee754_log10l __ieee754_log10f128
+#define __ieee754_log2l __ieee754_log2f128
+#define __ieee754_logl __ieee754_logf128
+#define __ieee754_powl __ieee754_powf128
+#define __ieee754_rem_pio2l __ieee754_rem_pio2f128
+#define __ieee754_remainderl __ieee754_remainderf128
+#define __ieee754_sinhl __ieee754_sinhf128
+#define __ieee754_sqrtl __ieee754_sqrtf128
+#define __ieee754_y0l __ieee754_y0f128
+#define __ieee754_y1l __ieee754_y1f128
+#define __ieee754_ynl __ieee754_ynf128
+
+
+/* finite math entry points. */
+#define __acoshl_finite __acoshf128_finite
+#define __acosl_finite __acosf128_finite
+#define __asinl_finite __asinf128_finite
+#define __atan2l_finite __atan2f128_finite
+#define __atanhl_finite __atanhf128_finite
+#define __coshl_finite __coshf128_finite
+#define __cosl_finite __cosf128_finite
+#define __exp10l_finite __exp10f128_finite
+#define __exp2l_finite __exp2f128_finite
+#define __expl_finite __expf128_finite
+#define __fmodl_finite __fmodf128_finite
+#define __hypotl_finite __hypotf128_finite
+#define __ilogbl_finite __ilogbf128_finite
+#define __j0l_finite __j0f128_finite
+#define __j1l_finite __j1f128_finite
+#define __jnl_finite __jnf128_finite
+#define __lgammal_r_finite __lgammaf128_r_finite
+#define __log10l_finite __log10f128_finite
+#define __log2l_finite __log2f128_finite
+#define __logl_finite __logf128_finite
+#define __powl_finite __powf128_finite
+#define __remainderl_finite __remainderf128_finite
+#define __sinhl_finite __sinhf128_finite
+#define __y0l_finite __y0f128_finite
+#define __y1l_finite __y1f128_finite
+#define __ynl_finite __ynf128_finite
+
+
+/* internal function names. */
+#define __asinhl __asinhf128
+#define __atanl __atanf128
+#define __cbrtl __cbrtf128
+#define __ceill __ceilf128
+#define __copysignl __copysignf128
+#define __cosl __cosf128
+#define __erfcl __erfcf128
+#define __erfl __erff128
+#define __expl __expf128
+#define __expm1l __expm1f128
+#define __fabsl __fabsf128
+#define __fdiml __fdimf128
+#define __finitel __finitef128
+#define __floorl __floorf128
+#define __fmal __fmaf128
+#define __fmaxl __fmaxf128
+#define __fminl __fminf128
+#define __fpclassifyl __fpclassifyf128
+#define __frexpl __frexpf128
+#define __gammal_r_finite __gammaf128_r_finite
+#define __getpayloadl __getpayloadf128
+#define __isinfl __isinff128
+#define __isnanl __isnanf128
+#define __issignalingl __issignalingf128
+#define __ldexpl __ldexpf128
+#define __llrintl __llrintf128
+#define __llroundl __llroundf128
+#define __log1pl __log1pf128
+#define __logbl __logbf128
+#define __logl __logf128
+#define __lrintl __lrintf128
+#define __lroundl __lroundf128
+#define __modfl __modff128
+#define __nearbyintl __nearbyintf128
+#define __nextafterl __nextafterf128
+#define __nextdownl __nextdownf128
+#define __nextupl __nextupf128
+#define __remquol __remquof128
+#define __rintl __rintf128
+#define __roundevenl __roundevenf128
+#define __roundl __roundf128
+#define __scalblnl __scalblnf128
+#define __scalbnl __scalbnf128
+#define __signbitl __signbitf128
+#define __sincosl __sincosf128
+#define __sinl __sinf128
+#define __sqrtl __sqrtf128
+#define __tanhl __tanhf128
+#define __tanl __tanf128
+#define __totalorderl __totalorderf128
+#define __totalordermagl __totalordermagf128
+#define __truncl __truncf128
+#define __x2y2m1l __x2y2m1f128
+
+#define __faddl __f32addf128
+#define __daddl __f64addf128
+#define __fdivl __f32divf128
+#define __ddivl __f64divf128
+#define __fmull __f32mulf128
+#define __dmull __f64mulf128
+#define __fsubl __f32subf128
+#define __dsubl __f64subf128
+
+/* __nexttowardf128 is not _Float128 API. */
+#define __nexttowardl __nexttowardf128_do_not_use
+#define nexttowardl nexttowardf128_do_not_use
+
+
+/* public entry points. */
+#define asinhl asinhf128
+#define atanl atanf128
+#define cbrtl cbrtf128
+#define ceill ceilf128
+#define copysignl copysignf128
+#define cosl cosf128
+#define erfcl erfcf128
+#define erfl erff128
+#define expl expf128
+#define expm1l expm1f128
+#define fabsl fabsf128
+#define fdiml fdimf128
+#define finitel finitef128_do_not_use
+#define floorl floorf128
+#define fmal fmaf128
+#define fmaxl fmaxf128
+#define fminl fminf128
+#define frexpl frexpf128
+#define getpayloadl getpayloadf128
+#define isinfl isinff128_do_not_use
+#define isnanl isnanf128_do_not_use
+#define ldexpl ldexpf128
+#define llrintl llrintf128
+#define llroundl llroundf128
+#define log1pl log1pf128
+#define logbl logbf128
+#define logl logf128
+#define lrintl lrintf128
+#define lroundl lroundf128
+#define modfl modff128
+#define nanl nanf128
+#define nearbyintl nearbyintf128
+#define nextafterl nextafterf128
+#define nextdownl nextdownf128
+#define nextupl nextupf128
+#define remquol remquof128
+#define rintl rintf128
+#define roundevenl roundevenf128
+#define roundl roundf128
+#define scalbnl scalbnf128
+#define sincosl sincosf128
+#define sinl sinf128
+#define sqrtl sqrtf128
+#define tanhl tanhf128
+#define tanl tanf128
+#define totalorderl totalorderf128
+#define totalordermagl totalordermagf128
+#define truncl truncf128
+
+
+/* misc internal renames. */
+#define __builtin_fmal __builtin_fmaf128
+#define __expl_table __expf128_table
+#define __gamma_productl __gamma_productf128
+#define __kernel_cosl __kernel_cosf128
+#define __kernel_rem_pio2l __kernel_rem_pio2f128
+#define __kernel_sincosl __kernel_sincosf128
+#define __kernel_sinl __kernel_sinf128
+#define __kernel_tanl __kernel_tanf128
+#define __lgamma_negl __lgamma_negf128
+#define __lgamma_productl __lgamma_productf128
+#define __mpn_extract_long_double __mpn_extract_float128
+#define __sincosl_table __sincosf128_table
+#define mul_splitl mul_splitf128
+
+/* Builtin renames. */
+#define __builtin_copysignl __builtin_copysignf128
+#define __builtin_signbitl __builtin_signbit
+
+/* Get the constant suffix from bits/floatn-compat.h. */
+#define L(x) __f128 (x)
+
+static inline void
+mul_splitf128 (_Float128 *hi, _Float128 *lo, _Float128 x, _Float128 y)
+{
+#ifdef __FP_FAST_FMAF128
+ /* Fast built-in fused multiply-add. */
+ *hi = x * y;
+ *lo = __builtin_fmal (x, y, -*hi);
+#else
+ /* Apply Dekker's algorithm. */
+ *hi = x * y;
+# define C ((1LL << (FLT128_MANT_DIG + 1) / 2) + 1)
+ _Float128 x1 = x * C;
+ _Float128 y1 = y * C;
+# undef C
+ x1 = (x - x1) + x1;
+ y1 = (y - y1) + y1;
+ _Float128 x2 = x - x1;
+ _Float128 y2 = y - y1;
+ *lo = (((x1 * y1 - *hi) + x1 * y2) + x2 * y1) + x2 * y2;
+#endif
+}
diff --git a/sysdeps/ieee754/float128/gamma_productf128.c b/sysdeps/ieee754/float128/gamma_productf128.c
new file mode 100644
index 0000000000..be2271f12f
--- /dev/null
+++ b/sysdeps/ieee754/float128/gamma_productf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/gamma_productl.c"
diff --git a/sysdeps/ieee754/float128/ieee754_float128.h b/sysdeps/ieee754/float128/ieee754_float128.h
new file mode 100644
index 0000000000..ea307eb9e9
--- /dev/null
+++ b/sysdeps/ieee754/float128/ieee754_float128.h
@@ -0,0 +1,140 @@
+/* _Float128 IEEE like macros.
+ Copyright (C) 2017-2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+#ifndef _IEEE754_FLOAT128_H
+#define _IEEE754_FLOAT128_H
+
+#include <endian.h>
+#include <stdint.h>
+
+# if __FLOAT_WORD_ORDER == BIG_ENDIAN
+# define __FLT_EORDER2(t, a, b) t a; t b;
+# define __FLT_EORDER4(t, a, b, c, d) \
+ t a; t b; t c; t d;
+# define __FLT_EORDER6(t, a, b, c, d, e, f) \
+ t a; t b; t c; t d; t e; t f;
+# define __FLT_EORDER7(t, a, b, c, d, e, f, g) \
+ t a; t b; t c; t d; t e; t f; t g;
+# else
+# define __FLT_EORDER2(t, a, b) \
+ t b; t a;
+# define __FLT_EORDER4(t, a, b, c, d) \
+ t d; t c; t b; t a;
+# define __FLT_EORDER6(t, a, b, c, d, e, f) \
+ t f; t e; t d; t c; t b; t a;
+# define __FLT_EORDER7(t, a, b, c, d, e, f, g) \
+ t g; t f; t e; t d; t c; t b; t a;
+# endif
+
+/* A union which permits us to convert between _Float128 and
+ four 32 bit ints or two 64 bit ints. */
+
+typedef union
+{
+ _Float128 value;
+ struct
+ {
+ __FLT_EORDER2 (uint64_t, msw, lsw);
+ } parts64;
+ struct
+ {
+ __FLT_EORDER4 (uint32_t, w0, w1, w2, w3);
+ } parts32;
+} ieee854_float128_shape_type;
+
+/* Get two 64 bit ints from a _Float128. */
+
+# define GET_FLOAT128_WORDS64(ix0,ix1,d) \
+do { \
+ ieee854_float128_shape_type qw_u; \
+ qw_u.value = (d); \
+ (ix0) = qw_u.parts64.msw; \
+ (ix1) = qw_u.parts64.lsw; \
+} while (0)
+
+/* Set a _Float128 from two 64 bit ints. */
+
+# define SET_FLOAT128_WORDS64(d,ix0,ix1) \
+do { \
+ ieee854_float128_shape_type qw_u; \
+ qw_u.parts64.msw = (ix0); \
+ qw_u.parts64.lsw = (ix1); \
+ (d) = qw_u.value; \
+} while (0)
+
+/* Get the more significant 64 bits of a _Float128 mantissa. */
+
+# define GET_FLOAT128_MSW64(v,d) \
+do { \
+ ieee854_float128_shape_type sh_u; \
+ sh_u.value = (d); \
+ (v) = sh_u.parts64.msw; \
+} while (0)
+
+/* Set the more significant 64 bits of a _Float128 mantissa from an int. */
+
+# define SET_FLOAT128_MSW64(d,v) \
+do { \
+ ieee854_float128_shape_type sh_u; \
+ sh_u.value = (d); \
+ sh_u.parts64.msw = (v); \
+ (d) = sh_u.value; \
+} while (0)
+
+/* Get the least significant 64 bits of a _Float128 mantissa. */
+
+# define GET_FLOAT128_LSW64(v,d) \
+do { \
+ ieee854_float128_shape_type sh_u; \
+ sh_u.value = (d); \
+ (v) = sh_u.parts64.lsw; \
+} while (0)
+
+/* Likewise, some helper macros which are exposed via ieee754.h for
+ C99 real types, but not _Float128. */
+
+union ieee854_float128
+ {
+ _Float128 d;
+
+ /* This is the IEEE 854 quad-precision format. */
+ struct
+ {
+ __FLT_EORDER6 (unsigned int, negative:1,
+ exponent:15,
+ mantissa0:16,
+ mantissa1:32,
+ mantissa2:32,
+ mantissa3:32)
+ } ieee;
+
+ /* This format makes it easier to see if a NaN is a signalling NaN. */
+ struct
+ {
+ __FLT_EORDER7 (unsigned int, negative:1,
+ exponent:15,
+ quiet_nan:1,
+ mantissa0:15,
+ mantissa1:32,
+ mantissa2:32,
+ mantissa3:32)
+ } ieee_nan;
+ };
+
+#define IEEE854_FLOAT128_BIAS 0x3fff /* Added to exponent. */
+
+#endif
diff --git a/sysdeps/ieee754/float128/k_cosf128.c b/sysdeps/ieee754/float128/k_cosf128.c
new file mode 100644
index 0000000000..9db0906e9a
--- /dev/null
+++ b/sysdeps/ieee754/float128/k_cosf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/k_cosl.c"
diff --git a/sysdeps/ieee754/float128/k_sincosf128.c b/sysdeps/ieee754/float128/k_sincosf128.c
new file mode 100644
index 0000000000..14c0f1eccf
--- /dev/null
+++ b/sysdeps/ieee754/float128/k_sincosf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/k_sincosl.c"
diff --git a/sysdeps/ieee754/float128/k_sinf128.c b/sysdeps/ieee754/float128/k_sinf128.c
new file mode 100644
index 0000000000..f3acf1cfe1
--- /dev/null
+++ b/sysdeps/ieee754/float128/k_sinf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/k_sinl.c"
diff --git a/sysdeps/ieee754/float128/k_tanf128.c b/sysdeps/ieee754/float128/k_tanf128.c
new file mode 100644
index 0000000000..ca6be539f7
--- /dev/null
+++ b/sysdeps/ieee754/float128/k_tanf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/k_tanl.c"
diff --git a/sysdeps/ieee754/float128/lgamma_negf128.c b/sysdeps/ieee754/float128/lgamma_negf128.c
new file mode 100644
index 0000000000..9c16f93025
--- /dev/null
+++ b/sysdeps/ieee754/float128/lgamma_negf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/lgamma_negl.c"
diff --git a/sysdeps/ieee754/float128/lgamma_productf128.c b/sysdeps/ieee754/float128/lgamma_productf128.c
new file mode 100644
index 0000000000..5efe5dd576
--- /dev/null
+++ b/sysdeps/ieee754/float128/lgamma_productf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/lgamma_productl.c"
diff --git a/sysdeps/ieee754/float128/math-nan-payload-float128.h b/sysdeps/ieee754/float128/math-nan-payload-float128.h
new file mode 100644
index 0000000000..95ab953596
--- /dev/null
+++ b/sysdeps/ieee754/float128/math-nan-payload-float128.h
@@ -0,0 +1,34 @@
+/* NaN payload handling for _Float128.
+ Copyright (C) 2017-2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <ieee754_float128.h>
+
+#define SET_NAN_PAYLOAD(flt, mant) \
+ do \
+ { \
+ union ieee854_float128 u; \
+ u.d = (flt); \
+ u.ieee_nan.mantissa0 = 0; \
+ u.ieee_nan.mantissa1 = 0; \
+ u.ieee_nan.mantissa2 = (mant) >> 32; \
+ u.ieee_nan.mantissa3 = (mant); \
+ if ((u.ieee.mantissa0 | u.ieee.mantissa1 \
+ | u.ieee.mantissa2 | u.ieee.mantissa3) != 0) \
+ (flt) = u.d; \
+ } \
+ while (0)
diff --git a/sysdeps/ieee754/float128/mpn2float128.c b/sysdeps/ieee754/float128/mpn2float128.c
new file mode 100644
index 0000000000..1360abc5c0
--- /dev/null
+++ b/sysdeps/ieee754/float128/mpn2float128.c
@@ -0,0 +1,54 @@
+/* Convert a number in multi-precision format to _Float128.
+ Copyright (C) 2017-2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include "gmp.h"
+#include "gmp-impl.h"
+#include <float.h>
+#include <math.h>
+
+#include "ieee754_float128.h"
+
+/* Convert a multi-precision integer of the needed number of bits (113 for
+ binary128) and an integral power of two to a `_Float128' in IEEE854
+ quad-precision format. */
+
+_Float128
+__mpn_construct_float128 (mp_srcptr frac_ptr, int expt, int sign)
+{
+ union ieee854_float128 u;
+
+ u.ieee.negative = sign;
+ u.ieee.exponent = expt + IEEE854_FLOAT128_BIAS;
+#if BITS_PER_MP_LIMB == 32
+ u.ieee.mantissa3 = frac_ptr[0];
+ u.ieee.mantissa2 = frac_ptr[1];
+ u.ieee.mantissa1 = frac_ptr[2];
+ u.ieee.mantissa0 = frac_ptr[3] & (((mp_limb_t) 1
+ << (FLT128_MANT_DIG - 96)) - 1);
+#elif BITS_PER_MP_LIMB == 64
+ u.ieee.mantissa3 = frac_ptr[0] & (((mp_limb_t) 1 << 32) - 1);
+ u.ieee.mantissa2 = frac_ptr[0] >> 32;
+ u.ieee.mantissa1 = frac_ptr[1] & (((mp_limb_t) 1 << 32) - 1);
+ u.ieee.mantissa0 = (frac_ptr[1] >> 32) & (((mp_limb_t) 1
+ << (FLT128_MANT_DIG - 96)) - 1);
+#else
+ #error "mp_limb size " BITS_PER_MP_LIMB "not accounted for"
+#endif
+
+ return u.d;
+}
diff --git a/sysdeps/ieee754/float128/s_asinhf128.c b/sysdeps/ieee754/float128/s_asinhf128.c
new file mode 100644
index 0000000000..7b93d8cf3a
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_asinhf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/s_asinhl.c"
diff --git a/sysdeps/ieee754/float128/s_atanf128.c b/sysdeps/ieee754/float128/s_atanf128.c
new file mode 100644
index 0000000000..9b4d7ecec3
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_atanf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/s_atanl.c"
diff --git a/sysdeps/ieee754/float128/s_cbrtf128.c b/sysdeps/ieee754/float128/s_cbrtf128.c
new file mode 100644
index 0000000000..3bd5797373
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_cbrtf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/s_cbrtl.c"
diff --git a/sysdeps/ieee754/float128/s_ceilf128.c b/sysdeps/ieee754/float128/s_ceilf128.c
new file mode 100644
index 0000000000..0af15f5f03
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_ceilf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/s_ceill.c"
diff --git a/sysdeps/ieee754/float128/s_copysignf128.c b/sysdeps/ieee754/float128/s_copysignf128.c
new file mode 100644
index 0000000000..808f7abbc0
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_copysignf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/s_copysignl.c"
diff --git a/sysdeps/ieee754/float128/s_cosf128.c b/sysdeps/ieee754/float128/s_cosf128.c
new file mode 100644
index 0000000000..8ba552695c
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_cosf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/s_cosl.c"
diff --git a/sysdeps/ieee754/float128/s_erff128.c b/sysdeps/ieee754/float128/s_erff128.c
new file mode 100644
index 0000000000..ac16ad6665
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_erff128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/s_erfl.c"
diff --git a/sysdeps/ieee754/float128/s_expm1f128.c b/sysdeps/ieee754/float128/s_expm1f128.c
new file mode 100644
index 0000000000..ea28d89db4
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_expm1f128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/s_expm1l.c"
diff --git a/sysdeps/ieee754/float128/s_f32addf128.c b/sysdeps/ieee754/float128/s_f32addf128.c
new file mode 100644
index 0000000000..e2f8ded401
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_f32addf128.c
@@ -0,0 +1,6 @@
+#define f32addf64x __hide_f32addf64x
+#define f32addf128 __hide_f32addf128
+#include <float128_private.h>
+#undef f32addf64x
+#undef f32addf128
+#include "../ldbl-128/s_faddl.c"
diff --git a/sysdeps/ieee754/float128/s_f32divf128.c b/sysdeps/ieee754/float128/s_f32divf128.c
new file mode 100644
index 0000000000..de8d252e80
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_f32divf128.c
@@ -0,0 +1,6 @@
+#define f32divf64x __hide_f32divf64x
+#define f32divf128 __hide_f32divf128
+#include <float128_private.h>
+#undef f32divf64x
+#undef f32divf128
+#include "../ldbl-128/s_fdivl.c"
diff --git a/sysdeps/ieee754/float128/s_f32mulf128.c b/sysdeps/ieee754/float128/s_f32mulf128.c
new file mode 100644
index 0000000000..45fdc66ba6
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_f32mulf128.c
@@ -0,0 +1,6 @@
+#define f32mulf64x __hide_f32mulf64x
+#define f32mulf128 __hide_f32mulf128
+#include <float128_private.h>
+#undef f32mulf64x
+#undef f32mulf128
+#include "../ldbl-128/s_fmull.c"
diff --git a/sysdeps/ieee754/float128/s_f32subf128.c b/sysdeps/ieee754/float128/s_f32subf128.c
new file mode 100644
index 0000000000..f1373f68ac
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_f32subf128.c
@@ -0,0 +1,6 @@
+#define f32subf64x __hide_f32subf64x
+#define f32subf128 __hide_f32subf128
+#include <float128_private.h>
+#undef f32subf64x
+#undef f32subf128
+#include "../ldbl-128/s_fsubl.c"
diff --git a/sysdeps/ieee754/float128/s_f64addf128.c b/sysdeps/ieee754/float128/s_f64addf128.c
new file mode 100644
index 0000000000..c2bb293399
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_f64addf128.c
@@ -0,0 +1,10 @@
+#define f32xaddf64x __hide_f32xaddf64x
+#define f32xaddf128 __hide_f32xaddf128
+#define f64addf64x __hide_f64addf64x
+#define f64addf128 __hide_f64addf128
+#include <float128_private.h>
+#undef f32xaddf64x
+#undef f32xaddf128
+#undef f64addf64x
+#undef f64addf128
+#include "../ldbl-128/s_daddl.c"
diff --git a/sysdeps/ieee754/float128/s_f64divf128.c b/sysdeps/ieee754/float128/s_f64divf128.c
new file mode 100644
index 0000000000..ea37e8bcaf
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_f64divf128.c
@@ -0,0 +1,10 @@
+#define f32xdivf64x __hide_f32xdivf64x
+#define f32xdivf128 __hide_f32xdivf128
+#define f64divf64x __hide_f64divf64x
+#define f64divf128 __hide_f64divf128
+#include <float128_private.h>
+#undef f32xdivf64x
+#undef f32xdivf128
+#undef f64divf64x
+#undef f64divf128
+#include "../ldbl-128/s_ddivl.c"
diff --git a/sysdeps/ieee754/float128/s_f64mulf128.c b/sysdeps/ieee754/float128/s_f64mulf128.c
new file mode 100644
index 0000000000..47a645ac4d
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_f64mulf128.c
@@ -0,0 +1,10 @@
+#define f32xmulf64x __hide_f32xmulf64x
+#define f32xmulf128 __hide_f32xmulf128
+#define f64mulf64x __hide_f64mulf64x
+#define f64mulf128 __hide_f64mulf128
+#include <float128_private.h>
+#undef f32xmulf64x
+#undef f32xmulf128
+#undef f64mulf64x
+#undef f64mulf128
+#include "../ldbl-128/s_dmull.c"
diff --git a/sysdeps/ieee754/float128/s_f64subf128.c b/sysdeps/ieee754/float128/s_f64subf128.c
new file mode 100644
index 0000000000..89ef5a7cc6
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_f64subf128.c
@@ -0,0 +1,10 @@
+#define f32xsubf64x __hide_f32xsubf64x
+#define f32xsubf128 __hide_f32xsubf128
+#define f64subf64x __hide_f64subf64x
+#define f64subf128 __hide_f64subf128
+#include <float128_private.h>
+#undef f32xsubf64x
+#undef f32xsubf128
+#undef f64subf64x
+#undef f64subf128
+#include "../ldbl-128/s_dsubl.c"
diff --git a/sysdeps/ieee754/float128/s_f64xaddf128.c b/sysdeps/ieee754/float128/s_f64xaddf128.c
new file mode 100644
index 0000000000..c8af0a5dff
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_f64xaddf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/s_f64xaddf128.c"
diff --git a/sysdeps/ieee754/float128/s_f64xdivf128.c b/sysdeps/ieee754/float128/s_f64xdivf128.c
new file mode 100644
index 0000000000..55cc953ba6
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_f64xdivf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/s_f64xdivf128.c"
diff --git a/sysdeps/ieee754/float128/s_f64xmulf128.c b/sysdeps/ieee754/float128/s_f64xmulf128.c
new file mode 100644
index 0000000000..085bf9fe4e
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_f64xmulf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/s_f64xmulf128.c"
diff --git a/sysdeps/ieee754/float128/s_f64xsubf128.c b/sysdeps/ieee754/float128/s_f64xsubf128.c
new file mode 100644
index 0000000000..64a0d6d82c
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_f64xsubf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/s_f64xsubf128.c"
diff --git a/sysdeps/ieee754/float128/s_fabsf128.c b/sysdeps/ieee754/float128/s_fabsf128.c
new file mode 100644
index 0000000000..79ba47c3fd
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_fabsf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/s_fabsl.c"
diff --git a/sysdeps/ieee754/float128/s_finitef128.c b/sysdeps/ieee754/float128/s_finitef128.c
new file mode 100644
index 0000000000..801de88e32
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_finitef128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/s_finitel.c"
diff --git a/sysdeps/ieee754/float128/s_floorf128.c b/sysdeps/ieee754/float128/s_floorf128.c
new file mode 100644
index 0000000000..18298436a1
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_floorf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/s_floorl.c"
diff --git a/sysdeps/ieee754/float128/s_fmaf128.c b/sysdeps/ieee754/float128/s_fmaf128.c
new file mode 100644
index 0000000000..6497895c8d
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_fmaf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/s_fmal.c"
diff --git a/sysdeps/ieee754/float128/s_fpclassifyf128.c b/sysdeps/ieee754/float128/s_fpclassifyf128.c
new file mode 100644
index 0000000000..15131dc4a2
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_fpclassifyf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/s_fpclassifyl.c"
diff --git a/sysdeps/ieee754/float128/s_frexpf128.c b/sysdeps/ieee754/float128/s_frexpf128.c
new file mode 100644
index 0000000000..7b040b3e33
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_frexpf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/s_frexpl.c"
diff --git a/sysdeps/ieee754/float128/s_fromfpf128.c b/sysdeps/ieee754/float128/s_fromfpf128.c
new file mode 100644
index 0000000000..86adf3821e
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_fromfpf128.c
@@ -0,0 +1,6 @@
+#define UNSIGNED 0
+#define INEXACT 0
+#define FUNC __fromfpf128
+#include <float128_private.h>
+#include "../ldbl-128/s_fromfpl_main.c"
+libm_alias_float128 (__fromfp, fromfp)
diff --git a/sysdeps/ieee754/float128/s_fromfpxf128.c b/sysdeps/ieee754/float128/s_fromfpxf128.c
new file mode 100644
index 0000000000..c56422381f
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_fromfpxf128.c
@@ -0,0 +1,6 @@
+#define UNSIGNED 0
+#define INEXACT 1
+#define FUNC __fromfpxf128
+#include <float128_private.h>
+#include "../ldbl-128/s_fromfpl_main.c"
+libm_alias_float128 (__fromfpx, fromfpx)
diff --git a/sysdeps/ieee754/float128/s_getpayloadf128.c b/sysdeps/ieee754/float128/s_getpayloadf128.c
new file mode 100644
index 0000000000..2e2607a81b
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_getpayloadf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/s_getpayloadl.c"
diff --git a/sysdeps/ieee754/float128/s_isinff128.c b/sysdeps/ieee754/float128/s_isinff128.c
new file mode 100644
index 0000000000..62cc424b16
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_isinff128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/s_isinfl.c"
diff --git a/sysdeps/ieee754/float128/s_isnanf128.c b/sysdeps/ieee754/float128/s_isnanf128.c
new file mode 100644
index 0000000000..efba24059a
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_isnanf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/s_isnanl.c"
diff --git a/sysdeps/ieee754/float128/s_issignalingf128.c b/sysdeps/ieee754/float128/s_issignalingf128.c
new file mode 100644
index 0000000000..1d4599544f
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_issignalingf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/s_issignalingl.c"
diff --git a/sysdeps/ieee754/float128/s_llrintf128.c b/sysdeps/ieee754/float128/s_llrintf128.c
new file mode 100644
index 0000000000..bb9ca580cd
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_llrintf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/s_llrintl.c"
diff --git a/sysdeps/ieee754/float128/s_llroundf128.c b/sysdeps/ieee754/float128/s_llroundf128.c
new file mode 100644
index 0000000000..be54a90608
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_llroundf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/s_llroundl.c"
diff --git a/sysdeps/ieee754/float128/s_log1pf128.c b/sysdeps/ieee754/float128/s_log1pf128.c
new file mode 100644
index 0000000000..48bb84f987
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_log1pf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/s_log1pl.c"
diff --git a/sysdeps/ieee754/float128/s_logbf128.c b/sysdeps/ieee754/float128/s_logbf128.c
new file mode 100644
index 0000000000..167384a8d4
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_logbf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/s_logbl.c"
diff --git a/sysdeps/ieee754/float128/s_lrintf128.c b/sysdeps/ieee754/float128/s_lrintf128.c
new file mode 100644
index 0000000000..1cfa9d7ca4
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_lrintf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/s_lrintl.c"
diff --git a/sysdeps/ieee754/float128/s_lroundf128.c b/sysdeps/ieee754/float128/s_lroundf128.c
new file mode 100644
index 0000000000..13ba9f220d
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_lroundf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/s_lroundl.c"
diff --git a/sysdeps/ieee754/float128/s_modff128.c b/sysdeps/ieee754/float128/s_modff128.c
new file mode 100644
index 0000000000..4618c6c380
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_modff128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/s_modfl.c"
diff --git a/sysdeps/ieee754/float128/s_nearbyintf128.c b/sysdeps/ieee754/float128/s_nearbyintf128.c
new file mode 100644
index 0000000000..e61a3b3bfb
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_nearbyintf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/s_nearbyintl.c"
diff --git a/sysdeps/ieee754/float128/s_nextafterf128.c b/sysdeps/ieee754/float128/s_nextafterf128.c
new file mode 100644
index 0000000000..2c43a00384
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_nextafterf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/s_nextafterl.c"
diff --git a/sysdeps/ieee754/float128/s_nexttowardf128.c b/sysdeps/ieee754/float128/s_nexttowardf128.c
new file mode 100644
index 0000000000..006e4c98b1
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_nexttowardf128.c
@@ -0,0 +1 @@
+/* This function does not exist for _FloatN types. */
diff --git a/sysdeps/ieee754/float128/s_nextupf128.c b/sysdeps/ieee754/float128/s_nextupf128.c
new file mode 100644
index 0000000000..7d5d0b8c72
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_nextupf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/s_nextupl.c"
diff --git a/sysdeps/ieee754/float128/s_remquof128.c b/sysdeps/ieee754/float128/s_remquof128.c
new file mode 100644
index 0000000000..1cef61ab1b
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_remquof128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/s_remquol.c"
diff --git a/sysdeps/ieee754/float128/s_rintf128.c b/sysdeps/ieee754/float128/s_rintf128.c
new file mode 100644
index 0000000000..2adb95f360
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_rintf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/s_rintl.c"
diff --git a/sysdeps/ieee754/float128/s_roundevenf128.c b/sysdeps/ieee754/float128/s_roundevenf128.c
new file mode 100644
index 0000000000..5a9b3f395f
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_roundevenf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/s_roundevenl.c"
diff --git a/sysdeps/ieee754/float128/s_roundf128.c b/sysdeps/ieee754/float128/s_roundf128.c
new file mode 100644
index 0000000000..1eb36f2a5e
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_roundf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/s_roundl.c"
diff --git a/sysdeps/ieee754/float128/s_scalblnf128.c b/sysdeps/ieee754/float128/s_scalblnf128.c
new file mode 100644
index 0000000000..999223c517
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_scalblnf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/s_scalblnl.c"
diff --git a/sysdeps/ieee754/float128/s_scalbnf128.c b/sysdeps/ieee754/float128/s_scalbnf128.c
new file mode 100644
index 0000000000..0e7ab2663b
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_scalbnf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/s_scalbnl.c"
diff --git a/sysdeps/ieee754/float128/s_setpayloadf128.c b/sysdeps/ieee754/float128/s_setpayloadf128.c
new file mode 100644
index 0000000000..65f0961fc7
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_setpayloadf128.c
@@ -0,0 +1,5 @@
+#include <float128_private.h>
+#define SIG 0
+#define FUNC __setpayloadf128
+#include "../ldbl-128/s_setpayloadl_main.c"
+libm_alias_float128 (__setpayload, setpayload)
diff --git a/sysdeps/ieee754/float128/s_setpayloadsigf128.c b/sysdeps/ieee754/float128/s_setpayloadsigf128.c
new file mode 100644
index 0000000000..bd3ffb6775
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_setpayloadsigf128.c
@@ -0,0 +1,5 @@
+#include <float128_private.h>
+#define SIG 1
+#define FUNC __setpayloadsigf128
+#include "../ldbl-128/s_setpayloadl_main.c"
+libm_alias_float128 (__setpayloadsig, setpayloadsig)
diff --git a/sysdeps/ieee754/float128/s_signbitf128.c b/sysdeps/ieee754/float128/s_signbitf128.c
new file mode 100644
index 0000000000..559df3b56c
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_signbitf128.c
@@ -0,0 +1,37 @@
+/* Return nonzero value if number is negative.
+ Copyright (C) 2017-2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <float128_private.h>
+#include <math.h>
+#include <math_private.h>
+
+/* Once GCC >= 6.0 is required for building glibc, this implementation can
+ be removed and replaced with an inclusion of ldbl-128/s_signbitl.c. */
+int
+__signbitf128 (_Float128 x)
+{
+#if __GNUC_PREREQ (6, 0)
+ return __builtin_signbit (x);
+#else
+ int64_t e;
+
+ GET_FLOAT128_MSW64 (e, x);
+ return e < 0;
+#endif
+}
+hidden_def (__signbitf128)
diff --git a/sysdeps/ieee754/float128/s_significandf128.c b/sysdeps/ieee754/float128/s_significandf128.c
new file mode 100644
index 0000000000..067b724164
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_significandf128.c
@@ -0,0 +1 @@
+/* Not defined for _FloatN types. */
diff --git a/sysdeps/ieee754/float128/s_sincosf128.c b/sysdeps/ieee754/float128/s_sincosf128.c
new file mode 100644
index 0000000000..472adde17f
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_sincosf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/s_sincosl.c"
diff --git a/sysdeps/ieee754/float128/s_sinf128.c b/sysdeps/ieee754/float128/s_sinf128.c
new file mode 100644
index 0000000000..d79a1163a5
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_sinf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/s_sinl.c"
diff --git a/sysdeps/ieee754/float128/s_tanf128.c b/sysdeps/ieee754/float128/s_tanf128.c
new file mode 100644
index 0000000000..382961aada
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_tanf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/s_tanl.c"
diff --git a/sysdeps/ieee754/float128/s_tanhf128.c b/sysdeps/ieee754/float128/s_tanhf128.c
new file mode 100644
index 0000000000..e02c9a6005
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_tanhf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/s_tanhl.c"
diff --git a/sysdeps/ieee754/float128/s_totalorderf128.c b/sysdeps/ieee754/float128/s_totalorderf128.c
new file mode 100644
index 0000000000..1b115d8307
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_totalorderf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/s_totalorderl.c"
diff --git a/sysdeps/ieee754/float128/s_totalordermagf128.c b/sysdeps/ieee754/float128/s_totalordermagf128.c
new file mode 100644
index 0000000000..e44c657275
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_totalordermagf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/s_totalordermagl.c"
diff --git a/sysdeps/ieee754/float128/s_truncf128.c b/sysdeps/ieee754/float128/s_truncf128.c
new file mode 100644
index 0000000000..474d9dc77e
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_truncf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/s_truncl.c"
diff --git a/sysdeps/ieee754/float128/s_ufromfpf128.c b/sysdeps/ieee754/float128/s_ufromfpf128.c
new file mode 100644
index 0000000000..0e6521f587
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_ufromfpf128.c
@@ -0,0 +1,6 @@
+#define UNSIGNED 1
+#define INEXACT 0
+#define FUNC __ufromfpf128
+#include <float128_private.h>
+#include "../ldbl-128/s_fromfpl_main.c"
+libm_alias_float128 (__ufromfp, ufromfp)
diff --git a/sysdeps/ieee754/float128/s_ufromfpxf128.c b/sysdeps/ieee754/float128/s_ufromfpxf128.c
new file mode 100644
index 0000000000..cd192b73bf
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_ufromfpxf128.c
@@ -0,0 +1,6 @@
+#define UNSIGNED 1
+#define INEXACT 1
+#define FUNC __ufromfpxf128
+#include <float128_private.h>
+#include "../ldbl-128/s_fromfpl_main.c"
+libm_alias_float128 (__ufromfpx, ufromfpx)
diff --git a/sysdeps/ieee754/float128/strfromf128.c b/sysdeps/ieee754/float128/strfromf128.c
new file mode 100644
index 0000000000..bdc540aa71
--- /dev/null
+++ b/sysdeps/ieee754/float128/strfromf128.c
@@ -0,0 +1,36 @@
+/* Definitions for strfromf128. Implementation in stdlib/strfrom-skeleton.c.
+
+ Copyright (C) 2017-2018 Free Software Foundation, Inc.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <bits/floatn.h>
+
+#define FLOAT _Float128
+#define STRFROM strfromf128
+
+#if __HAVE_FLOAT64X && !__HAVE_FLOAT64X_LONG_DOUBLE
+# define strfromf64x __hide_strfromf64x
+# include <stdlib.h>
+# undef strfromf64x
+#endif
+
+#include <float128_private.h>
+
+#include <stdlib/strfrom-skeleton.c>
+
+#if __HAVE_FLOAT64X && !__HAVE_FLOAT64X_LONG_DOUBLE
+weak_alias (strfromf128, strfromf64x)
+#endif
diff --git a/sysdeps/ieee754/float128/strtof128.c b/sysdeps/ieee754/float128/strtof128.c
new file mode 100644
index 0000000000..b7265b125a
--- /dev/null
+++ b/sysdeps/ieee754/float128/strtof128.c
@@ -0,0 +1,51 @@
+/* strtof128 wrapper of strtof128_l.
+ Copyright (C) 2017-2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+/* The actual implementation for all floating point sizes is in strtod.c.
+ These macros tell it to produce the `_Float128' version, `strtof128'. */
+
+#include <bits/floatn.h>
+
+#if __HAVE_FLOAT64X && !__HAVE_FLOAT64X_LONG_DOUBLE
+# define strtof64x __hide_strtof64x
+# define wcstof64x __hide_wcstof64x
+#endif
+
+#define FLOAT _Float128
+#define FLT FLT128
+#ifdef USE_WIDE_CHAR
+# define STRTOF wcstof128
+# define STRTOF_L __wcstof128_l
+#else
+# define STRTOF strtof128
+# define STRTOF_L __strtof128_l
+#endif
+
+#include <float128_private.h>
+
+#include <stdlib/strtod.c>
+
+#if __HAVE_FLOAT64X && !__HAVE_FLOAT64X_LONG_DOUBLE
+# undef strtof64x
+# undef wcstof64x
+# ifdef USE_WIDE_CHAR
+weak_alias (wcstof128, wcstof64x)
+# else
+weak_alias (strtof128, strtof64x)
+# endif
+#endif
diff --git a/sysdeps/ieee754/float128/strtof128_l.c b/sysdeps/ieee754/float128/strtof128_l.c
new file mode 100644
index 0000000000..eff0c97d46
--- /dev/null
+++ b/sysdeps/ieee754/float128/strtof128_l.c
@@ -0,0 +1,58 @@
+/* Convert string representing a number to a _Float128 value, with locale.
+ Copyright (C) 2017-2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <bits/types/locale_t.h>
+
+/* Bring in potential typedef for _Float128 early for declaration below. */
+#include <bits/floatn.h>
+
+#if __HAVE_FLOAT64X && !__HAVE_FLOAT64X_LONG_DOUBLE
+# define strtof64x_l __hide_strtof64x_l
+# define wcstof64x_l __hide_wcstof64x_l
+#endif
+
+extern _Float128 ____strtof128_l_internal (const char *, char **,
+ int, locale_t);
+
+#define FLOAT _Float128
+#define FLT FLT128
+#ifdef USE_WIDE_CHAR
+# define STRTOF wcstof128_l
+# define __STRTOF __wcstof128_l
+# define STRTOF_NAN __wcstof128_nan
+#else
+# define STRTOF strtof128_l
+# define __STRTOF __strtof128_l
+# define STRTOF_NAN __strtof128_nan
+#endif
+#define MPN2FLOAT __mpn_construct_float128
+#define FLOAT_HUGE_VAL __builtin_huge_valf128 ()
+
+#include <float128_private.h>
+
+#include <stdlib/strtod_l.c>
+
+#if __HAVE_FLOAT64X && !__HAVE_FLOAT64X_LONG_DOUBLE
+# undef strtof64x_l
+# undef wcstof64x_l
+# ifdef USE_WIDE_CHAR
+weak_alias (wcstof128_l, wcstof64x_l)
+# else
+weak_alias (strtof128_l, strtof64x_l)
+# endif
+#endif
diff --git a/sysdeps/ieee754/float128/strtof128_nan.c b/sysdeps/ieee754/float128/strtof128_nan.c
new file mode 100644
index 0000000000..37a7f4e02e
--- /dev/null
+++ b/sysdeps/ieee754/float128/strtof128_nan.c
@@ -0,0 +1,26 @@
+/* Convert string for NaN payload to corresponding NaN. Narrow
+ strings, __float128.
+ Copyright (C) 2017-2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <math.h>
+
+#include <strtod_nan_narrow.h>
+#include <math-type-macros-float128.h>
+
+#define STRTOD_NAN __strtof128_nan
+#include <stdlib/strtod_nan_main.c>
diff --git a/sysdeps/ieee754/float128/t_sincosf128.c b/sysdeps/ieee754/float128/t_sincosf128.c
new file mode 100644
index 0000000000..7e699d3c8e
--- /dev/null
+++ b/sysdeps/ieee754/float128/t_sincosf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/t_sincosl.c"
diff --git a/sysdeps/ieee754/float128/wcstof128.c b/sysdeps/ieee754/float128/wcstof128.c
new file mode 100644
index 0000000000..4337b9f790
--- /dev/null
+++ b/sysdeps/ieee754/float128/wcstof128.c
@@ -0,0 +1,27 @@
+/* wcstof128 wrapper of wcstof128_l.
+ Copyright (C) 2017-2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <stddef.h>
+#include <bits/types/locale_t.h>
+
+#define USE_WIDE_CHAR 1
+
+/* Bring in _Float128 typedef if needed. */
+#include <bits/floatn.h>
+
+#include "strtof128.c"
diff --git a/sysdeps/ieee754/float128/wcstof128_l.c b/sysdeps/ieee754/float128/wcstof128_l.c
new file mode 100644
index 0000000000..19c3c51184
--- /dev/null
+++ b/sysdeps/ieee754/float128/wcstof128_l.c
@@ -0,0 +1,27 @@
+/* Convert string representing a number to integer value, using given locale.
+ Copyright (C) 2017-2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <stddef.h>
+#include <bits/types/locale_t.h>
+
+
+#define USE_WIDE_CHAR 1
+
+#include <bits/floatn.h>
+
+#include "strtof128_l.c"
diff --git a/sysdeps/ieee754/float128/wcstof128_nan.c b/sysdeps/ieee754/float128/wcstof128_nan.c
new file mode 100644
index 0000000000..f504809dcf
--- /dev/null
+++ b/sysdeps/ieee754/float128/wcstof128_nan.c
@@ -0,0 +1,23 @@
+/* Convert string for NaN payload to corresponding NaN. Wide strings,
+ _Float128.
+ Copyright (C) 2017-2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <stdlib/strtod_nan_wide.h>
+#include <math-type-macros-float128.h>
+#define STRTOD_NAN __wcstof128_nan
+#include <stdlib/strtod_nan_main.c>
diff --git a/sysdeps/ieee754/float128/x2y2m1f128.c b/sysdeps/ieee754/float128/x2y2m1f128.c
new file mode 100644
index 0000000000..68880792e6
--- /dev/null
+++ b/sysdeps/ieee754/float128/x2y2m1f128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/x2y2m1l.c"