* [PATCH 6/8] float128: Expose _Float128 finite math functions.
2016-11-09 18:41 [PATCH 0/8] More float128 declarations Gabriel F. T. Gomes
@ 2016-11-09 18:41 ` Gabriel F. T. Gomes
2016-11-09 22:06 ` Joseph Myers
2016-11-09 18:41 ` [PATCH 4/8] Add support for testing __STDC_WANT_IEC_60559_TYPES_EXT__ Gabriel F. T. Gomes
` (7 subsequent siblings)
8 siblings, 1 reply; 33+ messages in thread
From: Gabriel F. T. Gomes @ 2016-11-09 18:41 UTC (permalink / raw)
To: libc-alpha
From: "Paul E. Murphy" <murphyp@linux.vnet.ibm.com>
Similar to the other types, entry points to
dodge wrapper call for non-finite arguments.
* math/bits/math-finite.h:
(__acosf128_finite): New function declaration.
(__acoshf128_finite): Likewise.
(__asinf128_finite): Likewise.
(__atan2f128_finite): Likewise.
(__atanhf128_finite): Likewise.
(__coshf128_finite): Likewise.
(__expf128_finite): Likewise.
(__exp10f128_finite): Likewise.
(__exp2f128_finite): Likewise.
(__fmodf128_finite): Likewise.
(__hypotf128_finite): Likewise.
(__j0f128_finite): Likewise.
(__y0f128_finite): Likewise.
(__j1f128_finite): Likewise.
(__y1f128_finite): Likewise.
(__jnf128_finite): Likewise.
(__ynf128_finite): Likewise.
(__logf128_finite): Likewise.
(__log10f128_finite): Likewise.
(__log2f128_finite): Likewise.
(__powf128_finite): Likewise.
(__remainderf128_finite): Likewise.
(__sinhf128_finite): Likewise.
(__sqrtf128_finite): Likewise.
(__gammaf128_r_finite): Likewise.
(__lgammaf128_r_finite): Likewise.
(lgammaf128): Inline override of the
same name.
(tgammaf128): Likewise.
---
math/bits/math-finite.h | 104 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 104 insertions(+)
diff --git a/math/bits/math-finite.h b/math/bits/math-finite.h
index adaad0e..0c6e2ff 100644
--- a/math/bits/math-finite.h
+++ b/math/bits/math-finite.h
@@ -32,6 +32,9 @@ extern long double __REDIRECT_NTH (acosl, (long double), __acosl_finite);
# endif
# endif
#endif
+#if __USE_FLOAT128
+extern _Float128 __REDIRECT_NTH (acosf128, (_Float128), __acosf128_finite);
+#endif
#if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
/* acosh. */
@@ -47,6 +50,9 @@ extern long double __REDIRECT_NTH (acoshl, (long double), __acoshl_finite);
# endif
# endif
#endif
+#if __USE_FLOAT128
+extern _Float128 __REDIRECT_NTH (acoshf128, (_Float128), __acoshf128_finite);
+#endif
/* asin. */
extern double __REDIRECT_NTH (asin, (double), __asin_finite);
@@ -60,6 +66,9 @@ extern long double __REDIRECT_NTH (asinl, (long double), __asinl_finite);
# endif
# endif
#endif
+#if __USE_FLOAT128
+extern _Float128 __REDIRECT_NTH (asinf128, (_Float128), __asinf128_finite);
+#endif
/* atan2. */
extern double __REDIRECT_NTH (atan2, (double, double), __atan2_finite);
@@ -75,6 +84,10 @@ extern long double __REDIRECT_NTH (atan2l, (long double, long double),
# endif
# endif
#endif
+#if __USE_FLOAT128
+extern _Float128 __REDIRECT_NTH (atan2f128, (_Float128, _Float128),
+ __atan2f128_finite);
+#endif
#if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
/* atanh. */
@@ -90,6 +103,9 @@ extern long double __REDIRECT_NTH (atanhl, (long double), __atanhl_finite);
# endif
# endif
#endif
+#if __USE_FLOAT128
+extern _Float128 __REDIRECT_NTH (atanhf128, (_Float128), __atanhf128_finite);
+#endif
/* cosh. */
extern double __REDIRECT_NTH (cosh, (double), __cosh_finite);
@@ -103,6 +119,9 @@ extern long double __REDIRECT_NTH (coshl, (long double), __coshl_finite);
# endif
# endif
#endif
+#if __USE_FLOAT128
+extern _Float128 __REDIRECT_NTH (coshf128, (_Float128), __coshf128_finite);
+#endif
/* exp. */
extern double __REDIRECT_NTH (exp, (double), __exp_finite);
@@ -116,6 +135,9 @@ extern long double __REDIRECT_NTH (expl, (long double), __expl_finite);
# endif
# endif
#endif
+#if __USE_FLOAT128
+extern _Float128 __REDIRECT_NTH (expf128, (_Float128), __expf128_finite);
+#endif
#ifdef __USE_GNU
/* exp10. */
@@ -128,6 +150,9 @@ extern long double __REDIRECT_NTH (exp10l, (long double), __exp10_finite);
extern long double __REDIRECT_NTH (exp10l, (long double), __exp10l_finite);
# endif
# endif
+# if __USE_FLOAT128
+extern _Float128 __REDIRECT_NTH (exp10f128, (_Float128), __exp10f128_finite);
+# endif
/* pow10. */
extern double __REDIRECT_NTH (pow10, (double), __exp10_finite);
@@ -153,6 +178,9 @@ extern long double __REDIRECT_NTH (exp2l, (long double), __exp2l_finite);
# endif
# endif
#endif
+# if __USE_FLOAT128
+extern _Float128 __REDIRECT_NTH (exp2f128, (_Float128), __exp2f128_finite);
+# endif
/* fmod. */
extern double __REDIRECT_NTH (fmod, (double, double), __fmod_finite);
@@ -168,6 +196,10 @@ extern long double __REDIRECT_NTH (fmodl, (long double, long double),
# endif
# endif
#endif
+# if __USE_FLOAT128
+extern _Float128 __REDIRECT_NTH (fmodf128, (_Float128, _Float128),
+ __fmodf128_finite);
+# endif
#if defined __USE_XOPEN || defined __USE_ISOC99
/* hypot. */
@@ -185,6 +217,10 @@ extern long double __REDIRECT_NTH (hypotl, (long double, long double),
# endif
# endif
#endif
+#if __USE_FLOAT128
+extern _Float128 __REDIRECT_NTH (hypotf128, (_Float128, _Float128),
+ __hypotf128_finite);
+#endif
#if defined __USE_MISC || defined __USE_XOPEN
/* j0. */
@@ -199,6 +235,9 @@ extern long double __REDIRECT_NTH (j0l, (long double), __j0_finite);
extern long double __REDIRECT_NTH (j0l, (long double), __j0l_finite);
# endif
# endif
+# if __USE_FLOAT128
+extern _Float128 __REDIRECT_NTH (j0f128, (_Float128), __j0f128_finite);
+# endif
#endif
#if defined __USE_MISC || defined __USE_XOPEN
@@ -214,6 +253,9 @@ extern long double __REDIRECT_NTH (y0l, (long double), __y0_finite);
extern long double __REDIRECT_NTH (y0l, (long double), __y0l_finite);
# endif
# endif
+# if __USE_FLOAT128
+extern _Float128 __REDIRECT_NTH (y0f128, (_Float128), __y0f128_finite);
+# endif
#endif
#if defined __USE_MISC || defined __USE_XOPEN
@@ -229,6 +271,9 @@ extern long double __REDIRECT_NTH (j1l, (long double), __j1_finite);
extern long double __REDIRECT_NTH (j1l, (long double), __j1l_finite);
# endif
# endif
+# if __USE_FLOAT128
+extern _Float128 __REDIRECT_NTH (j1f128, (_Float128), __j1f128_finite);
+# endif
#endif
#if defined __USE_MISC || defined __USE_XOPEN
@@ -244,6 +289,9 @@ extern long double __REDIRECT_NTH (y1l, (long double), __y1_finite);
extern long double __REDIRECT_NTH (y1l, (long double), __y1l_finite);
# endif
# endif
+# if __USE_FLOAT128
+extern _Float128 __REDIRECT_NTH (y1f128, (_Float128), __y1f128_finite);
+# endif
#endif
#if defined __USE_MISC || defined __USE_XOPEN
@@ -259,6 +307,9 @@ extern long double __REDIRECT_NTH (jnl, (int, long double), __jn_finite);
extern long double __REDIRECT_NTH (jnl, (int, long double), __jnl_finite);
# endif
# endif
+# if __USE_FLOAT128
+extern _Float128 __REDIRECT_NTH (jnf128, (int, _Float128), __jnf128_finite);
+# endif
#endif
#if defined __USE_MISC || defined __USE_XOPEN
@@ -274,6 +325,9 @@ extern long double __REDIRECT_NTH (ynl, (int, long double), __yn_finite);
extern long double __REDIRECT_NTH (ynl, (int, long double), __ynl_finite);
# endif
# endif
+# if __USE_FLOAT128
+extern _Float128 __REDIRECT_NTH (ynf128, (int, _Float128), __ynf128_finite);
+# endif
#endif
#ifdef __USE_MISC
@@ -291,6 +345,10 @@ extern long double __REDIRECT_NTH (lgammal_r, (long double, int *),
# endif
# endif
# endif
+# if __USE_FLOAT128
+extern _Float128 __REDIRECT_NTH (lgammaf128_r, (_Float128, int *),
+ __lgammaf128_r_finite);
+# endif
#endif
extern double __lgamma_r_finite (double, int *);
@@ -301,6 +359,9 @@ extern long double __REDIRECT_NTH (__lgammal_r_finite, (long double, int *),
#else
extern long double __lgammal_r_finite (long double, int *);
#endif
+#if __USE_FLOAT128
+extern _Float128 __lgammaf128_r_finite (_Float128, int *);
+#endif
#if ((defined __USE_XOPEN || defined __USE_ISOC99) \
&& defined __extern_always_inline)
@@ -336,6 +397,17 @@ __extern_always_inline long double __NTH (lgammal (long double __d))
# endif
}
# endif
+# if __USE_FLOAT128
+__extern_always_inline _Float128 __NTH (lgammaf128 (_Float128 __d))
+{
+# if defined __USE_MISC || defined __USE_XOPEN
+ return __lgammaf128_r_finite (__d, &signgam);
+# else
+ int __local_signgam = 0;
+ return __lgammaf128_r_finite (__d, &__local_signgam);
+# endif
+}
+# endif
#endif
#if ((defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_XOPEN2K)) \
@@ -371,6 +443,9 @@ extern long double __REDIRECT_NTH (logl, (long double), __logl_finite);
# endif
# endif
#endif
+#if __USE_FLOAT128
+extern _Float128 __REDIRECT_NTH (logf128, (_Float128), __logf128_finite);
+#endif
/* log10. */
extern double __REDIRECT_NTH (log10, (double), __log10_finite);
@@ -384,6 +459,9 @@ extern long double __REDIRECT_NTH (log10l, (long double), __log10l_finite);
# endif
# endif
#endif
+#if __USE_FLOAT128
+extern _Float128 __REDIRECT_NTH (log10f128, (_Float128), __log10f128_finite);
+#endif
#ifdef __USE_ISOC99
/* log2. */
@@ -397,6 +475,9 @@ extern long double __REDIRECT_NTH (log2l, (long double), __log2l_finite);
# endif
# endif
#endif
+#if __USE_FLOAT128
+extern _Float128 __REDIRECT_NTH (log2f128, (_Float128), __log2f128_finite);
+#endif
/* pow. */
extern double __REDIRECT_NTH (pow, (double, double), __pow_finite);
@@ -412,6 +493,10 @@ extern long double __REDIRECT_NTH (powl, (long double, long double),
# endif
# endif
#endif
+#if __USE_FLOAT128
+extern _Float128 __REDIRECT_NTH (powf128, (_Float128, _Float128),
+ __powf128_finite);
+#endif
#if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
/* remainder. */
@@ -429,6 +514,10 @@ extern long double __REDIRECT_NTH (remainderl, (long double, long double),
# endif
# endif
#endif
+#if __USE_FLOAT128
+extern _Float128 __REDIRECT_NTH (remainderf128, (_Float128, _Float128),
+ __remainderf128_finite);
+#endif
#if (defined __USE_MISC \
|| (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8))
@@ -460,6 +549,9 @@ extern long double __REDIRECT_NTH (sinhl, (long double), __sinhl_finite);
# endif
# endif
#endif
+#if __USE_FLOAT128
+extern _Float128 __REDIRECT_NTH (sinhf128, (_Float128), __sinhf128_finite);
+#endif
/* sqrt. */
extern double __REDIRECT_NTH (sqrt, (double), __sqrt_finite);
@@ -473,6 +565,9 @@ extern long double __REDIRECT_NTH (sqrtl, (long double), __sqrtl_finite);
# endif
# endif
#endif
+#if __USE_FLOAT128
+extern _Float128 __REDIRECT_NTH (sqrtf128, (_Float128), __sqrtf128_finite);
+#endif
#if defined __USE_ISOC99 && defined __extern_always_inline
/* tgamma. */
@@ -503,4 +598,13 @@ __extern_always_inline long double __NTH (tgammal (long double __d))
return __local_signgam < 0 ? -__res : __res;
}
# endif
+# if __USE_FLOAT128
+extern _Float128 __gammaf128_r_finite (_Float128, int *);
+__extern_always_inline _Float128 __NTH (tgammaf128 (_Float128 __d))
+{
+ int __local_signgam = 0;
+ _Float128 __res = __gammaf128_r_finite (__d, &__local_signgam);
+ return __local_signgam < 0 ? -__res : __res;
+}
+# endif
#endif
--
2.4.11
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 6/8] float128: Expose _Float128 finite math functions.
2016-11-09 18:41 ` [PATCH 6/8] float128: Expose _Float128 finite math functions Gabriel F. T. Gomes
@ 2016-11-09 22:06 ` Joseph Myers
2017-03-03 20:17 ` Gabriel F. T. Gomes
0 siblings, 1 reply; 33+ messages in thread
From: Joseph Myers @ 2016-11-09 22:06 UTC (permalink / raw)
To: Gabriel F. T. Gomes; +Cc: libc-alpha
On Wed, 9 Nov 2016, Gabriel F. T. Gomes wrote:
> From: "Paul E. Murphy" <murphyp@linux.vnet.ibm.com>
>
> Similar to the other types, entry points to
> dodge wrapper call for non-finite arguments.
Rather than a load of repetitive boilerplate, the function declarations
here should be macroized, with only the definition of the macros depending
on __USE_ISOC99, __MATH_DECLARE_LDOUBLE, __NO_LONG_DOUBLE_MATH and
float128 presence etc. (for most functions, maybe obsolete and lgamma ones
are more complicated).
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 6/8] float128: Expose _Float128 finite math functions.
2016-11-09 22:06 ` Joseph Myers
@ 2017-03-03 20:17 ` Gabriel F. T. Gomes
2017-03-03 20:50 ` Joseph Myers
0 siblings, 1 reply; 33+ messages in thread
From: Gabriel F. T. Gomes @ 2017-03-03 20:17 UTC (permalink / raw)
To: Joseph Myers; +Cc: libc-alpha
On Wed, 9 Nov 2016 22:05:57 +0000
Joseph Myers <joseph@codesourcery.com> wrote:
> Rather than a load of repetitive boilerplate, the function declarations
> here should be macroized, with only the definition of the macros depending
> on __USE_ISOC99, __MATH_DECLARE_LDOUBLE, __NO_LONG_DOUBLE_MATH and
> float128 presence etc. (for most functions, maybe obsolete and lgamma ones
> are more complicated).
>
My attempts to macroize the function declarations were a bit
frustrating. While some of the declarations follow a nice pattern
(always declare for double; always declare for float when __USE_ISOC99;
declare for long double based on __USE_ISOC99, __MATH_DECLARE_LDOUBLE,
and __NO_LONG_DOUBLE_MATH), when that is not the case, the declarations
are somewhat less clear and trickier to read, imo.
For instance:
For exp10 and pow10, the float version is declared *even* when
__USE_ISOC99 is not. This means that I cannot create a macro that
*always* checks for __USE_ISOC99 to declare the float version.
Otherwise, I need to declare the float versions of exp10 and pow10
without using such macro. I find it less clear [to declare some
functions using macros, while others without] than current code.
Another option would be to create this macro not dependent on
__USE_ISOC99, but then it defeats the purpose [of making the macros
dependent on __USE_ISOC99], which you suggested.
I would like to keep this patch as is for the next iteration of this
series... Would you be fine with that? Or maybe you had something
else in mind and I was not able to grasp.
Thanks,
Gabriel
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 6/8] float128: Expose _Float128 finite math functions.
2017-03-03 20:17 ` Gabriel F. T. Gomes
@ 2017-03-03 20:50 ` Joseph Myers
0 siblings, 0 replies; 33+ messages in thread
From: Joseph Myers @ 2017-03-03 20:50 UTC (permalink / raw)
To: Gabriel F. T. Gomes; +Cc: libc-alpha
On Fri, 3 Mar 2017, Gabriel F. T. Gomes wrote:
> On Wed, 9 Nov 2016 22:05:57 +0000
> Joseph Myers <joseph@codesourcery.com> wrote:
>
> > Rather than a load of repetitive boilerplate, the function declarations
> > here should be macroized, with only the definition of the macros depending
> > on __USE_ISOC99, __MATH_DECLARE_LDOUBLE, __NO_LONG_DOUBLE_MATH and
> > float128 presence etc. (for most functions, maybe obsolete and lgamma ones
> > are more complicated).
> >
>
> My attempts to macroize the function declarations were a bit
> frustrating. While some of the declarations follow a nice pattern
> (always declare for double; always declare for float when __USE_ISOC99;
> declare for long double based on __USE_ISOC99, __MATH_DECLARE_LDOUBLE,
> and __NO_LONG_DOUBLE_MATH), when that is not the case, the declarations
> are somewhat less clear and trickier to read, imo.
In subsequent discussions
<https://sourceware.org/ml/libc-alpha/2017-01/msg00404.html> I suggested
the right approach was like bits/mathcalls.h: make bits/math-finite.h into
a header included once for each type, with different macros defined. The
inclusions for float and long double would be conditional on __USE_ISOC99
(and the inclusions for _Float128 would be conditional on the same
conditions under which bits/mathcalls.h is included for _Float128).
An alternative would be merging bits/math-finite.h into bits/mathcalls.h
as I suggested in
<https://sourceware.org/ml/libc-alpha/2016-11/msg01098.html>, but I think
that would be more complicated to implement.
> For exp10 and pow10, the float version is declared *even* when
> __USE_ISOC99 is not. This means that I cannot create a macro that
That's because __USE_GNU implies __USE_ISOC99. That also means that there
is no change in semantics from making the inclusion for float conditional
on __USE_ISOC99, as those float versions will still be declared exactly
for __USE_GNU.
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 33+ messages in thread
* [PATCH 4/8] Add support for testing __STDC_WANT_IEC_60559_TYPES_EXT__
2016-11-09 18:41 [PATCH 0/8] More float128 declarations Gabriel F. T. Gomes
2016-11-09 18:41 ` [PATCH 6/8] float128: Expose _Float128 finite math functions Gabriel F. T. Gomes
@ 2016-11-09 18:41 ` Gabriel F. T. Gomes
2016-11-09 21:42 ` Joseph Myers
2016-11-09 18:41 ` [PATCH 5/8] float128: Add public _Float128 declarations to libm Gabriel F. T. Gomes
` (6 subsequent siblings)
8 siblings, 1 reply; 33+ messages in thread
From: Gabriel F. T. Gomes @ 2016-11-09 18:41 UTC (permalink / raw)
To: libc-alpha
From: "Paul E. Murphy" <murphyp@linux.vnet.ibm.com>
This is defined by TS 18661-3 for supporting the _FloatN
and _FloatNx types.
This will also implicitly enforce a minimum GCC 4.9. Given
the standard is a C11 derivative, it would seem reasonable
to assume a C11 compiler with _Generic support. This allows
for much simpler type classification macros which in theory
should be supported on any C11 compiler.
* bits/libc-header-start.h:
(__GLIBC_USR_IEC_60559_TYPES_EXT): New macro.
---
| 15 +++++++++++++++
1 file changed, 15 insertions(+)
--git a/bits/libc-header-start.h b/bits/libc-header-start.h
index ee6a876..251ff05 100644
--- a/bits/libc-header-start.h
+++ b/bits/libc-header-start.h
@@ -59,3 +59,18 @@
#else
# define __GLIBC_USE_IEC_60559_FUNCS_EXT 0
#endif
+
+/* ISO/IEC TS 18661-3:2014 defines the
+ __STDC_WANT_IEC_60559_TYPES_EXT__ macro.
+
+ Note, as a tradeoff for keeping the headers simple, this will
+ require C11 Generic support. Thus, GCC 4.9 is mandated when
+ requesting this support and using GCC. */
+#undef __GLIBC_USE_IEC_60559_TYPES_EXT
+#if (defined __STDC_WANT_IEC_60559_TYPES_EXT__ || defined __USE_GNU) \
+ && defined __USE_ISOC11 \
+ && ((defined __GNUC__ && __GNUC_PREREQ (4, 9)) || !defined __GNUC__)
+# define __GLIBC_USE_IEC_60559_TYPES_EXT 1
+#else
+# define __GLIBC_USE_IEC_60559_TYPES_EXT 0
+#endif
--
2.4.11
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 4/8] Add support for testing __STDC_WANT_IEC_60559_TYPES_EXT__
2016-11-09 18:41 ` [PATCH 4/8] Add support for testing __STDC_WANT_IEC_60559_TYPES_EXT__ Gabriel F. T. Gomes
@ 2016-11-09 21:42 ` Joseph Myers
0 siblings, 0 replies; 33+ messages in thread
From: Joseph Myers @ 2016-11-09 21:42 UTC (permalink / raw)
To: Gabriel F. T. Gomes; +Cc: libc-alpha
On Wed, 9 Nov 2016, Gabriel F. T. Gomes wrote:
> This will also implicitly enforce a minimum GCC 4.9. Given
> the standard is a C11 derivative, it would seem reasonable
> to assume a C11 compiler with _Generic support. This allows
> for much simpler type classification macros which in theory
> should be supported on any C11 compiler.
I don't think that's appropriate. The aim should be to minimize the
number of conditionals (on versions, supported types, etc.) in the
individual headers with type-generic macros, at the expense of more
complexity somewhere defining infrastructure for such macros.
Also, __USE_ISOC11 relates purely to library facilities. It says nothing
about availability of language support.
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 33+ messages in thread
* [PATCH 5/8] float128: Add public _Float128 declarations to libm.
2016-11-09 18:41 [PATCH 0/8] More float128 declarations Gabriel F. T. Gomes
2016-11-09 18:41 ` [PATCH 6/8] float128: Expose _Float128 finite math functions Gabriel F. T. Gomes
2016-11-09 18:41 ` [PATCH 4/8] Add support for testing __STDC_WANT_IEC_60559_TYPES_EXT__ Gabriel F. T. Gomes
@ 2016-11-09 18:41 ` Gabriel F. T. Gomes
2016-11-09 22:04 ` Joseph Myers
2016-11-09 18:41 ` [PATCH 7/8] float128: Add private _Float128 declarations for libm Gabriel F. T. Gomes
` (5 subsequent siblings)
8 siblings, 1 reply; 33+ messages in thread
From: Gabriel F. T. Gomes @ 2016-11-09 18:41 UTC (permalink / raw)
To: libc-alpha
From: "Paul E. Murphy" <murphyp@linux.vnet.ibm.com>
This introduces the machine-dependent bits/floatn.h to control
the inclusion of _Float128 ABI.
This leverages the _Generic feature of C11 as __USE_FLOAT128
must imply a test for __STDC_WANT_IEC_60559_TYPES_EXT__
which requires C11 to prevent increasingly complex math
macros for the sake of old (and unsupported?) GCC toolchains.
* bits/floatn.h: New file.
* bits/huge_val_flt128.h: New file.
* math/Makefile (headers): Install bits/floatn.h
* math/math.h: Define and undefine __FLOATN_TYPE as
needed for _FloatN types. Add prototypes for _Float128
if __USE_FLOAT128.
[__GNUC_PREREQ(6,2)] (signbit): Define as type-generic macro.
[__USE_FLOAT128] (fpclassify): Use _Generic macro selection when
a non-GCC compiler is used.
[__USE_FLOAT128] (signbit): Likewise.
[__USE_FLOAT128] (isfinite): Likewise.
[__USE_FLOAT128] (isnan): Likewise.
[__USE_FLOAT128] (issignaling): Likewise.
[__USE_FLOAT128] (isinf): This builtin is broken on GCC.
Explicitly call __isinff128 for _Float128 types, otherwise
use the builtin.
[__USE_FLOAT128] (__f128): New macro to apply proper _Float128
literal suffix depending on compiler version for __USE_GNU
enabled constants.
[__USE_FLOAT128] (M_Ef128): New _GNU_SOURCE enabled macro.
[__USE_FLOAT128] (M_LOG2Ef128): Likewise.
[__USE_FLOAT128] (M_LOG10Ef128): Likewise.
[__USE_FLOAT128] (M_LN2f128): Likewise.
[__USE_FLOAT128] (M_LN10f128): Likewise.
[__USE_FLOAT128] (M_PIf128): Likewise.
[__USE_FLOAT128] (M_PI_2f128): Likewise.
[__USE_FLOAT128] (M_PI_4f128): Likewise.
[__USE_FLOAT128] (M_1_PIf128): Likewise.
[__USE_FLOAT128] (M_2_PIf128): Likewise.
[__USE_FLOAT128] (M_SQRT2f128): Likewise.
[__USE_FLOAT128] (M_SQRT1_2f128): Likewise.
* math/mathcalls.h (drem): Only define if __FLOATN_TYPE
not defined.
(gamma): Likewise.
(nexttoward): Likewise.
(significand): Likewise.
(pow10): Likewise.
(scalb): Likewise.
(finite): Likewise.
(isinf): Likewise.
(isnan): Likewise.
---
bits/floatn.h | 27 +++++++++++++
bits/huge_val_flt128.h | 29 ++++++++++++++
math/Makefile | 4 +-
math/bits/cmathcalls.h | 4 +-
math/bits/mathcalls.h | 30 +++++++++-----
math/complex.h | 27 ++++++++++++-
math/math.h | 107 ++++++++++++++++++++++++++++++++++++++++++++++++-
7 files changed, 213 insertions(+), 15 deletions(-)
create mode 100644 bits/floatn.h
create mode 100644 bits/huge_val_flt128.h
diff --git a/bits/floatn.h b/bits/floatn.h
new file mode 100644
index 0000000..57db3a6
--- /dev/null
+++ b/bits/floatn.h
@@ -0,0 +1,27 @@
+/* Macros to control TS 18661-3 glibc features.
+ Copyright (C) 2016 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/>. */
+
+/* Defined if the compiler supports the _Float128 (and __float128) type. */
+#define __USE_FLOAT128 0
+
+/* Defined if the runtime supports _Float128. */
+#define __HAVE_FLOAT128 0
+
+/* Defined for GCC versions which support the __float128 type, but not
+ _Complex __float128. This resolves to a complex binary128 type. */
+#undef __CFLOAT128
diff --git a/bits/huge_val_flt128.h b/bits/huge_val_flt128.h
new file mode 100644
index 0000000..562d026
--- /dev/null
+++ b/bits/huge_val_flt128.h
@@ -0,0 +1,29 @@
+/* Default `HUGE_VAL_F128' constant.
+ Copyright (C) 2016 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 _MATH_H
+# error "Never use <bits/huge_val_flt128.h> directly; include <math.h> instead."
+#endif
+
+#if __GNUC_PREREQ (7, 0)
+# define HUGE_VAL_F128 (__builtin_huge_valf128 ())
+#elif __GNUC_PREREQ (6,2)
+# define HUGE_VAL_F128 (__builtin_huge_valq ())
+#else
+# define HUGE_VAL_F128 ((_Float128) HUGE_VAL)
+#endif
diff --git a/math/Makefile b/math/Makefile
index 37e7ea0..f6adf09 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -27,7 +27,9 @@ headers := math.h bits/mathcalls.h bits/mathinline.h bits/huge_val.h \
fpu_control.h complex.h bits/cmathcalls.h fenv.h \
bits/fenv.h bits/fenvinline.h bits/mathdef.h tgmath.h \
bits/math-finite.h bits/math-vector.h \
- bits/libm-simd-decl-stubs.h bits/iscanonical.h
+ bits/libm-simd-decl-stubs.h bits/iscanonical.h \
+ bits/huge_val_flt128.h \
+ bits/floatn.h
# FPU support code.
aux := setfpucw fpu_control
diff --git a/math/bits/cmathcalls.h b/math/bits/cmathcalls.h
index e02707e..c94976b 100644
--- a/math/bits/cmathcalls.h
+++ b/math/bits/cmathcalls.h
@@ -44,7 +44,9 @@
#error "Never use <bits/cmathcalls.h> directly; include <complex.h> instead."
#endif
-#define _Mdouble_complex_ _Mdouble_ _Complex
+#ifndef _Mdouble_complex_
+# define _Mdouble_complex_ _Mdouble_ _Complex
+#endif
/* Trigonometric functions. */
diff --git a/math/bits/mathcalls.h b/math/bits/mathcalls.h
index 2fd1d28..8a31aea 100644
--- a/math/bits/mathcalls.h
+++ b/math/bits/mathcalls.h
@@ -121,7 +121,9 @@ __MATHCALL (exp10,, (_Mdouble_ __x));
#endif
#ifdef __USE_GNU
/* Another name occasionally used. */
+# ifndef __FLOATN_TYPE
__MATHCALL (pow10,, (_Mdouble_ __x));
+# endif
#endif
#if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
@@ -198,14 +200,16 @@ __MATHDECL_1 (int,__finite,, (_Mdouble_ __value)) __attribute__ ((__const__));
_Mdouble_END_NAMESPACE
#ifdef __USE_MISC
-# if (!defined __cplusplus \
- || __cplusplus < 201103L /* isinf conflicts with C++11. */ \
- || __MATH_DECLARING_DOUBLE == 0) /* isinff or isinfl don't. */
+# if ((!defined __cplusplus \
+ || __cplusplus < 201103L /* isinf conflicts with C++11. */ \
+ || __MATH_DECLARING_DOUBLE == 0)) /* isinff or isinfl don't. */ \
+ && !defined __FLOATN_TYPE
/* Return 0 if VALUE is finite or NaN, +1 if it
is +Infinity, -1 if it is -Infinity. */
__MATHDECL_1 (int,isinf,, (_Mdouble_ __value)) __attribute__ ((__const__));
# endif
+# ifndef __FLOATN_TYPE
/* Return nonzero if VALUE is finite and not NaN. */
__MATHDECL_1 (int,finite,, (_Mdouble_ __value)) __attribute__ ((__const__));
@@ -215,6 +219,8 @@ __MATHCALL (drem,, (_Mdouble_ __x, _Mdouble_ __y));
/* Return the fractional part of X after dividing out `ilogb (X)'. */
__MATHCALL (significand,, (_Mdouble_ __x));
+# endif
+
#endif /* Use misc. */
#ifdef __USE_ISOC99
@@ -236,9 +242,10 @@ __END_NAMESPACE_C99
__MATHDECL_1 (int,__isnan,, (_Mdouble_ __value)) __attribute__ ((__const__));
#if defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
-# if (!defined __cplusplus \
- || __cplusplus < 201103L /* isnan conflicts with C++11. */ \
- || __MATH_DECLARING_DOUBLE == 0) /* isnanf or isnanl don't. */
+# if ((!defined __cplusplus \
+ || __cplusplus < 201103L /* isnan conflicts with C++11. */ \
+ || __MATH_DECLARING_DOUBLE == 0)) /* isnanf or isnanl don't. */ \
+ && !defined __FLOATN_TYPE
/* Return nonzero if VALUE is not a number. */
__MATHDECL_1 (int,isnan,, (_Mdouble_ __value)) __attribute__ ((__const__));
# endif
@@ -272,8 +279,10 @@ __END_NAMESPACE_C99
#endif
#if defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
+# ifndef __FLOATN_TYPE
/* Obsolete alias for `lgamma'. */
__MATHCALL (gamma,, (_Mdouble_));
+# endif
#endif
#ifdef __USE_MISC
@@ -292,7 +301,7 @@ __MATHCALL (rint,, (_Mdouble_ __x));
/* Return X + epsilon if X < Y, X - epsilon if X > Y. */
__MATHCALLX (nextafter,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
-# if defined __USE_ISOC99 && !defined __LDBL_COMPAT
+# if defined __USE_ISOC99 && !defined __LDBL_COMPAT && !defined __FLOATN_TYPE
__MATHCALLX (nexttoward,, (_Mdouble_ __x, long double __y), (__const__));
# endif
@@ -402,9 +411,10 @@ __MATHDECL_1 (int, canonicalize,, (_Mdouble_ *__cx, const _Mdouble_ *__x));
__MATHCALL (getpayload,, (const _Mdouble_ *__x));
#endif
-#if defined __USE_MISC || (defined __USE_XOPEN_EXTENDED \
- && __MATH_DECLARING_DOUBLE \
- && !defined __USE_XOPEN2K8)
+#if (defined __USE_MISC || (defined __USE_XOPEN_EXTENDED \
+ && __MATH_DECLARING_DOUBLE \
+ && !defined __USE_XOPEN2K8)) \
+ && !defined __FLOATN_TYPE
/* Return X times (2 to the Nth power). */
__MATHCALL (scalb,, (_Mdouble_ __x, _Mdouble_ __n));
#endif
diff --git a/math/complex.h b/math/complex.h
index 331975e..4adc742 100644
--- a/math/complex.h
+++ b/math/complex.h
@@ -22,11 +22,15 @@
#ifndef _COMPLEX_H
#define _COMPLEX_H 1
-#include <features.h>
+#define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION
+#include <bits/libc-header-start.h>
/* Get general and ISO C99 specific information. */
#include <bits/mathdef.h>
+/* Gather machine-dependent _FloatN type support. */
+#include <bits/floatn.h>
+
__BEGIN_DECLS
/* We might need to add support for more compilers here. But since ISO
@@ -55,6 +59,10 @@ __BEGIN_DECLS
# define CMPLXL(x, y) __builtin_complex ((long double) (x), (long double) (y))
#endif
+#if __USE_FLOAT128
+# define CMPLXF128(x, y) __builtin_complex ((__float128) (x), (__float128) (y))
+#endif
+
/* The file <bits/cmathcalls.h> contains the prototypes for all the
actual math functions. These macros are used for those prototypes,
so we can easily declare each function as both `name' and `__name',
@@ -84,6 +92,23 @@ __BEGIN_DECLS
#undef _Mdouble_
#undef __MATH_PRECNAME
+#if __USE_FLOAT128
+# ifndef _Mfloat128_
+# define _Mfloat128_ _Float128
+# endif
+/* GCC < 7 requires extra convincing to expose a complex float128 type. */
+# ifdef __CFLOAT128
+# undef _Mdouble_complex_
+# define _Mdouble_complex_ __CFLOAT128
+# endif
+# define _Mdouble_ _Mfloat128_
+# define __MATH_PRECNAME(name) name##f128
+# include <bits/cmathcalls.h>
+# undef _Mdouble_
+# undef __MATH_PRECNAME
+# undef _Mdouble_complex_
+#endif
+
/* And the long double versions. It is non-critical to define them
here unconditionally since `long double' is required in ISO C99. */
#if !(defined __NO_LONG_DOUBLE_MATH && defined _LIBC) \
diff --git a/math/math.h b/math/math.h
index 70d9b86..87eb19d 100644
--- a/math/math.h
+++ b/math/math.h
@@ -31,9 +31,17 @@ __BEGIN_DECLS
/* Get machine-dependent vector math functions declarations. */
#include <bits/math-vector.h>
+/* Gather machine dependent type support. */
+#include <bits/floatn.h>
+
/* Get machine-dependent HUGE_VAL value (returned on overflow).
On all IEEE754 machines, this is +Infinity. */
#include <bits/huge_val.h>
+
+#if __USE_FLOAT128
+# include <bits/huge_val_flt128.h>
+#endif
+
#ifdef __USE_ISOC99
# include <bits/huge_valf.h>
# include <bits/huge_vall.h>
@@ -106,6 +114,7 @@ __BEGIN_DECLS
extern type __MATH_PRECNAME(function,suffix) args __THROW
#define _Mdouble_ double
+#undef __FLOATN_TYPE
#define __MATH_PRECNAME(name,r) __CONCAT(name,r)
#define __MATH_DECLARING_DOUBLE 1
#define _Mdouble_BEGIN_NAMESPACE __BEGIN_NAMESPACE_STD
@@ -126,6 +135,7 @@ __BEGIN_DECLS
# ifndef _Mfloat_
# define _Mfloat_ float
# endif
+# undef __FLOATN_TYPE
# define _Mdouble_ _Mfloat_
# define __MATH_PRECNAME(name,r) name##f##r
# define __MATH_DECLARING_DOUBLE 0
@@ -172,6 +182,7 @@ extern long double __REDIRECT_NTH (nexttowardl,
# ifndef _Mlong_double_
# define _Mlong_double_ long double
# endif
+# undef __FLOATN_TYPE
# define _Mdouble_ _Mlong_double_
# define __MATH_PRECNAME(name,r) name##l##r
# define __MATH_DECLARING_DOUBLE 0
@@ -188,6 +199,29 @@ extern long double __REDIRECT_NTH (nexttowardl,
# endif /* !(__NO_LONG_DOUBLE_MATH && _LIBC) || __LDBL_COMPAT */
#endif /* Use ISO C99. */
+
+/* Include the file of declarations again, this time using `_Float128'
+ instead of `double' and appending f128 to each function name. */
+
+#if __USE_FLOAT128
+#ifndef _Mfloat128_
+# define _Mfloat128_ _Float128
+#endif
+#define __FLOATN_TYPE 1
+#define _Mdouble_ _Mfloat128_
+#define __MATH_PRECNAME(name,r) name##f128##r
+#define __MATH_DECLARING_DOUBLE 0
+#define _Mdouble_BEGIN_NAMESPACE __BEGIN_NAMESPACE_C99
+#define _Mdouble_END_NAMESPACE __END_NAMESPACE_C99
+#include <bits/mathcalls.h>
+#undef __FLOATN_TYPE
+#undef _Mdouble_
+#undef _Mdouble_BEGIN_NAMESPACE
+#undef _Mdouble_END_NAMESPACE
+#undef __MATH_PRECNAME
+#undef __MATH_DECLARING_DOUBLE
+#endif /* Use _Float128. */
+
#undef __MATHDECL_1
#undef __MATHDECL
#undef __MATHCALL
@@ -231,6 +265,13 @@ enum
&& !defined __OPTIMIZE_SIZE__
# define fpclassify(x) __builtin_fpclassify (FP_NAN, FP_INFINITE, \
FP_NORMAL, FP_SUBNORMAL, FP_ZERO, x)
+# elif __USE_FLOAT128
+# define fpclassify(x) \
+ _Generic ((x), \
+ _Float128: __fpclassifyf128, \
+ long double: __fpclassifyl, \
+ float: __fpclassifyf, \
+ default: __fpclassify)(x)
# elif defined __NO_LONG_DOUBLE_MATH
# define fpclassify(x) \
(sizeof (x) == sizeof (float) ? __fpclassifyf (x) : __fpclassify (x))
@@ -243,7 +284,16 @@ enum
# endif
/* Return nonzero value if sign of X is negative. */
-# if __GNUC_PREREQ (4,0)
+# if __GNUC_PREREQ (6,2)
+# define signbit(x) __builtin_signbit (x)
+# elif __USE_FLOAT128
+# define signbit(x) \
+ _Generic ((x), \
+ _Float128: __signbitf128, \
+ long double: __signbitl, \
+ float: __signbitf, \
+ default: __signbit)(x)
+# elif __GNUC_PREREQ (4,0)
# define signbit(x) \
(sizeof (x) == sizeof (float) \
? __builtin_signbitf (x) \
@@ -265,6 +315,13 @@ enum
/* Return nonzero value if X is not +-Inf or NaN. */
# if __GNUC_PREREQ (4,4) && !defined __SUPPORT_SNAN__
# define isfinite(x) __builtin_isfinite (x)
+# elif __USE_FLOAT128
+# define isfinite(x) \
+ _Generic ((x), \
+ _Float128: __finitef128, \
+ long double: __finitel, \
+ float: __finitef, \
+ default: __finite) (x)
# elif defined __NO_LONG_DOUBLE_MATH
# define isfinite(x) \
(sizeof (x) == sizeof (float) ? __finitef (x) : __finite (x))
@@ -287,6 +344,13 @@ enum
we already have this functions `__isnan' and it is faster. */
# if __GNUC_PREREQ (4,4) && !defined __SUPPORT_SNAN__
# define isnan(x) __builtin_isnan (x)
+# elif __USE_FLOAT128
+# define isnan(x) \
+ _Generic ((x), \
+ _Float128: __isnanf128, \
+ long double: __isnanl, \
+ float: __isnanf, \
+ default: __isnan) (x)
# elif defined __NO_LONG_DOUBLE_MATH
# define isnan(x) \
(sizeof (x) == sizeof (float) ? __isnanf (x) : __isnan (x))
@@ -299,8 +363,20 @@ enum
# endif
/* Return nonzero value if X is positive or negative infinity. */
-# if __GNUC_PREREQ (4,4) && !defined __SUPPORT_SNAN__
+# if __USE_FLOAT128 && !defined __SUPPORT_SNAN__ && defined __GNUC__
+/* __builtin_isinf_sign is broken for float128. */
+# define isinf(x) \
+ (__builtin_types_compatible_p (typeof (x), _Float128) \
+ ? __isinff128 (x) : __builtin_isinf_sign (x))
+# elif __GNUC_PREREQ (4,4) && !defined __SUPPORT_SNAN__
# define isinf(x) __builtin_isinf_sign (x)
+# elif __USE_FLOAT128
+# define isinf(x) \
+ _Generic ((x), \
+ _Float128: __isinff128, \
+ long double: __isinfl, \
+ float: __isinff, \
+ default: __isinf) (x)
# elif defined __NO_LONG_DOUBLE_MATH
# define isinf(x) \
(sizeof (x) == sizeof (float) ? __isinff (x) : __isinf (x))
@@ -332,6 +408,13 @@ enum
# ifdef __NO_LONG_DOUBLE_MATH
# define issignaling(x) \
(sizeof (x) == sizeof (float) ? __issignalingf (x) : __issignaling (x))
+# elif __USE_FLOAT128
+# define issignaling(x) \
+ _Generic((x), \
+ _Float128: __issignalingf128, \
+ long double: __issignalingl, \
+ float: __issignalingf, \
+ default: __issignaling)(x)
# else
# define issignaling(x) \
(sizeof (x) == sizeof (float) \
@@ -467,6 +550,26 @@ extern int matherr (struct exception *__exc);
# define M_SQRT1_2l 0.707106781186547524400844362104849039L /* 1/sqrt(2) */
#endif
+#if __USE_FLOAT128
+# if defined __GNUC__ && !__GNUC_PREREQ (7,0)
+# define __f128(x) x ## q
+# else
+# define __f128(x) x ## f128
+# endif
+# define M_Ef128 __f128 (2.718281828459045235360287471352662498) /* e */
+# define M_LOG2Ef128 __f128 (1.442695040888963407359924681001892137) /* log_2 e */
+# define M_LOG10Ef128 __f128 (0.434294481903251827651128918916605082) /* log_10 e */
+# define M_LN2f128 __f128 (0.693147180559945309417232121458176568) /* log_e 2 */
+# define M_LN10f128 __f128 (2.302585092994045684017991454684364208) /* log_e 10 */
+# define M_PIf128 __f128 (3.141592653589793238462643383279502884) /* pi */
+# define M_PI_2f128 __f128 (1.570796326794896619231321691639751442) /* pi/2 */
+# define M_PI_4f128 __f128 (0.785398163397448309615660845819875721) /* pi/4 */
+# define M_1_PIf128 __f128 (0.318309886183790671537767526745028724) /* 1/pi */
+# define M_2_PIf128 __f128 (0.636619772367581343075535053490057448) /* 2/pi */
+# define M_2_SQRTPIf128 __f128 (1.128379167095512573896158903121545172) /* 2/sqrt(pi) */
+# define M_SQRT2f128 __f128 (1.414213562373095048801688724209698079) /* sqrt(2) */
+# define M_SQRT1_2f128 __f128 (0.707106781186547524400844362104849039) /* 1/sqrt(2) */
+#endif
/* When compiling in strict ISO C compatible mode we must not use the
inline functions since they, among other things, do not set the
--
2.4.11
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 5/8] float128: Add public _Float128 declarations to libm.
2016-11-09 18:41 ` [PATCH 5/8] float128: Add public _Float128 declarations to libm Gabriel F. T. Gomes
@ 2016-11-09 22:04 ` Joseph Myers
0 siblings, 0 replies; 33+ messages in thread
From: Joseph Myers @ 2016-11-09 22:04 UTC (permalink / raw)
To: Gabriel F. T. Gomes; +Cc: libc-alpha
On Wed, 9 Nov 2016, Gabriel F. T. Gomes wrote:
> This introduces the machine-dependent bits/floatn.h to control
> the inclusion of _Float128 ABI.
>
> This leverages the _Generic feature of C11 as __USE_FLOAT128
> must imply a test for __STDC_WANT_IEC_60559_TYPES_EXT__
> which requires C11 to prevent increasingly complex math
> macros for the sake of old (and unsupported?) GCC toolchains.
Older tools are supported for compiling code using glibc. 4.7 and later
are supported for building glibc (I'd hope we can add float128 support on
x86-64 / x86 without needing to increase the minimum GCC version for
building glibc there).
> +/* Defined if the compiler supports the _Float128 (and __float128) type. */
> +#define __USE_FLOAT128 0
Support for _Float128 and __float128 are distinct things. GCC 7 supports
_Float128 on lots of platforms where long double has that format, but not
__float128.
> +/* Defined if the runtime supports _Float128. */
> +#define __HAVE_FLOAT128 0
You appear to be using __USE_FLOAT128 conditionals on things assuming
library facilities to be present.
You need to be very careful in designing exactly what macros are needed to
specify the available types and their properties, and in writing the
comments documenting the design.
> +#if __GNUC_PREREQ (7, 0)
> +# define HUGE_VAL_F128 (__builtin_huge_valf128 ())
> +#elif __GNUC_PREREQ (6,2)
Missing space after comma.
> +# define HUGE_VAL_F128 (__builtin_huge_valq ())
My inclination would be to localize the workarounds for old compilers to
one place, that defines __builtin_huge_valf128 as a macro. And the choice
of 6.2 as version here is questionable. A generic header here should not
have architecture-specific version conditionals. For x86, GCC supports
__builtin_huge_valq long before 6.2 - but even 6.2 doesn't support it in
static initializers for x86. So the definition casting HUGE_VAL is safer
for old compilers. That is, a bits/floatn-compat.h header could do
#if !__GNUC_PREREQ (7, 0)
# define __builtin_huge_valf128() ((_Float128) __builtin_huge_val ())
#endif
and similarly for defining _Float128 to __float128 and defining other
__builtin_* macros as needed. Of course that header would only be needed
for certain architectures.
> @@ -55,6 +59,10 @@ __BEGIN_DECLS
> # define CMPLXL(x, y) __builtin_complex ((long double) (x), (long double) (y))
> #endif
>
> +#if __USE_FLOAT128
> +# define CMPLXF128(x, y) __builtin_complex ((__float128) (x), (__float128) (y))
> +#endif
CMPLXF128 is only reserved when TS 18661-3 names are defined. That is,
all function or macro definitions for the new types need to be conditional
on an __GLIBC_USE conditional for TS 18661-3 *and* on the particular type
in question being supported. Whereas type-generic macros in <math.h>, as
opposed to those in <tgmath.h>, should support the new types even if the
__GLIBC_USE conditional for TS 18661-3 is false (meaning you might need to
split <bits/mathcalls.h> so you can declare e.g. __signbitf128 when not
declaring sinf128).
> +#if __USE_FLOAT128
> +# ifndef _Mfloat128_
> +# define _Mfloat128_ _Float128
> +# endif
> +/* GCC < 7 requires extra convincing to expose a complex float128 type. */
> +# ifdef __CFLOAT128
> +# undef _Mdouble_complex_
> +# define _Mdouble_complex_ __CFLOAT128
> +# endif
> +# define _Mdouble_ _Mfloat128_
> +# define __MATH_PRECNAME(name) name##f128
> +# include <bits/cmathcalls.h>
Likewise.
> +#if __USE_FLOAT128
> +# include <bits/huge_val_flt128.h>
> +#endif
Likewise.
> +/* Include the file of declarations again, this time using `_Float128'
> + instead of `double' and appending f128 to each function name. */
> +
> +#if __USE_FLOAT128
> +#ifndef _Mfloat128_
> +# define _Mfloat128_ _Float128
> +#endif
> +#define __FLOATN_TYPE 1
> +#define _Mdouble_ _Mfloat128_
> +#define __MATH_PRECNAME(name,r) name##f128##r
> +#define __MATH_DECLARING_DOUBLE 0
> +#define _Mdouble_BEGIN_NAMESPACE __BEGIN_NAMESPACE_C99
> +#define _Mdouble_END_NAMESPACE __END_NAMESPACE_C99
> +#include <bits/mathcalls.h>
Likewise.
> /* Return nonzero value if sign of X is negative. */
> -# if __GNUC_PREREQ (4,0)
> +# if __GNUC_PREREQ (6,2)
> +# define signbit(x) __builtin_signbit (x)
6.2 isn't the right version. __builtin_signbit is type-generic in GCC
from before GCC 6 branched, so use 6.0.
> @@ -299,8 +363,20 @@ enum
> # endif
>
> /* Return nonzero value if X is positive or negative infinity. */
> -# if __GNUC_PREREQ (4,4) && !defined __SUPPORT_SNAN__
> +# if __USE_FLOAT128 && !defined __SUPPORT_SNAN__ && defined __GNUC__
> +/* __builtin_isinf_sign is broken for float128. */
Only broken before GCC 7.
> +#if __USE_FLOAT128
__USE_GNU conditional needed as well.
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 33+ messages in thread
* [PATCH 7/8] float128: Add private _Float128 declarations for libm.
2016-11-09 18:41 [PATCH 0/8] More float128 declarations Gabriel F. T. Gomes
` (2 preceding siblings ...)
2016-11-09 18:41 ` [PATCH 5/8] float128: Add public _Float128 declarations to libm Gabriel F. T. Gomes
@ 2016-11-09 18:41 ` Gabriel F. T. Gomes
2016-11-09 22:08 ` Joseph Myers
2016-11-10 22:13 ` Joseph Myers
2016-11-09 18:41 ` [PATCH 1/8] ldbl-128: Use mathx_hidden_def inplace of hidden_def Gabriel F. T. Gomes
` (4 subsequent siblings)
8 siblings, 2 replies; 33+ messages in thread
From: Gabriel F. T. Gomes @ 2016-11-09 18:41 UTC (permalink / raw)
To: libc-alpha
From: "Paul E. Murphy" <murphyp@linux.vnet.ibm.com>
Add the necessary bits to the private headers to support
building the _Float128 libm functions.
A local override for float.h is provided to include the
missing *FLT128 macros implied by TS 18661-3 for this
type when compiling prior to GCC 7.
* bits/libm-simd-decl-stubs.h (__DECL_SIMD_cosf128): New macro.
(__DECL_SIMD_sinf128): Likewise.
(__DECL_SIMD_sincosf128): Likewise.
(__DECL_SIMD_logf128): Likewise.
(__DECL_SIMD_expf128): Likewise.
(__DECL_SIMD_powf128): Likewise.
* include/complex.h (__kernel_casinhf128): New declaration.
* include/float.h: New file.
* include/math.h (__finitef128): Add a hidden def.
(__isinff128): Likewise.
(__isnanf128): Likewise.
(__fpclassify): Likewise.
(__issignalling): Likewise.
(__expf128): Likewise.
(__expm1f128): Likewise.
* sysdeps/generic/fix-fp-int-convert-overflow.h:
(FIX_FLT128_LONG_CONVERT_OVERFLOW): New macro.
(FIX_FLT128_LLONG_CONVERT_OVERFLOW): Likewise.
* sysdeps/generic/math-type-macros-float128.h: New file.
* sysdeps/generic/math_private.h (__EXPR_FLT128): New macro.
(fabs_tg): Optionally include _Float128 types too.
(min_of_type): Likewise.
* sysdeps/ieee754/ldbl-opt/s_sin.c:
* (__DECL_SIMD_sincos_disablef128): New macro.
---
bits/libm-simd-decl-stubs.h | 6 ++
include/complex.h | 7 ++
include/float.h | 31 +++++++
include/math.h | 13 +++
sysdeps/generic/fix-fp-int-convert-overflow.h | 2 +
sysdeps/generic/math-type-macros-float128.h | 49 ++++++++++++
sysdeps/generic/math_private.h | 111 +++++++++++++++++++++++++-
sysdeps/ieee754/ldbl-opt/s_sin.c | 1 +
8 files changed, 218 insertions(+), 2 deletions(-)
create mode 100644 include/float.h
create mode 100644 sysdeps/generic/math-type-macros-float128.h
diff --git a/bits/libm-simd-decl-stubs.h b/bits/libm-simd-decl-stubs.h
index 541cb3f..c72d693 100644
--- a/bits/libm-simd-decl-stubs.h
+++ b/bits/libm-simd-decl-stubs.h
@@ -36,24 +36,30 @@
#define __DECL_SIMD_cos
#define __DECL_SIMD_cosf
#define __DECL_SIMD_cosl
+#define __DECL_SIMD_cosf128
#define __DECL_SIMD_sin
#define __DECL_SIMD_sinf
#define __DECL_SIMD_sinl
+#define __DECL_SIMD_sinf128
#define __DECL_SIMD_sincos
#define __DECL_SIMD_sincosf
#define __DECL_SIMD_sincosl
+#define __DECL_SIMD_sincosf128
#define __DECL_SIMD_log
#define __DECL_SIMD_logf
#define __DECL_SIMD_logl
+#define __DECL_SIMD_logf128
#define __DECL_SIMD_exp
#define __DECL_SIMD_expf
#define __DECL_SIMD_expl
+#define __DECL_SIMD_expf128
#define __DECL_SIMD_pow
#define __DECL_SIMD_powf
#define __DECL_SIMD_powl
+#define __DECL_SIMD_powf128
#endif
diff --git a/include/complex.h b/include/complex.h
index 082e71f..8eec3a0 100644
--- a/include/complex.h
+++ b/include/complex.h
@@ -8,6 +8,13 @@
extern complex float __kernel_casinhf (complex float z, int adj);
extern complex double __kernel_casinh (complex double z, int adj);
extern complex long double __kernel_casinhl (complex long double z, int adj);
+# if __USE_FLOAT128
+# ifdef __CFLOAT128
+extern __CFLOAT128 __kernel_casinhf128 (__CFLOAT128 z, int adj);
+# else
+extern _Complex _Float128 __kernel_casinhf128 (_Complex _Float128 z, int adj);
+# endif
+# endif
# endif
#endif
diff --git a/include/float.h b/include/float.h
new file mode 100644
index 0000000..f792158
--- /dev/null
+++ b/include/float.h
@@ -0,0 +1,31 @@
+#ifndef _LIBC_FLOAT_H
+#define _LIBC_FLOAT_H
+
+#ifndef _ISOMAC
+# define __STDC_WANT_IEC_60559_TYPES_EXT__
+#endif
+
+#include_next <float.h>
+
+/* Supplement float.h macros for _Float128 for older compilers
+ which do not yet support the type. These are described in
+ TS 18661-3. */
+#ifndef _ISOMAC
+# include <features.h>
+# include <bits/floatn.h>
+# if !__GNUC_PREREQ (7,0) && __USE_FLOAT128
+# define FLT128_MANT_DIG 113
+# define FLT128_DECIMAL_DIG 36
+# define FLT128_DIG 33
+# define FLT128_MIN_EXP (-16381)
+# define FLT128_MIN_10_EXP (-4931)
+# define FLT128_MAX_EXP 16384
+# define FLT128_MAX_10_EXP 4932
+# define FLT128_MAX 1.18973149535723176508575932662800702e+4932Q
+# define FLT128_EPSILON 1.92592994438723585305597794258492732e-34Q
+# define FLT128_MIN 3.36210314311209350626267781732175260e-4932Q
+# define FLT128_TRUE_MIN 6.47517511943802511092443895822764655e-4966Q
+# endif
+#endif
+
+#endif /* _LIBC_FLOAT_H */
diff --git a/include/math.h b/include/math.h
index ba7bba0..df82ee9 100644
--- a/include/math.h
+++ b/include/math.h
@@ -21,6 +21,12 @@ hidden_proto (__finitel)
hidden_proto (__isinfl)
hidden_proto (__isnanl)
# endif
+
+# if __USE_FLOAT128
+hidden_proto (__finitef128)
+hidden_proto (__isinff128)
+hidden_proto (__isnanf128)
+# endif
# endif
libm_hidden_proto (__fpclassify)
@@ -37,5 +43,12 @@ libm_hidden_proto (__expl)
libm_hidden_proto (__expm1l)
# endif
+# if __USE_FLOAT128
+libm_hidden_proto (__fpclassifyf128)
+libm_hidden_proto (__issignalingf128)
+libm_hidden_proto (__expf128)
+libm_hidden_proto (__expm1f128)
+# endif
+
#endif
#endif
diff --git a/sysdeps/generic/fix-fp-int-convert-overflow.h b/sysdeps/generic/fix-fp-int-convert-overflow.h
index fb68114..ff55dbf 100644
--- a/sysdeps/generic/fix-fp-int-convert-overflow.h
+++ b/sysdeps/generic/fix-fp-int-convert-overflow.h
@@ -29,5 +29,7 @@
#define FIX_DBL_LLONG_CONVERT_OVERFLOW 0
#define FIX_LDBL_LONG_CONVERT_OVERFLOW 0
#define FIX_LDBL_LLONG_CONVERT_OVERFLOW 0
+#define FIX_FLT128_LONG_CONVERT_OVERFLOW 0
+#define FIX_FLT128_LLONG_CONVERT_OVERFLOW 0
#endif /* fix-fp-int-convert-overflow.h */
diff --git a/sysdeps/generic/math-type-macros-float128.h b/sysdeps/generic/math-type-macros-float128.h
new file mode 100644
index 0000000..20582e4
--- /dev/null
+++ b/sysdeps/generic/math-type-macros-float128.h
@@ -0,0 +1,49 @@
+/* Helper macros for _Float128 variants of type generic functions of libm.
+ Copyright (C) 2016 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 _MATH_TYPE_MACROS_FLOAT128
+#define _MATH_TYPE_MACROS_FLOAT128
+
+#include <math.h>
+#include <complex.h>
+
+#define M_LIT(c) __f128 (c)
+#define M_PFX FLT128
+#define M_SUF(c) c ## f128
+#define FLOAT _Float128
+#define M_STRTO_NAN __strtof128_nan
+
+#ifdef __CFLOAT128
+# define CFLOAT __CFLOAT128
+#else
+# define CFLOAT _Complex _Float128
+#endif
+
+#define M_MLIT(c) c ## f128
+
+
+/* Supply the generic macros. */
+#include <math-type-macros.h>
+
+/* A hack, but an honest one. */
+#if __GNUC_PREREQ(6,2)
+# define __builtin_huge_valf128 __builtin_huge_valq
+# define __builtin_nanf128 __builtin_nanq
+#endif
+
+#endif
diff --git a/sysdeps/generic/math_private.h b/sysdeps/generic/math_private.h
index cc9681c..d85737f 100644
--- a/sysdeps/generic/math_private.h
+++ b/sysdeps/generic/math_private.h
@@ -23,6 +23,9 @@
#include <float.h>
#include <get-rounding-mode.h>
+/* Gather machine dependent _Floatn support. */
+#include <bits/floatn.h>
+
/* The original fdlibm code used statements like:
n0 = ((*(int*)&one)>>29)^1; * index of high word *
ix0 = *(n0+(int*)&x); * high word of x *
@@ -181,6 +184,100 @@ do { \
} while (0)
#endif
+/* Float128 variants. */
+#if __USE_FLOAT128
+extern _Float128 __ieee754_sqrtf128 (_Float128);
+extern _Float128 __ieee754_acosf128 (_Float128);
+extern _Float128 __ieee754_acoshf128 (_Float128);
+extern _Float128 __ieee754_logf128 (_Float128);
+extern _Float128 __ieee754_atanhf128 (_Float128);
+extern _Float128 __ieee754_asinf128 (_Float128);
+extern _Float128 __ieee754_atan2f128 (_Float128,_Float128);
+extern _Float128 __ieee754_expf128 (_Float128);
+extern _Float128 __ieee754_exp2f128 (_Float128);
+extern _Float128 __ieee754_exp10f128 (_Float128);
+extern _Float128 __ieee754_coshf128 (_Float128);
+extern _Float128 __ieee754_fmodf128 (_Float128,_Float128);
+extern _Float128 __ieee754_powf128 (_Float128,_Float128);
+extern _Float128 __ieee754_lgammaf128_r (_Float128,int *);
+extern _Float128 __ieee754_gammaf128_r (_Float128,int *);
+extern _Float128 __ieee754_lgammaf128 (_Float128);
+extern _Float128 __ieee754_gammaf128 (_Float128);
+extern _Float128 __ieee754_log10f128 (_Float128);
+extern _Float128 __ieee754_log2f128 (_Float128);
+extern _Float128 __ieee754_sinhf128 (_Float128);
+extern _Float128 __ieee754_hypotf128 (_Float128,_Float128);
+extern _Float128 __ieee754_j0f128 (_Float128);
+extern _Float128 __ieee754_j1f128 (_Float128);
+extern _Float128 __ieee754_y0f128 (_Float128);
+extern _Float128 __ieee754_y1f128 (_Float128);
+extern _Float128 __ieee754_jnf128 (int,_Float128);
+extern _Float128 __ieee754_ynf128 (int,_Float128);
+extern _Float128 __ieee754_remainderf128 (_Float128,_Float128);
+extern int __ieee754_rem_pio2f128 (_Float128,_Float128*);
+extern _Float128 __ieee754_scalbf128 (_Float128,_Float128);
+extern int __ieee754_ilogbf128 (_Float128);
+extern _Float128 __kernel_sinf128 (_Float128,_Float128,int);
+extern _Float128 __kernel_cosf128 (_Float128,_Float128);
+extern _Float128 __kernel_tanf128 (_Float128,_Float128,int);
+extern void __kernel_sincosf128 (_Float128,_Float128,
+ _Float128 *,_Float128 *, int);
+extern int __kernel_rem_pio2f128 (_Float128*,_Float128*,int,int,
+ int,const int*);
+extern int __finitef128 (_Float128);
+extern int __ilogbf128 (_Float128);
+extern int __isinff128 (_Float128);
+extern int __isnanf128 (_Float128);
+extern _Float128 __atanf128 (_Float128);
+extern _Float128 __copysignf128 (_Float128, _Float128);
+extern _Float128 __expm1f128 (_Float128);
+extern _Float128 __floorf128 (_Float128);
+extern _Float128 __frexpf128 (_Float128, int *);
+extern _Float128 __ldexpf128 (_Float128, int);
+extern _Float128 __log1pf128 (_Float128);
+extern _Float128 __nanf128 (const char *);
+extern _Float128 __rintf128 (_Float128);
+extern _Float128 __scalbnf128 (_Float128, int);
+extern _Float128 __sqrtf128 (_Float128 x);
+extern _Float128 fabsf128 (_Float128 x);
+extern void __sincosf128 (_Float128, _Float128 *, _Float128 *);
+extern _Float128 __logbf128 (_Float128 x);
+extern _Float128 __significandf128 (_Float128 x);
+extern _Float128 __x2y2m1f128 (_Float128 x, _Float128 y);
+extern _Float128 __gamma_productf128 (_Float128 x, _Float128 x_eps,
+ int n, _Float128 *eps);
+extern _Float128 __lgamma_negf128 (_Float128 x, int *signgamp);
+extern _Float128 __lgamma_productf128 (_Float128 t, _Float128 x,
+ _Float128 x_eps, int n);
+
+/* Fixup some builtins on compilers which support __float128 and not
+ _Float128. */
+# if __GNUC_PREREQ (7, 0)
+# define BUILTIN_FABSF128 __builtin_fabsf128
+# define BUILTIN_COPYSIGNF128 __builtin_copysignf128
+# else
+# define BUILTIN_FABSF128 __builtin_fabsq
+# define BUILTIN_COPYSIGNF128 __builtin_copysignq
+
+
+/* __builtin_isinf_sign is broken in GCC < 7 for float128. */
+# include <ieee754_float128.h>
+extern inline int __isinff128(_Float128 x)
+{
+ int64_t hx,lx;
+ GET_FLOAT128_WORDS64 (hx,lx,x);
+ lx |= (hx & 0x7fffffffffffffffLL) ^ 0x7fff000000000000LL;
+ lx |= -lx;
+ return ~(lx >> 63) & (hx >> 62);
+}
+# endif
+
+extern inline _Float128 __copysignf128 (_Float128 x, _Float128 y)
+{ return BUILTIN_COPYSIGNF128 (x, y); }
+extern inline _Float128 fabsf128 (_Float128 x)
+{ return BUILTIN_FABSF128 (x); }
+#endif
+
/* We need to guarantee an expansion of name when building
ldbl-128 files as another type (e.g _Float128). */
#define mathx_hidden_def(name) hidden_def(name)
@@ -431,18 +528,28 @@ extern long double __lgamma_productl (long double t, long double x,
})
#endif
+#if __USE_FLOAT128
+# define __EXPR_FLT128(x, yes, no) \
+ __builtin_choose_expr (__builtin_types_compatible_p \
+ (__typeof (x), long double), no, yes)
+#else
+# define __EXPR_FLT128(x, yes, no) no
+#endif
+
#define fabs_tg(x) __builtin_choose_expr \
(__builtin_types_compatible_p (__typeof (x), float), \
__builtin_fabsf (x), \
__builtin_choose_expr \
(__builtin_types_compatible_p (__typeof (x), double), \
- __builtin_fabs (x), __builtin_fabsl (x)))
+ __builtin_fabs (x), \
+ __EXPR_FLT128 (x, BUILTIN_FABSF128 (x), __builtin_fabsl (x))))
#define min_of_type(type) __builtin_choose_expr \
(__builtin_types_compatible_p (type, float), \
FLT_MIN, \
__builtin_choose_expr \
(__builtin_types_compatible_p (type, double), \
- DBL_MIN, LDBL_MIN))
+ DBL_MIN, \
+ __EXPR_FLT128 (x, FLT128_MIN, LDBL_MIN)))
/* If X (which is not a NaN) is subnormal, force an underflow
exception. */
diff --git a/sysdeps/ieee754/ldbl-opt/s_sin.c b/sysdeps/ieee754/ldbl-opt/s_sin.c
index 04e60e2..6932ccc 100644
--- a/sysdeps/ieee754/ldbl-opt/s_sin.c
+++ b/sysdeps/ieee754/ldbl-opt/s_sin.c
@@ -4,6 +4,7 @@
#define __DECL_SIMD_sincos_disable
#define __DECL_SIMD_sincos_disablef
#define __DECL_SIMD_sincos_disablel
+#define __DECL_SIMD_sincos_disablef128
#include <math_ldbl_opt.h>
#undef NAN
#undef sincos
--
2.4.11
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 7/8] float128: Add private _Float128 declarations for libm.
2016-11-09 18:41 ` [PATCH 7/8] float128: Add private _Float128 declarations for libm Gabriel F. T. Gomes
@ 2016-11-09 22:08 ` Joseph Myers
2016-11-10 22:13 ` Joseph Myers
1 sibling, 0 replies; 33+ messages in thread
From: Joseph Myers @ 2016-11-09 22:08 UTC (permalink / raw)
To: Gabriel F. T. Gomes; +Cc: libc-alpha
On Wed, 9 Nov 2016, Gabriel F. T. Gomes wrote:
> +/* __builtin_isinf_sign is broken in GCC < 7 for float128. */
> +# include <ieee754_float128.h>
> +extern inline int __isinff128(_Float128 x)
> +{
> + int64_t hx,lx;
> + GET_FLOAT128_WORDS64 (hx,lx,x);
> + lx |= (hx & 0x7fffffffffffffffLL) ^ 0x7fff000000000000LL;
> + lx |= -lx;
> + return ~(lx >> 63) & (hx >> 62);
> +}
> +# endif
> +
> +extern inline _Float128 __copysignf128 (_Float128 x, _Float128 y)
> +{ return BUILTIN_COPYSIGNF128 (x, y); }
> +extern inline _Float128 fabsf128 (_Float128 x)
> +{ return BUILTIN_FABSF128 (x); }
> +#endif
New code should be formatted in GNU style.
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 7/8] float128: Add private _Float128 declarations for libm.
2016-11-09 18:41 ` [PATCH 7/8] float128: Add private _Float128 declarations for libm Gabriel F. T. Gomes
2016-11-09 22:08 ` Joseph Myers
@ 2016-11-10 22:13 ` Joseph Myers
1 sibling, 0 replies; 33+ messages in thread
From: Joseph Myers @ 2016-11-10 22:13 UTC (permalink / raw)
To: Gabriel F. T. Gomes; +Cc: libc-alpha
The internal function declarations, hidden_proto calls etc. in this patch
are another case that would best be macroized with only the macro
definitions depending on float128 support. Especially these ones:
> +/* Float128 variants. */
> +#if __USE_FLOAT128
> +extern _Float128 __ieee754_sqrtf128 (_Float128);
> +extern _Float128 __ieee754_acosf128 (_Float128);
[...]
as the largest block of code repeating something done for other types.
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 33+ messages in thread
* [PATCH 1/8] ldbl-128: Use mathx_hidden_def inplace of hidden_def
2016-11-09 18:41 [PATCH 0/8] More float128 declarations Gabriel F. T. Gomes
` (3 preceding siblings ...)
2016-11-09 18:41 ` [PATCH 7/8] float128: Add private _Float128 declarations for libm Gabriel F. T. Gomes
@ 2016-11-09 18:41 ` Gabriel F. T. Gomes
2016-11-09 18:41 ` [PATCH 3/8] float128: Add wrappers for IEEE functions Gabriel F. T. Gomes
` (3 subsequent siblings)
8 siblings, 0 replies; 33+ messages in thread
From: Gabriel F. T. Gomes @ 2016-11-09 18:41 UTC (permalink / raw)
To: libc-alpha
From: "Paul E. Murphy" <murphyp@linux.vnet.ibm.com>
This provides a extra macro expansion before invoking
the hidden_def macro. This is necessary to build the
ldbl-128 files as float128 correctly.
* sysdeps/generic/math_private.h:
(mathx_hidden_def): New macro.
* sysdeps/ieee754/ldbl-128/s_finitel.c: Replace hidden_def with
the above.
* sysdeps/ieee754/ldbl-128/s_isinfl.c: Likewise.
* sysdeps/ieee754/ldbl-128/s_isnanl.c: Likewise.
---
sysdeps/generic/math_private.h | 4 ++++
sysdeps/ieee754/ldbl-128/s_finitel.c | 2 +-
sysdeps/ieee754/ldbl-128/s_isinfl.c | 2 +-
sysdeps/ieee754/ldbl-128/s_isnanl.c | 2 +-
4 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/sysdeps/generic/math_private.h b/sysdeps/generic/math_private.h
index 28e5df0..cc9681c 100644
--- a/sysdeps/generic/math_private.h
+++ b/sysdeps/generic/math_private.h
@@ -181,6 +181,10 @@ do { \
} while (0)
#endif
+/* We need to guarantee an expansion of name when building
+ ldbl-128 files as another type (e.g _Float128). */
+#define mathx_hidden_def(name) hidden_def(name)
+
/* Get long double macros from a separate header. */
#include <math_ldbl.h>
diff --git a/sysdeps/ieee754/ldbl-128/s_finitel.c b/sysdeps/ieee754/ldbl-128/s_finitel.c
index feb4590..7c69968 100644
--- a/sysdeps/ieee754/ldbl-128/s_finitel.c
+++ b/sysdeps/ieee754/ldbl-128/s_finitel.c
@@ -32,5 +32,5 @@ int __finitel(_Float128 x)
return (int)((u_int64_t)((hx&0x7fff000000000000LL)
-0x7fff000000000000LL)>>63);
}
-hidden_def (__finitel)
+mathx_hidden_def (__finitel)
weak_alias (__finitel, finitel)
diff --git a/sysdeps/ieee754/ldbl-128/s_isinfl.c b/sysdeps/ieee754/ldbl-128/s_isinfl.c
index dce8fc0..a41e8cf 100644
--- a/sysdeps/ieee754/ldbl-128/s_isinfl.c
+++ b/sysdeps/ieee754/ldbl-128/s_isinfl.c
@@ -25,5 +25,5 @@ __isinfl (_Float128 x)
lx |= -lx;
return ~(lx >> 63) & (hx >> 62);
}
-hidden_def (__isinfl)
+mathx_hidden_def (__isinfl)
weak_alias (__isinfl, isinfl)
diff --git a/sysdeps/ieee754/ldbl-128/s_isnanl.c b/sysdeps/ieee754/ldbl-128/s_isnanl.c
index 1dee642..80f97fe 100644
--- a/sysdeps/ieee754/ldbl-128/s_isnanl.c
+++ b/sysdeps/ieee754/ldbl-128/s_isnanl.c
@@ -34,5 +34,5 @@ int __isnanl(_Float128 x)
hx = 0x7fff000000000000LL - hx;
return (int)((u_int64_t)hx>>63);
}
-hidden_def (__isnanl)
+mathx_hidden_def (__isnanl)
weak_alias (__isnanl, isnanl)
--
2.4.11
^ permalink raw reply [flat|nested] 33+ messages in thread
* [PATCH 3/8] float128: Add wrappers for IEEE functions.
2016-11-09 18:41 [PATCH 0/8] More float128 declarations Gabriel F. T. Gomes
` (4 preceding siblings ...)
2016-11-09 18:41 ` [PATCH 1/8] ldbl-128: Use mathx_hidden_def inplace of hidden_def Gabriel F. T. Gomes
@ 2016-11-09 18:41 ` Gabriel F. T. Gomes
2016-11-09 21:38 ` Joseph Myers
2016-11-09 18:41 ` [PATCH 8/8] float128: Add wrappers to override ldbl-128 as float128 Gabriel F. T. Gomes
` (2 subsequent siblings)
8 siblings, 1 reply; 33+ messages in thread
From: Gabriel F. T. Gomes @ 2016-11-09 18:41 UTC (permalink / raw)
To: libc-alpha
From: "Paul E. Murphy" <murphyp@linux.vnet.ibm.com>
These are copied from the long double version. posix style
errors are assumed, and inlined. Where a function is not
defined by TS 18661-3, the wrapper is not implemented.
* sysdeps/ieee754/float128/w_acosf128.c: New file.
* sysdeps/ieee754/float128/w_acoshf128.c: Likewise
* sysdeps/ieee754/float128/w_asinf128.c: Likewise
* sysdeps/ieee754/float128/w_atan2f128.c: Likewise
* sysdeps/ieee754/float128/w_atanhf128.c: Likewise
* sysdeps/ieee754/float128/w_coshf128.c: Likewise
* sysdeps/ieee754/float128/w_exp10f128.c: Likewise
* sysdeps/ieee754/float128/w_exp2f128.c: Likewise
* sysdeps/ieee754/float128/w_expf128.c: Likewise
* sysdeps/ieee754/float128/w_fmodf128.c: Likewise
* sysdeps/ieee754/float128/w_hypotf128.c: Likewise
* sysdeps/ieee754/float128/w_j0f128.c: Likewise
* sysdeps/ieee754/float128/w_j1f128.c: Likewise
* sysdeps/ieee754/float128/w_jnf128.c: Likewise
* sysdeps/ieee754/float128/w_lgammaf128.c: Likewise
* sysdeps/ieee754/float128/w_lgammaf128_r.c: Likewise
* sysdeps/ieee754/float128/w_log10f128.c: Likewise
* sysdeps/ieee754/float128/w_log2f128.c: Likewise
* sysdeps/ieee754/float128/w_logf128.c: Likewise
* sysdeps/ieee754/float128/w_powf128.c: Likewise
* sysdeps/ieee754/float128/w_remainderf128.c: Likewise
* sysdeps/ieee754/float128/w_sinhf128.c: Likewise
* sysdeps/ieee754/float128/w_sqrtf128.c: Likewise
* sysdeps/ieee754/float128/w_tgammaf128.c: Likewise
* sysdeps/ieee754/float128/w_ilogbf128.c: Likewise
* sysdeps/ieee754/float128/w_log1pf128.c: Likewise
* sysdeps/ieee754/float128/w_scalbf128.c: Likewise
* sysdeps/ieee754/float128/w_scalblnf128.c: Likewise
---
sysdeps/ieee754/float128/w_acosf128.c | 35 ++++++++++++
sysdeps/ieee754/float128/w_acoshf128.c | 35 ++++++++++++
sysdeps/ieee754/float128/w_asinf128.c | 37 +++++++++++++
sysdeps/ieee754/float128/w_atan2f128.c | 35 ++++++++++++
sysdeps/ieee754/float128/w_atanhf128.c | 40 ++++++++++++++
sysdeps/ieee754/float128/w_coshf128.c | 33 ++++++++++++
sysdeps/ieee754/float128/w_exp10f128.c | 38 +++++++++++++
sysdeps/ieee754/float128/w_exp2f128.c | 36 +++++++++++++
sysdeps/ieee754/float128/w_expf128.c | 34 ++++++++++++
sysdeps/ieee754/float128/w_fmodf128.c | 37 +++++++++++++
sysdeps/ieee754/float128/w_hypotf128.c | 34 ++++++++++++
sysdeps/ieee754/float128/w_ilogbf128.c | 38 +++++++++++++
sysdeps/ieee754/float128/w_j0f128.c | 56 +++++++++++++++++++
sysdeps/ieee754/float128/w_j1f128.c | 55 +++++++++++++++++++
sysdeps/ieee754/float128/w_jnf128.c | 75 ++++++++++++++++++++++++++
sysdeps/ieee754/float128/w_lgammaf128.c | 34 ++++++++++++
sysdeps/ieee754/float128/w_lgammaf128_r.c | 34 ++++++++++++
sysdeps/ieee754/float128/w_log10f128.c | 44 +++++++++++++++
sysdeps/ieee754/float128/w_log1pf128.c | 36 +++++++++++++
sysdeps/ieee754/float128/w_log2f128.c | 44 +++++++++++++++
sysdeps/ieee754/float128/w_logf128.c | 44 +++++++++++++++
sysdeps/ieee754/float128/w_powf128.c | 86 ++++++++++++++++++++++++++++++
sysdeps/ieee754/float128/w_remainderf128.c | 35 ++++++++++++
sysdeps/ieee754/float128/w_scalbf128.c | 1 +
sysdeps/ieee754/float128/w_scalblnf128.c | 36 +++++++++++++
sysdeps/ieee754/float128/w_sinhf128.c | 35 ++++++++++++
sysdeps/ieee754/float128/w_sqrtf128.c | 35 ++++++++++++
sysdeps/ieee754/float128/w_tgammaf128.c | 54 +++++++++++++++++++
28 files changed, 1136 insertions(+)
create mode 100644 sysdeps/ieee754/float128/w_acosf128.c
create mode 100644 sysdeps/ieee754/float128/w_acoshf128.c
create mode 100644 sysdeps/ieee754/float128/w_asinf128.c
create mode 100644 sysdeps/ieee754/float128/w_atan2f128.c
create mode 100644 sysdeps/ieee754/float128/w_atanhf128.c
create mode 100644 sysdeps/ieee754/float128/w_coshf128.c
create mode 100644 sysdeps/ieee754/float128/w_exp10f128.c
create mode 100644 sysdeps/ieee754/float128/w_exp2f128.c
create mode 100644 sysdeps/ieee754/float128/w_expf128.c
create mode 100644 sysdeps/ieee754/float128/w_fmodf128.c
create mode 100644 sysdeps/ieee754/float128/w_hypotf128.c
create mode 100644 sysdeps/ieee754/float128/w_ilogbf128.c
create mode 100644 sysdeps/ieee754/float128/w_j0f128.c
create mode 100644 sysdeps/ieee754/float128/w_j1f128.c
create mode 100644 sysdeps/ieee754/float128/w_jnf128.c
create mode 100644 sysdeps/ieee754/float128/w_lgammaf128.c
create mode 100644 sysdeps/ieee754/float128/w_lgammaf128_r.c
create mode 100644 sysdeps/ieee754/float128/w_log10f128.c
create mode 100644 sysdeps/ieee754/float128/w_log1pf128.c
create mode 100644 sysdeps/ieee754/float128/w_log2f128.c
create mode 100644 sysdeps/ieee754/float128/w_logf128.c
create mode 100644 sysdeps/ieee754/float128/w_powf128.c
create mode 100644 sysdeps/ieee754/float128/w_remainderf128.c
create mode 100644 sysdeps/ieee754/float128/w_scalbf128.c
create mode 100644 sysdeps/ieee754/float128/w_scalblnf128.c
create mode 100644 sysdeps/ieee754/float128/w_sinhf128.c
create mode 100644 sysdeps/ieee754/float128/w_sqrtf128.c
create mode 100644 sysdeps/ieee754/float128/w_tgammaf128.c
diff --git a/sysdeps/ieee754/float128/w_acosf128.c b/sysdeps/ieee754/float128/w_acosf128.c
new file mode 100644
index 0000000..cedbc98
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_acosf128.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 2016 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 <fenv.h>
+#include <math.h>
+#include <math_private.h>
+
+_Float128
+__acosf128 (_Float128 x)
+{
+ if (__builtin_expect (isgreater (fabsf128 (x), 1), 0))
+ {
+ /* acos(|x|>1) */
+ feraiseexcept (FE_INVALID);
+ __set_errno (EDOM);
+ return NAN;
+ }
+
+ return __ieee754_acosf128 (x);
+}
+weak_alias (__acosf128, acosf128)
diff --git a/sysdeps/ieee754/float128/w_acoshf128.c b/sysdeps/ieee754/float128/w_acoshf128.c
new file mode 100644
index 0000000..3dea220
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_acoshf128.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 2016 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 <math_private.h>
+
+static _Float128 zero = 0;
+
+_Float128
+__acoshf128 (_Float128 x)
+{
+ if (__builtin_expect (isless (x, 1), 0))
+ {
+ /* acosh(x<1) */
+ __set_errno (EDOM);
+ return zero / zero;
+ }
+
+ return __ieee754_acoshf128 (x);
+}
+weak_alias (__acoshf128, acoshf128)
diff --git a/sysdeps/ieee754/float128/w_asinf128.c b/sysdeps/ieee754/float128/w_asinf128.c
new file mode 100644
index 0000000..e92f16a
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_asinf128.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 2016 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 <fenv.h>
+#include <math.h>
+#include <math_private.h>
+
+
+/* wrapper asinf128 */
+_Float128
+__asinf128 (_Float128 x)
+{
+ if (__builtin_expect (isgreater (fabsf128 (x), 1), 0))
+ {
+ /* asin(|x|>1) */
+ feraiseexcept (FE_INVALID);
+ __set_errno (EDOM);
+ return NAN;
+ }
+
+ return __ieee754_asinf128 (x);
+}
+weak_alias (__asinf128, asinf128)
diff --git a/sysdeps/ieee754/float128/w_atan2f128.c b/sysdeps/ieee754/float128/w_atan2f128.c
new file mode 100644
index 0000000..c58183b
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_atan2f128.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 2016 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/>. */
+
+/*
+ * wrapper atan2f128(y,x)
+ */
+
+#include <errno.h>
+#include <math.h>
+#include <math_private.h>
+
+
+_Float128
+__atan2f128 (_Float128 y, _Float128 x)
+{
+ _Float128 z = __ieee754_atan2f128 (y, x);
+ if (__glibc_unlikely (z == 0 && y != 0 && isfinite (x)))
+ __set_errno (ERANGE);
+ return z;
+}
+weak_alias (__atan2f128, atan2f128)
diff --git a/sysdeps/ieee754/float128/w_atanhf128.c b/sysdeps/ieee754/float128/w_atanhf128.c
new file mode 100644
index 0000000..d997b0c
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_atanhf128.c
@@ -0,0 +1,40 @@
+/* Copyright (C) 2016 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 <math_private.h>
+
+static _Float128 zero = 0;
+
+/* wrapper atanhf128 */
+_Float128
+__atanhf128 (_Float128 x)
+{
+ _Float128 fabs_x = fabsf128 (x);
+ if (__builtin_expect (isgreaterequal (fabs_x, 1), 0))
+ {
+ if (fabs_x > 1)
+ {
+ __set_errno (EDOM);
+ return zero / zero;
+ }
+ __set_errno (ERANGE);
+ return x / zero;
+ }
+ return __ieee754_atanhf128 (x);
+}
+weak_alias (__atanhf128, atanhf128)
diff --git a/sysdeps/ieee754/float128/w_coshf128.c b/sysdeps/ieee754/float128/w_coshf128.c
new file mode 100644
index 0000000..09fdaa7
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_coshf128.c
@@ -0,0 +1,33 @@
+/* w_acoshf128.c -- _Float128 version of w_acosh.c.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ * wrapper coshf128(x)
+ */
+
+#include <math.h>
+#include <math_private.h>
+
+_Float128
+__coshf128 (_Float128 x)
+{
+ _Float128 z = __ieee754_coshf128 (x);
+ if (__builtin_expect (!isfinite (z), 0) && isfinite (x))
+ {
+ __set_errno (ERANGE);
+ return HUGE_VAL_F128;
+ }
+ return z;
+}
+weak_alias (__coshf128, coshf128)
diff --git a/sysdeps/ieee754/float128/w_exp10f128.c b/sysdeps/ieee754/float128/w_exp10f128.c
new file mode 100644
index 0000000..8bbd850
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_exp10f128.c
@@ -0,0 +1,38 @@
+/* Copyright (C) 2016 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/>. */
+
+
+/*
+ * wrapper exp10f128(x)
+ */
+
+#include <math.h>
+#include <math_private.h>
+
+_Float128
+__exp10f128 (_Float128 x)
+{
+ _Float128 z = __ieee754_exp10f128 (x);
+ if (__builtin_expect (!isfinite (z) || z == 0, 0) && isfinite (x))
+ {
+ /* exp10f128 overflow if x > 0, underflow if x < 0. */
+ __set_errno (ERANGE);
+ return signbit (x) == 0 ? HUGE_VAL_F128 : 0;
+ }
+ return z;
+}
+weak_alias (__exp10f128, exp10f128)
diff --git a/sysdeps/ieee754/float128/w_exp2f128.c b/sysdeps/ieee754/float128/w_exp2f128.c
new file mode 100644
index 0000000..59e7acd
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_exp2f128.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 2016 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/>. */
+
+/*
+ * wrapper exp2f128(x)
+ */
+
+#include <math.h>
+#include <math_private.h>
+
+_Float128
+__exp2f128 (_Float128 x)
+{
+ _Float128 z = __ieee754_exp2f128 (x);
+ if (__builtin_expect (!isfinite (z) || z == 0, 0) && isfinite (x))
+ {
+ __set_errno (ERANGE);
+ return signbit (x) == 0 ? HUGE_VAL_F128 : 0;
+ }
+ return z;
+}
+weak_alias (__exp2f128, exp2f128)
diff --git a/sysdeps/ieee754/float128/w_expf128.c b/sysdeps/ieee754/float128/w_expf128.c
new file mode 100644
index 0000000..4fe7426
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_expf128.c
@@ -0,0 +1,34 @@
+/* w_expf128.c -- _Float128 version of w_exp.c.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ * wrapper expf128(x)
+ */
+
+#include <math.h>
+#include <math_private.h>
+
+_Float128
+__expf128(_Float128 x)
+{
+ _Float128 z = __ieee754_expf128 (x);
+ if (__glibc_unlikely (!isfinite (z) || z == 0) && isfinite (x))
+ {
+ __set_errno (ERANGE);
+ return signbit (x) == 0 ? HUGE_VAL_F128 : 0;
+ }
+ return z;
+}
+hidden_def (__expf128)
+weak_alias (__expf128, expf128)
diff --git a/sysdeps/ieee754/float128/w_fmodf128.c b/sysdeps/ieee754/float128/w_fmodf128.c
new file mode 100644
index 0000000..82fcd51
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_fmodf128.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 2016 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 <math_private.h>
+
+static _Float128 zero = 0;
+
+/* wrapper fmodf128 */
+_Float128
+__fmodf128 (_Float128 x, _Float128 y)
+{
+ if (__builtin_expect (isinf (x) || y == 0, 0)
+ && !isnan (y) && !isnan (x))
+ {
+ /* fmod(+-Inf,y) or fmod(x,0) */
+ __set_errno (EDOM);
+ return zero / zero;
+ }
+
+ return __ieee754_fmodf128 (x, y);
+}
+weak_alias (__fmodf128, fmodf128)
diff --git a/sysdeps/ieee754/float128/w_hypotf128.c b/sysdeps/ieee754/float128/w_hypotf128.c
new file mode 100644
index 0000000..c497e16
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_hypotf128.c
@@ -0,0 +1,34 @@
+/* w_hypotf128.c -- _Float128 version of w_hypot.c.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ * wrapper hypotf128(x,y)
+ */
+
+#include <math.h>
+#include <math_private.h>
+
+_Float128
+__hypotf128(_Float128 x, _Float128 y)
+{
+ _Float128 z;
+ z = __ieee754_hypotf128 (x,y);
+ if(__builtin_expect (!isfinite (z), 0) && isfinite (x) && isfinite (y))
+ {
+ __set_errno (ERANGE);
+ return HUGE_VAL_F128;
+ }
+ return z;
+}
+weak_alias (__hypotf128, hypotf128)
diff --git a/sysdeps/ieee754/float128/w_ilogbf128.c b/sysdeps/ieee754/float128/w_ilogbf128.c
new file mode 100644
index 0000000..9b162b2
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_ilogbf128.c
@@ -0,0 +1,38 @@
+/* Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Adhemerval Zanella <azanella@linux.vnet.ibm.com>, 2011.
+
+ 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 <errno.h>
+#include <limits.h>
+#include <math_private.h>
+
+/* wrapper ilogbf128 */
+int
+__ilogbf128 (_Float128 x)
+{
+ int r = __ieee754_ilogbf128 (x);
+ if (__builtin_expect (r == FP_ILOGB0, 0)
+ || __builtin_expect (r == FP_ILOGBNAN, 0)
+ || __builtin_expect (r == INT_MAX, 0))
+ {
+ __set_errno (EDOM);
+ feraiseexcept (FE_INVALID);
+ }
+ return r;
+}
+weak_alias (__ilogbf128, ilogbf128)
diff --git a/sysdeps/ieee754/float128/w_j0f128.c b/sysdeps/ieee754/float128/w_j0f128.c
new file mode 100644
index 0000000..cfd036d
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_j0f128.c
@@ -0,0 +1,56 @@
+/* Copyright (C) 2016 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 <fenv.h>
+#include <math.h>
+#include <math_private.h>
+
+
+/* wrapper j0f128 */
+_Float128
+__j0f128 (_Float128 x)
+{
+ return __ieee754_j0f128 (x);
+}
+weak_alias (__j0f128, j0f128)
+
+
+/* wrapper y0f128 */
+_Float128
+__y0f128 (_Float128 x)
+{
+ if (__builtin_expect (islessequal (x, 0) || isgreater (x, X_TLOSS), 0))
+ {
+ if (x < 0)
+ {
+ /* d = zero/(x-x) */
+ feraiseexcept (FE_INVALID);
+ __set_errno (EDOM);
+ return NAN;
+ }
+ else if (x == 0)
+ {
+ /* d = -one/(x-x) */
+ feraiseexcept (FE_DIVBYZERO);
+ __set_errno (ERANGE);
+ return -HUGE_VAL_F128;
+ }
+ }
+
+ return __ieee754_y0f128 (x);
+}
+weak_alias (__y0f128, y0f128)
diff --git a/sysdeps/ieee754/float128/w_j1f128.c b/sysdeps/ieee754/float128/w_j1f128.c
new file mode 100644
index 0000000..2a6b956
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_j1f128.c
@@ -0,0 +1,55 @@
+/* Copyright (C) 2016 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 <fenv.h>
+#include <math.h>
+#include <math_private.h>
+
+
+/* wrapper j1f128 */
+_Float128
+__j1f128 (_Float128 x)
+{
+ return __ieee754_j1f128 (x);
+}
+weak_alias (__j1f128, j1f128)
+
+
+/* wrapper y1f128 */
+_Float128
+__y1f128 (_Float128 x)
+{
+ if (__builtin_expect (islessequal (x, 0) || isgreater (x, X_TLOSS), 0))
+ {
+ if (x < 0)
+ {
+ /* d = zero/(x-x) */
+ feraiseexcept (FE_INVALID);
+ __set_errno (EDOM);
+ return NAN;
+ }
+ else if (x == 0)
+ {
+ /* d = -one/(x-x) */
+ feraiseexcept (FE_DIVBYZERO);
+ __set_errno (ERANGE);
+ return -HUGE_VAL_F128;
+ }
+ }
+ return __ieee754_y1f128 (x);
+}
+weak_alias (__y1f128, y1f128)
diff --git a/sysdeps/ieee754/float128/w_jnf128.c b/sysdeps/ieee754/float128/w_jnf128.c
new file mode 100644
index 0000000..5d59f78
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_jnf128.c
@@ -0,0 +1,75 @@
+/* w_jnf128.c -- _Float128 version of w_jn.c.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ * wrapper jn(int n, _Float128 x), yn(int n, _Float128 x)
+ * floating point Bessel's function of the 1st and 2nd kind
+ * of order n
+ *
+ * Special cases:
+ * y0(0)=y1(0)=yn(n,0) = -inf with division by zero signal;
+ * y0(-ve)=y1(-ve)=yn(n,-ve) are NaN with invalid signal.
+ * Note 2. About jn(n,x), yn(n,x)
+ * For n=0, j0(x) is called,
+ * for n=1, j1(x) is called,
+ * for n<x, forward recursion us used starting
+ * from values of j0(x) and j1(x).
+ * for n>x, a continued fraction approximation to
+ * j(n,x)/j(n-1,x) is evaluated and then backward
+ * recursion is used starting from a supposed value
+ * for j(n,x). The resulting value of j(0,x) is
+ * compared with the actual value to correct the
+ * supposed value of j(n,x).
+ *
+ * yn(n,x) is similar in all respects, except
+ * that forward recursion is used for all
+ * values of n>1.
+ *
+ */
+
+#include <math.h>
+#include <math_private.h>
+
+_Float128
+__jnf128 (int n, _Float128 x)
+{
+ return __ieee754_jnf128 (n, x);
+}
+weak_alias (__jnf128, jnf128)
+
+_Float128
+__ynf128 (int n, _Float128 x) /* wrapper ynf128 */
+{
+ _Float128 z = __ieee754_ynf128 (n, x);
+ if (isnan (x))
+ return z;
+
+ if (x <= 0)
+ {
+ if (x == 0)
+ {
+ /* d= -one/(x-x); */
+ __set_errno (ERANGE);
+ return n < 0 && (n & 1) != 0 ? HUGE_VAL_F128 : -HUGE_VAL_F128;
+ }
+ else
+ {
+ /* d = zero/(x-x); */
+ __set_errno (EDOM);
+ return NAN;
+ }
+ }
+ return z;
+}
+weak_alias (__ynf128, ynf128)
diff --git a/sysdeps/ieee754/float128/w_lgammaf128.c b/sysdeps/ieee754/float128/w_lgammaf128.c
new file mode 100644
index 0000000..cb23e65
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_lgammaf128.c
@@ -0,0 +1,34 @@
+/* w_lgammaf128.c -- _Float128 version of w_lgamma.c.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ * wrapper _Float128 lgammaf128(_Float128 x, int *signgamp)
+ */
+
+#include <math.h>
+#include <math_private.h>
+
+_Float128
+__lgammaf128 (_Float128 x)
+{
+ _Float128 y = __ieee754_lgammaf128_r (x, &__signgam);
+ if (__builtin_expect( !isfinite (y), 0) && isfinite (x))
+ {
+ __set_errno (ERANGE);
+ return HUGE_VAL_F128;
+ }
+ return y;
+}
+
+weak_alias (__lgammaf128, lgammaf128)
diff --git a/sysdeps/ieee754/float128/w_lgammaf128_r.c b/sysdeps/ieee754/float128/w_lgammaf128_r.c
new file mode 100644
index 0000000..626c6a8
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_lgammaf128_r.c
@@ -0,0 +1,34 @@
+/* w_lgammaf128_r.c -- _Float128 version of w_lgamma_r.c.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ * wrapper _Float128 lgammaf128_r(_Float128 x, int *signgamp)
+ */
+
+#include <math.h>
+#include <math_private.h>
+
+
+_Float128
+__lgammaf128_r(_Float128 x, int *signgamp)
+{
+ _Float128 y = __ieee754_lgammaf128_r (x, signgamp);
+ if (__builtin_expect (!isfinite (y), 0) && isfinite (x))
+ {
+ __set_errno (ERANGE);
+ return HUGE_VAL_F128;
+ }
+ return y;
+}
+weak_alias (__lgammaf128_r, lgammaf128_r)
diff --git a/sysdeps/ieee754/float128/w_log10f128.c b/sysdeps/ieee754/float128/w_log10f128.c
new file mode 100644
index 0000000..aeb0ffc
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_log10f128.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 2016 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 <fenv.h>
+#include <math.h>
+#include <math_private.h>
+
+
+/* wrapper log10f128(x) */
+_Float128
+__log10f128 (_Float128 x)
+{
+ if (__builtin_expect (islessequal (x, 0), 0))
+ {
+ if (x == 0)
+ {
+ feraiseexcept (FE_DIVBYZERO);
+ __set_errno (ERANGE);
+ return -HUGE_VAL_F128;
+ }
+ else
+ {
+ feraiseexcept (FE_INVALID);
+ __set_errno (EDOM);
+ return NAN;
+ }
+ }
+ return __ieee754_log10f128 (x);
+}
+weak_alias (__log10f128, log10f128)
diff --git a/sysdeps/ieee754/float128/w_log1pf128.c b/sysdeps/ieee754/float128/w_log1pf128.c
new file mode 100644
index 0000000..359610c
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_log1pf128.c
@@ -0,0 +1,36 @@
+/* Wrapper for __log1pf128 that handles setting errno.
+ Copyright (C) 2016 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 <errno.h>
+#include <math.h>
+#include <math_private.h>
+
+_Float128
+__w_log1pf128 (_Float128 x)
+{
+ if (__glibc_unlikely (islessequal (x, -1)))
+ {
+ if (x == -1)
+ __set_errno (ERANGE);
+ else
+ __set_errno (EDOM);
+ }
+
+ return __log1pf128 (x);
+}
+weak_alias (__w_log1pf128, log1pf128)
diff --git a/sysdeps/ieee754/float128/w_log2f128.c b/sysdeps/ieee754/float128/w_log2f128.c
new file mode 100644
index 0000000..8d28c58
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_log2f128.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 2016 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 <fenv.h>
+#include <math.h>
+#include <math_private.h>
+
+
+/* wrapper log2f128(x) */
+_Float128
+__log2f128 (_Float128 x)
+{
+ if (__builtin_expect (islessequal (x, 0), 0))
+ {
+ if (x == 0)
+ {
+ feraiseexcept (FE_DIVBYZERO);
+ __set_errno (ERANGE);
+ return -HUGE_VAL_F128;
+ }
+ else
+ {
+ feraiseexcept (FE_INVALID);
+ __set_errno (EDOM);
+ return NAN;
+ }
+ }
+ return __ieee754_log2f128 (x);
+}
+weak_alias (__log2f128, log2f128)
diff --git a/sysdeps/ieee754/float128/w_logf128.c b/sysdeps/ieee754/float128/w_logf128.c
new file mode 100644
index 0000000..d031013
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_logf128.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 2016 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 <fenv.h>
+#include <math.h>
+#include <math_private.h>
+
+
+/* wrapper logf128(x) */
+_Float128
+__logf128 (_Float128 x)
+{
+ if (__builtin_expect (islessequal (x, 0), 0))
+ {
+ if (x == 0)
+ {
+ feraiseexcept (FE_DIVBYZERO);
+ __set_errno (ERANGE);
+ return -HUGE_VAL_F128;
+ }
+ else
+ {
+ feraiseexcept (FE_INVALID);
+ __set_errno (EDOM);
+ return NAN;
+ }
+ }
+ return __ieee754_logf128 (x);
+}
+weak_alias (__logf128, logf128)
diff --git a/sysdeps/ieee754/float128/w_powf128.c b/sysdeps/ieee754/float128/w_powf128.c
new file mode 100644
index 0000000..e17aff1
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_powf128.c
@@ -0,0 +1,86 @@
+/* Copyright (C) 2016 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 <math_private.h>
+
+static _Float128 zero = 0;
+
+/* wrapper powf128 */
+_Float128
+__powf128 (_Float128 x, _Float128 y)
+{
+ _Float128 z = __ieee754_powf128 (x, y);
+ if (__glibc_unlikely (!isfinite (z)))
+ {
+ if (isnan (x))
+ {
+ if (y == 0)
+ {
+ /* pow(NaN,0.0) */
+ return 1;
+ }
+ }
+ else if (isfinite (x) && isfinite (y))
+ {
+ if (isnan (z))
+ {
+ /* pow neg**non-int */
+ __set_errno (EDOM);
+ return zero / zero;
+ }
+ else if (x == 0 && y < 0)
+ {
+ __set_errno (ERANGE);
+ return signbit (x) && signbit (z) ?
+ -HUGE_VAL_F128 : HUGE_VAL_F128;
+ }
+ else
+ {
+ /* pow overflow */
+ _Float128 retval = HUGE_VAL_F128;
+ y *= __f128 (0.5);
+ if (x < 0 && __rintf128 (y) != y)
+ retval = -HUGE_VAL_F128;
+ __set_errno (ERANGE);
+ return retval;
+ }
+ }
+ }
+ else if (__builtin_expect (z == 0, 0) && isfinite (x) && isfinite (y))
+ {
+ if (x == 0)
+ {
+ if (y == 0)
+ {
+ return 1;
+ }
+ }
+ else
+ {
+ /* pow underflow */
+ _Float128 retval = 0;
+ y *= __f128 (0.5);
+ if (x < 0 && __rintf128 (y) != y)
+ retval = __f128 (-0.0);
+ __set_errno (ERANGE);
+ return retval;
+ }
+ }
+ return z;
+}
+weak_alias (__powf128, powf128)
diff --git a/sysdeps/ieee754/float128/w_remainderf128.c b/sysdeps/ieee754/float128/w_remainderf128.c
new file mode 100644
index 0000000..dcd4661
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_remainderf128.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 2016 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 <math_private.h>
+
+static _Float128 zero = 0;
+
+/* wrapper remainderf128 */
+_Float128
+__remainderf128 (_Float128 x, _Float128 y)
+{
+ if (((__builtin_expect (y == 0, 0) && !isnan (x))
+ || (__builtin_expect (isinf (x), 0) && !isnan (y))))
+ {
+ __set_errno (EDOM);
+ return zero / zero;
+ }
+ return __ieee754_remainderf128 (x, y);
+}
+weak_alias (__remainderf128, remainderf128)
diff --git a/sysdeps/ieee754/float128/w_scalbf128.c b/sysdeps/ieee754/float128/w_scalbf128.c
new file mode 100644
index 0000000..067b724
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_scalbf128.c
@@ -0,0 +1 @@
+/* Not defined for _FloatN types. */
diff --git a/sysdeps/ieee754/float128/w_scalblnf128.c b/sysdeps/ieee754/float128/w_scalblnf128.c
new file mode 100644
index 0000000..e4ef464
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_scalblnf128.c
@@ -0,0 +1,36 @@
+/* Wrapper for __scalblnf128 handles setting errno.
+ Copyright (C) 2016 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 <errno.h>
+#include <math.h>
+#include <math_private.h>
+
+_Float128
+__w_scalblnf128 (_Float128 x, long int n)
+{
+ if (!isfinite (x) || x == 0)
+ return x + x;
+
+ x = __scalblnf128 (x, n);
+
+ if (!isfinite (x) || x == 0)
+ __set_errno (ERANGE);
+
+ return x;
+}
+weak_alias (__w_scalblnf128, scalblnf128)
diff --git a/sysdeps/ieee754/float128/w_sinhf128.c b/sysdeps/ieee754/float128/w_sinhf128.c
new file mode 100644
index 0000000..df6515a
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_sinhf128.c
@@ -0,0 +1,35 @@
+/* w_sinhf128.c -- _Float128 version of w_sinh.c.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ * wrapper sinhf128(x)
+ */
+
+#include <math.h>
+#include <math_private.h>
+
+static _Float128 zero = 0.0;
+
+_Float128
+__sinhf128 (_Float128 x)
+{
+ _Float128 z = __ieee754_sinhf128 (x);
+ if (__builtin_expect (!isfinite (z), 0) && isfinite (x))
+ {
+ __set_errno (ERANGE);
+ return x > zero ? HUGE_VAL_F128 : -HUGE_VAL_F128;
+ }
+ return z;
+}
+weak_alias (__sinhf128, sinhf128)
diff --git a/sysdeps/ieee754/float128/w_sqrtf128.c b/sysdeps/ieee754/float128/w_sqrtf128.c
new file mode 100644
index 0000000..32c354c
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_sqrtf128.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 2016 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 <math_private.h>
+
+static _Float128 zero = 0;
+
+/* wrapper sqrtf128 */
+_Float128
+__sqrtf128 (_Float128 x)
+{
+ if (__builtin_expect (isless (x, 0), 0) && _LIB_VERSION != _IEEE_)
+ {
+ __set_errno (EDOM);
+ return zero / zero;
+ }
+
+ return __ieee754_sqrtf128 (x);
+}
+weak_alias (__sqrtf128, sqrtf128)
diff --git a/sysdeps/ieee754/float128/w_tgammaf128.c b/sysdeps/ieee754/float128/w_tgammaf128.c
new file mode 100644
index 0000000..5699d66
--- /dev/null
+++ b/sysdeps/ieee754/float128/w_tgammaf128.c
@@ -0,0 +1,54 @@
+/* w_tgammaf128.c -- _Float128 version of w_gamma.c.
+ */
+
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/* _Float128 gammaf128(_Float128 x)
+ * Return the Gamma function of x.
+ */
+
+#include <errno.h>
+#include <math.h>
+#include <math_private.h>
+
+_Float128
+__tgammaf128 (_Float128 x)
+{
+ int local_signgam;
+ _Float128 y = __ieee754_gammaf128_r (x, &local_signgam);
+
+ if (__glibc_unlikely (!isfinite (y) || y == 0)
+ && (isfinite (x) || (isinf (x) && x < 0)))
+ {
+ if (x == 0)
+ {
+ __set_errno (ERANGE);
+ return __copysignf128 (HUGE_VAL_F128, x);
+ }
+ else if (__floorf128 (x) == x && x < 0)
+ {
+ __set_errno (EDOM);
+ return NAN;
+ }
+ else if (y == 0)
+ {
+ __set_errno (ERANGE); /* tgamma underflow */
+ }
+ else
+ {
+ __set_errno (ERANGE);
+ return __copysignf128 (HUGE_VAL_F128, x);
+ }
+ }
+ return local_signgam < 0 ? - y : y;
+}
+weak_alias (__tgammaf128, tgammaf128)
--
2.4.11
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 3/8] float128: Add wrappers for IEEE functions.
2016-11-09 18:41 ` [PATCH 3/8] float128: Add wrappers for IEEE functions Gabriel F. T. Gomes
@ 2016-11-09 21:38 ` Joseph Myers
2016-12-05 16:48 ` Gabriel F. T. Gomes
0 siblings, 1 reply; 33+ messages in thread
From: Joseph Myers @ 2016-11-09 21:38 UTC (permalink / raw)
To: Gabriel F. T. Gomes; +Cc: libc-alpha
On Wed, 9 Nov 2016, Gabriel F. T. Gomes wrote:
> From: "Paul E. Murphy" <murphyp@linux.vnet.ibm.com>
>
> These are copied from the long double version. posix style
> errors are assumed, and inlined. Where a function is not
> defined by TS 18661-3, the wrapper is not implemented.
I don't think float128-specific wrappers like this are appropriate. All
these wrappers should be type-generic. If you put type-generic wrappers
as math/w_*_template.c, will the existing wrappers with matherr support
still take precedence for existing types?
> diff --git a/sysdeps/ieee754/float128/w_acosf128.c b/sysdeps/ieee754/float128/w_acosf128.c
> new file mode 100644
> index 0000000..cedbc98
> --- /dev/null
> +++ b/sysdeps/ieee754/float128/w_acosf128.c
> @@ -0,0 +1,35 @@
> +/* Copyright (C) 2016 Free Software Foundation, Inc.
Descriptive comment as first line of every new file.
> +/*
> + * wrapper atan2f128(y,x)
> + */
Comments need to follow the normal coding style.
> +/* wrapper y0f128 */
> +_Float128
> +__y0f128 (_Float128 x)
> +{
> + if (__builtin_expect (islessequal (x, 0) || isgreater (x, X_TLOSS), 0))
No TLOSS checks. That's only relevant for _LIB_VERSION != _POSIX_ in the
original code.
> +/* wrapper sqrtf128 */
> +_Float128
> +__sqrtf128 (_Float128 x)
> +{
> + if (__builtin_expect (isless (x, 0), 0) && _LIB_VERSION != _IEEE_)
No _LIB_VERSION checks in new wrappers.
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 3/8] float128: Add wrappers for IEEE functions.
2016-11-09 21:38 ` Joseph Myers
@ 2016-12-05 16:48 ` Gabriel F. T. Gomes
2016-12-05 18:51 ` Joseph Myers
0 siblings, 1 reply; 33+ messages in thread
From: Gabriel F. T. Gomes @ 2016-12-05 16:48 UTC (permalink / raw)
To: Joseph Myers; +Cc: libc-alpha
On Wed, 9 Nov 2016 21:38:07 +0000
Joseph Myers <joseph@codesourcery.com> wrote:
> On Wed, 9 Nov 2016, Gabriel F. T. Gomes wrote:
>
> > From: "Paul E. Murphy" <murphyp@linux.vnet.ibm.com>
> >
> > These are copied from the long double version. posix style
> > errors are assumed, and inlined. Where a function is not
> > defined by TS 18661-3, the wrapper is not implemented.
>
> I don't think float128-specific wrappers like this are appropriate. All
> these wrappers should be type-generic. If you put type-generic wrappers
> as math/w_*_template.c, will the existing wrappers with matherr support
> still take precedence for existing types?
They won't.
The files generated for the functions listed in gen-libm-calls
(in <builddir>/math/) are always generated, regardless of the existence
of the same file in the source dir. And the generated-files take
precedence over the files in the source dir.
Do you have any suggestions on how to proceed?
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 3/8] float128: Add wrappers for IEEE functions.
2016-12-05 16:48 ` Gabriel F. T. Gomes
@ 2016-12-05 18:51 ` Joseph Myers
2016-12-05 22:52 ` Steven Munroe
2016-12-07 19:36 ` Gabriel F. T. Gomes
0 siblings, 2 replies; 33+ messages in thread
From: Joseph Myers @ 2016-12-05 18:51 UTC (permalink / raw)
To: Gabriel F. T. Gomes; +Cc: libc-alpha
On Mon, 5 Dec 2016, Gabriel F. T. Gomes wrote:
> On Wed, 9 Nov 2016 21:38:07 +0000
> Joseph Myers <joseph@codesourcery.com> wrote:
>
> > On Wed, 9 Nov 2016, Gabriel F. T. Gomes wrote:
> >
> > > From: "Paul E. Murphy" <murphyp@linux.vnet.ibm.com>
> > >
> > > These are copied from the long double version. posix style
> > > errors are assumed, and inlined. Where a function is not
> > > defined by TS 18661-3, the wrapper is not implemented.
> >
> > I don't think float128-specific wrappers like this are appropriate. All
> > these wrappers should be type-generic. If you put type-generic wrappers
> > as math/w_*_template.c, will the existing wrappers with matherr support
> > still take precedence for existing types?
>
> They won't.
>
> The files generated for the functions listed in gen-libm-calls
> (in <builddir>/math/) are always generated, regardless of the existence
> of the same file in the source dir. And the generated-files take
> precedence over the files in the source dir.
>
> Do you have any suggestions on how to proceed?
Source files in sysdeps certainly take precedence; that's by design, so
that architectures can easily have their own implementations that override
the templates. Are you saying that this only works for source files in
sysdeps and not for those in math/?
If so, then the existing log1p and scalbln wrappers should just be made
into type-generic templates like I did with ilogb; there is nothing in
those wrappers using the _LIB_VERSION / matherr / __kernel_standard
functionality that we want to obsolete and so don't want to form part of
the interface to new functions. For the rest of the existing wrappers,
this indicates more of the steps towards deprecation are needed as part of
adding the new wrappers.
There are I think three classes per-floating-point-format function
implementations built in math/ (here I am specifically discussing
per-format implementations that are built, a related but different topic
from the per-type public APIs that are exported which we have discussed
before when considering what APIs to expose for float128).
(a) Function implementations that should be built for all floating-point
formats supported by glibc.
(b) Function implementations that should be built for formats that may be
used for float, double or long double, but not for formats not supported
for any of those types. Right now, the distinction from (c) below does
not matter, but if in future there is support for float128 as an
alternative long double format on powerpc64le, then functions such as
scalb and significand will fall in class (b) because scalbl and
significandl, as existing APIs, will need supporting for the new choice of
long double (but there should still be no public scalbf128 or
significandf128 APIs, just internal names that the scalbl and significandl
APIs get mapped to by the headers).
(c) Function implementations that should only be built for float, double
and long double - that is, for the formats historically supported for
those, not for any format added in future.
Right now (c) only has the k_standard and w_lgamma_compat functions listed
in libm-compat-calls. But obsoleting matherr etc. (or preparing for that
obsoletion) would mean rather more functions go there - meaning
libm-compat-calls should probably start being defined in a way that
doesn't involve mentioning each function three times.
Specifically: the existing wrappers (except those that don't use
_LIB_VERSION, __kernel_standard etc. and can just be made type-generic if
they aren't already) would be renamed, say w_fooF to w_fooF_compat
(_compat2 in the lgamma case where _compat already exists). The _compat
names would end up in the new version of libm-compat-calls, with the old
names being removed from libm-calls. New type-generic templates would be
added to gen-libm-calls.
The templates would all have some #if conditional (using macros from
math-type-macros-<type>.h) meaning "don't build this for float, double or
long double; do build this for any other formats". That would mean they
are initially used only for float128.
Actual obsoletion of the old wrappers (which might come later) would
involve, among other changes, changing the conditional to say "don't build
for float, double or long double unless !SHLIB_COMPAT (something)", i.e.
build for static libm and for new ports but not otherwise (unless we
decide to give all libm functions using the wrappers new symbol versions
[*]), with the compat wrappers having corresponding SHLIB_COMPAT
conditionals added so they aren't built for static libm or new ports.
Note that it's quite likely new wrappers would expose more bugs in the
__ieee754_* functions, where those functions return a bad value in an
error case but __kernel_standard hides that by changing the return value
to the correct one.
[*] Adding support for *f32, *f64 etc. names as aliases for existing
functions would also mean considering whether to alias the old wrappers
(fairly harmless once _LIB_VERSION is a compat symbol so any link to the
new names can't use it anyway) or to build the new wrappers in order to
export them under those names.
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 3/8] float128: Add wrappers for IEEE functions.
2016-12-05 18:51 ` Joseph Myers
@ 2016-12-05 22:52 ` Steven Munroe
2016-12-06 0:31 ` Joseph Myers
2016-12-07 19:36 ` Gabriel F. T. Gomes
1 sibling, 1 reply; 33+ messages in thread
From: Steven Munroe @ 2016-12-05 22:52 UTC (permalink / raw)
To: Joseph Myers; +Cc: Gabriel F. T. Gomes, libc-alpha
On Mon, 2016-12-05 at 18:50 +0000, Joseph Myers wrote:
> On Mon, 5 Dec 2016, Gabriel F. T. Gomes wrote:
>
> > On Wed, 9 Nov 2016 21:38:07 +0000
> > Joseph Myers <joseph@codesourcery.com> wrote:
> >
> > > On Wed, 9 Nov 2016, Gabriel F. T. Gomes wrote:
> > >
> > > > From: "Paul E. Murphy" <murphyp@linux.vnet.ibm.com>
> > > >
> > > > These are copied from the long double version. posix style
> > > > errors are assumed, and inlined. Where a function is not
> > > > defined by TS 18661-3, the wrapper is not implemented.
> > >
> > > I don't think float128-specific wrappers like this are appropriate. All
> > > these wrappers should be type-generic. If you put type-generic wrappers
> > > as math/w_*_template.c, will the existing wrappers with matherr support
> > > still take precedence for existing types?
> >
> > They won't.
> >
> > The files generated for the functions listed in gen-libm-calls
> > (in <builddir>/math/) are always generated, regardless of the existence
> > of the same file in the source dir. And the generated-files take
> > precedence over the files in the source dir.
> >
> > Do you have any suggestions on how to proceed?
>
> Source files in sysdeps certainly take precedence; that's by design, so
> that architectures can easily have their own implementations that override
> the templates. Are you saying that this only works for source files in
> sysdeps and not for those in math/?
>
> If so, then the existing log1p and scalbln wrappers should just be made
> into type-generic templates like I did with ilogb; there is nothing in
> those wrappers using the _LIB_VERSION / matherr / __kernel_standard
> functionality that we want to obsolete and so don't want to form part of
> the interface to new functions. For the rest of the existing wrappers,
> this indicates more of the steps towards deprecation are needed as part of
> adding the new wrappers.
>
Are these changes really necessary at this time?
I appropriate your desire to get a jump on the emerging standards but
the associates changes are a constant churn on the code base and impacts
our work.
Deferring the C17 work (and associated restructuring) until 2.26 will
expedite enabling our base _Float128 support in time for 2.25.
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 3/8] float128: Add wrappers for IEEE functions.
2016-12-05 22:52 ` Steven Munroe
@ 2016-12-06 0:31 ` Joseph Myers
2016-12-06 2:39 ` Steven Munroe
0 siblings, 1 reply; 33+ messages in thread
From: Joseph Myers @ 2016-12-06 0:31 UTC (permalink / raw)
To: Steven Munroe; +Cc: Gabriel F. T. Gomes, libc-alpha
On Mon, 5 Dec 2016, Steven Munroe wrote:
> Are these changes really necessary at this time?
The question is what is the right, most maintainable way to add support
for a new floating-point format and associated type. Given that support
for further formats / types may well be added in future (_Float16 being
the most obvious possibility; WG14 has also expressed support for
considering adding short float to C2x, which would likely alias _Float16
functions when not aliasing float ones), minimising the number of places
where something needs repeating for each new type is clearly an important
consideration.
Since we've also desired for a long time to obsolete support for
_LIB_VERSION and matherr, avoiding support for those in new interfaces is
also clearly desirable - any ABI added needs to be supported long-term, so
we need to be careful that it's the right ABI. This indicates using
new-style wrappers for the new types, while the previous point indicates
making those wrappers type-generic. Then, the question is simply how to
use the type-generic wrappers for new types without affecting binary
compatibility for the old types, which is the subject of the present
discussion.
Note that I'm not saying the whole deprecation needs to go in at this
point. Just that the desire for a future deprecation provides useful
guidance on the arrangements for the new wrappers.
Since I was warning over a year ago about the complexity of supporting a
new type (I expected 50 to 100 patches), and included matherr / wrappers
in the issues to consider, I don't think any of this should be a surprise.
I think all the development so far that Paul and others have worked on has
been perfectly consistent with what I advised - adding support for the new
type is perfectly feasible, substantial progress has been made, various
design details have changed over time but the overall outline is as
expected, the complexity of the changes means it's usual for a patch
series to require several reviews and revisions and possibly design
changes before it's ready to go in (but the numbers of revisions involved
are small compared to many I've seen in the Linux kernel context where a
patch series can have dozens of revisions and take years to get in).
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 3/8] float128: Add wrappers for IEEE functions.
2016-12-06 0:31 ` Joseph Myers
@ 2016-12-06 2:39 ` Steven Munroe
0 siblings, 0 replies; 33+ messages in thread
From: Steven Munroe @ 2016-12-06 2:39 UTC (permalink / raw)
To: Joseph Myers; +Cc: Gabriel F. T. Gomes, libc-alpha
On Tue, 2016-12-06 at 00:30 +0000, Joseph Myers wrote:
> On Mon, 5 Dec 2016, Steven Munroe wrote:
>
> > Are these changes really necessary at this time?
>
> The question is what is the right, most maintainable way to add support
> for a new floating-point format and associated type. Given that support
> for further formats / types may well be added in future (_Float16 being
> the most obvious possibility; WG14 has also expressed support for
> considering adding short float to C2x, which would likely alias _Float16
> functions when not aliasing float ones), minimising the number of places
> where something needs repeating for each new type is clearly an important
> consideration.
>
I am not disagreeing with the goal, but I am questioning the priorities.
> Since we've also desired for a long time to obsolete support for
> _LIB_VERSION and matherr, avoiding support for those in new interfaces is
> also clearly desirable - any ABI added needs to be supported long-term, so
> we need to be careful that it's the right ABI. This indicates using
> new-style wrappers for the new types, while the previous point indicates
> making those wrappers type-generic. Then, the question is simply how to
> use the type-generic wrappers for new types without affecting binary
> compatibility for the old types, which is the subject of the present
> discussion.
>
> Note that I'm not saying the whole deprecation needs to go in at this
> point. Just that the desire for a future deprecation provides useful
> guidance on the arrangements for the new wrappers.
>
Good then we will only do the minimum to complete the current patch set.
As you suggest.
> Since I was warning over a year ago about the complexity of supporting a
> new type (I expected 50 to 100 patches), and included matherr / wrappers
> in the issues to consider, I don't think any of this should be a surprise.
> I think all the development so far that Paul and others have worked on has
> been perfectly consistent with what I advised - adding support for the new
> type is perfectly feasible, substantial progress has been made, various
> design details have changed over time but the overall outline is as
> expected, the complexity of the changes means it's usual for a patch
> series to require several reviews and revisions and possibly design
> changes before it's ready to go in (but the numbers of revisions involved
> are small compared to many I've seen in the Linux kernel context where a
> patch series can have dozens of revisions and take years to get in).
>
That is exactly what I am worried about.
Perfection is the enemy of good.
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 3/8] float128: Add wrappers for IEEE functions.
2016-12-05 18:51 ` Joseph Myers
2016-12-05 22:52 ` Steven Munroe
@ 2016-12-07 19:36 ` Gabriel F. T. Gomes
2016-12-07 21:47 ` Joseph Myers
1 sibling, 1 reply; 33+ messages in thread
From: Gabriel F. T. Gomes @ 2016-12-07 19:36 UTC (permalink / raw)
To: Joseph Myers; +Cc: libc-alpha
[-- Attachment #1: Type: text/plain, Size: 2783 bytes --]
On Mon, 5 Dec 2016 18:50:39 +0000
Joseph Myers <joseph@codesourcery.com> wrote:
> On Mon, 5 Dec 2016, Gabriel F. T. Gomes wrote:
>
> > On Wed, 9 Nov 2016 21:38:07 +0000
> > Joseph Myers <joseph@codesourcery.com> wrote:
> >
> > > On Wed, 9 Nov 2016, Gabriel F. T. Gomes wrote:
> > >
> > > I don't think float128-specific wrappers like this are appropriate. All
> > > these wrappers should be type-generic. If you put type-generic wrappers
> > > as math/w_*_template.c, will the existing wrappers with matherr support
> > > still take precedence for existing types?
> >
> > They won't.
> >
> > The files generated for the functions listed in gen-libm-calls
> > (in <builddir>/math/) are always generated, regardless of the existence
> > of the same file in the source dir. And the generated-files take
> > precedence over the files in the source dir.
> >
> > Do you have any suggestions on how to proceed?
>
> Source files in sysdeps certainly take precedence; that's by design, so
> that architectures can easily have their own implementations that override
> the templates. Are you saying that this only works for source files in
> sysdeps and not for those in math/?
When building from sysdeps (e.g. sysdeps/ieee754/ldbl-opt/w_acosl.c),
the command that is used to build it, puts <build_dir>/math first in
the include search path:
gcc ../sysdeps/ieee754/ldbl-opt/w_acosl.c [...] -I../include
-I/home/gftg/build/glibc/math -I/home/gftg/build/glibc
-I../sysdeps/unix/sysv/linux/powerpc/powerpc64le/fpu [...]
And that will make sysdeps files try to use the new, auto-generated
wrappers:
In file included from /home/gftg/build/glibc/math/w_acosl.c:2:0,
from ../sysdeps/ieee754/ldbl-opt/w_acosl.c:4:
./w_acos_template.c:1:2: error: #error
Is that what you expected?
Is it OK to have <build_dir>/math be searched first for include files?
> If so, then the existing log1p and scalbln wrappers should just be made
> into type-generic templates like I did with ilogb; there is nothing in
> those wrappers using the _LIB_VERSION / matherr / __kernel_standard
> functionality that we want to obsolete and so don't want to form part of
> the interface to new functions. For the rest of the existing wrappers,
> this indicates more of the steps towards deprecation are needed as part of
> adding the new wrappers.
For this first part.. this is independent of the other patches, right?
Is the attached patch in the lines of what you had in mind?
(I just wrote it for log1p, because I still don't know what to do about
scalbln (I think I can't use declare_mgen_alias because w_scalbln
doesn't create a strong alias). Besides, I still don't know how to
deal with the IS_IN (libm) test in
sysdeps/ieee754/ldbl-64-128/w_scalblnl.c)
Gabriel
[-- Attachment #2: 0001-Make-w_log1p-type-generic.patch --]
[-- Type: text/x-patch, Size: 8741 bytes --]
From d3a7d7240eb4cf15a878e5fd2bcd96d164b14c86 Mon Sep 17 00:00:00 2001
From: "Gabriel F. T. Gomes" <gftg@linux.vnet.ibm.com>
Date: Wed, 7 Dec 2016 16:19:11 -0200
Subject: [PATCH] Make w_log1p type-generic
This patch converts the wrapper log1p (which set errno directly rather
than doing anything with __kernel_standard) to use the type-generic
template machinery, in the same way that has been done for ilogb.
Tested for powerpc64le, s390, and x86_64.
2016-12-06 Gabriel F. T. Gomes <gftg@linux.vnet.ibm.com>
* math/Makefile (gen-libm-calls): Add w_log1pF.
(libm-calls): Remove w_log1pF.
* math/w_log1p.c: Remove file.
* math/w_log1pf.c: Likewise.
* math/w_log1pl.c: Likewise.
* math/w_log1p_template.c: New file with type-generic
implementation based on math/w_log1p.c.
* sysdeps/ieee754/ldbl-128ibm/w_log1pl.c: Remove use of macro
long_double_symbol.
* sysdeps/ieee754/ldbl-64-128/w_log1pl.c: Likewise.
---
math/Makefile | 5 +++--
math/w_log1p.c | 41 ----------------------------------
math/w_log1p_template.c | 36 +++++++++++++++++++++++++++++
math/w_log1pf.c | 36 -----------------------------
math/w_log1pl.c | 36 -----------------------------
sysdeps/ieee754/ldbl-128ibm/w_log1pl.c | 1 -
sysdeps/ieee754/ldbl-64-128/w_log1pl.c | 1 -
7 files changed, 39 insertions(+), 117 deletions(-)
delete mode 100644 math/w_log1p.c
create mode 100644 math/w_log1p_template.c
delete mode 100644 math/w_log1pf.c
delete mode 100644 math/w_log1pl.c
diff --git a/math/Makefile b/math/Makefile
index 848b093..50ce418 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -52,7 +52,8 @@ gen-libm-calls = cargF conjF cimagF crealF cabsF s_cacosF \
k_casinhF s_csinhF k_casinhF s_csinhF s_catanhF s_catanF \
s_ctanF s_ctanhF s_cexpF s_clogF s_cprojF s_csqrtF \
s_cpowF s_clog10F s_fdimF s_nextdownF s_fmaxF s_fminF \
- s_nanF s_iseqsigF s_canonicalizeF w_ilogbF w_llogbF
+ s_nanF s_iseqsigF s_canonicalizeF w_ilogbF w_llogbF \
+ w_log1pF
libm-calls = \
e_acosF e_acoshF e_asinF e_atan2F e_atanhF e_coshF e_expF e_fmodF \
@@ -61,7 +62,7 @@ libm-calls = \
e_ilogbF \
k_cosF k_sinF k_tanF s_asinhF s_atanF s_cbrtF \
s_ceilF s_cosF s_erfF s_expm1F s_fabsF \
- s_floorF s_log1pF w_log1pF s_logbF \
+ s_floorF s_log1pF s_logbF \
s_nextafterF s_nexttowardF s_rintF s_scalblnF w_scalblnF \
s_significandF s_sinF s_tanF s_tanhF w_acosF w_acoshF w_asinF \
w_atan2F w_atanhF w_coshF w_expF w_exp2F w_exp10F w_fmodF \
diff --git a/math/w_log1p.c b/math/w_log1p.c
deleted file mode 100644
index 282c85c..0000000
--- a/math/w_log1p.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Wrapper for __log1p that handles setting errno.
- Copyright (C) 2015-2016 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 <errno.h>
-#include <math.h>
-#include <math_private.h>
-
-double
-__w_log1p (double x)
-{
- if (__glibc_unlikely (islessequal (x, -1.0)))
- {
- if (x == -1.0)
- __set_errno (ERANGE);
- else
- __set_errno (EDOM);
- }
-
- return __log1p (x);
-}
-weak_alias (__w_log1p, log1p)
-
-#ifdef NO_LONG_DOUBLE
-strong_alias (__w_log1p, __log1pl)
-weak_alias (__w_log1p, log1pl)
-#endif
diff --git a/math/w_log1p_template.c b/math/w_log1p_template.c
new file mode 100644
index 0000000..bb91975
--- /dev/null
+++ b/math/w_log1p_template.c
@@ -0,0 +1,36 @@
+/* Wrapper for __log1p that handles setting errno.
+ Copyright (C) 2015-2016 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 <errno.h>
+#include <math.h>
+#include <math_private.h>
+
+FLOAT
+M_DECL_FUNC (__w_log1p) (FLOAT x)
+{
+ if (__glibc_unlikely (islessequal (x, -1.0)))
+ {
+ if (x == -1.0)
+ __set_errno (ERANGE);
+ else
+ __set_errno (EDOM);
+ }
+
+ return M_SUF (__log1p) (x);
+}
+declare_mgen_alias (__w_log1p, log1p)
diff --git a/math/w_log1pf.c b/math/w_log1pf.c
deleted file mode 100644
index ed9992a..0000000
--- a/math/w_log1pf.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Wrapper for __log1pf that handles setting errno.
- Copyright (C) 2015-2016 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 <errno.h>
-#include <math.h>
-#include <math_private.h>
-
-float
-__w_log1pf (float x)
-{
- if (__glibc_unlikely (islessequal (x, -1.0f)))
- {
- if (x == -1.0f)
- __set_errno (ERANGE);
- else
- __set_errno (EDOM);
- }
-
- return __log1pf (x);
-}
-weak_alias (__w_log1pf, log1pf)
diff --git a/math/w_log1pl.c b/math/w_log1pl.c
deleted file mode 100644
index 3478c1c..0000000
--- a/math/w_log1pl.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Wrapper for __log1pl that handles setting errno.
- Copyright (C) 2015-2016 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 <errno.h>
-#include <math.h>
-#include <math_private.h>
-
-long double
-__w_log1pl (long double x)
-{
- if (__glibc_unlikely (islessequal (x, -1.0L)))
- {
- if (x == -1.0L)
- __set_errno (ERANGE);
- else
- __set_errno (EDOM);
- }
-
- return __log1pl (x);
-}
-weak_alias (__w_log1pl, log1pl)
diff --git a/sysdeps/ieee754/ldbl-128ibm/w_log1pl.c b/sysdeps/ieee754/ldbl-128ibm/w_log1pl.c
index 969fadc..375e768 100644
--- a/sysdeps/ieee754/ldbl-128ibm/w_log1pl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/w_log1pl.c
@@ -20,4 +20,3 @@
#undef weak_alias
#define weak_alias(n,a)
#include <math/w_log1pl.c>
-long_double_symbol (libm, __w_log1pl, log1pl);
diff --git a/sysdeps/ieee754/ldbl-64-128/w_log1pl.c b/sysdeps/ieee754/ldbl-64-128/w_log1pl.c
index 969fadc..375e768 100644
--- a/sysdeps/ieee754/ldbl-64-128/w_log1pl.c
+++ b/sysdeps/ieee754/ldbl-64-128/w_log1pl.c
@@ -20,4 +20,3 @@
#undef weak_alias
#define weak_alias(n,a)
#include <math/w_log1pl.c>
-long_double_symbol (libm, __w_log1pl, log1pl);
--
2.4.11
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 3/8] float128: Add wrappers for IEEE functions.
2016-12-07 19:36 ` Gabriel F. T. Gomes
@ 2016-12-07 21:47 ` Joseph Myers
2016-12-09 21:24 ` Gabriel F. T. Gomes
0 siblings, 1 reply; 33+ messages in thread
From: Joseph Myers @ 2016-12-07 21:47 UTC (permalink / raw)
To: Gabriel F. T. Gomes; +Cc: libc-alpha
On Wed, 7 Dec 2016, Gabriel F. T. Gomes wrote:
> > Source files in sysdeps certainly take precedence; that's by design, so
> > that architectures can easily have their own implementations that override
> > the templates. Are you saying that this only works for source files in
> > sysdeps and not for those in math/?
>
> When building from sysdeps (e.g. sysdeps/ieee754/ldbl-opt/w_acosl.c),
> the command that is used to build it, puts <build_dir>/math first in
> the include search path:
>
> gcc ../sysdeps/ieee754/ldbl-opt/w_acosl.c [...] -I../include
> -I/home/gftg/build/glibc/math -I/home/gftg/build/glibc
> -I../sysdeps/unix/sysv/linux/powerpc/powerpc64le/fpu [...]
>
> And that will make sysdeps files try to use the new, auto-generated
> wrappers:
>
> In file included from /home/gftg/build/glibc/math/w_acosl.c:2:0,
> from ../sysdeps/ieee754/ldbl-opt/w_acosl.c:4:
> ./w_acos_template.c:1:2: error: #error
>
> Is that what you expected?
Well, the detailed design is Paul's; I don't know if he considered the
case of wanting a non-type-generic file in math/ to override a
type-generic one.
> Is it OK to have <build_dir>/math be searched first for include files?
It looks like there are two possible issues involved.
(a) Which .c file gets built if there aren't any in sysdeps? Is it the
one in math/ in the source directory, or the one generated in the build
directory?
(b) When sysdeps files do a #include of w_* files, where do those
#included files come from?
Your command line shows a problem with (b): because of the -I of the
*top-level* build directory (not that of the math/ subdirectory),
"#include <math/w_acosl.c>" wrongly includes the generated file.
In my previous comments I was thinking of (a). But it doesn't really
matter, as renaming the existing files like I suggested (and updating the
#includes of them) would solve both issues. (Moving them into
sysdeps/generic without renaming would probably also do the trick, but
that's uglier and I don't think it's really any easier since you still
need to update the #includes wherever you move them.)
> For this first part.. this is independent of the other patches, right?
> Is the attached patch in the lines of what you had in mind?
> (I just wrote it for log1p, because I still don't know what to do about
> scalbln (I think I can't use declare_mgen_alias because w_scalbln
> doesn't create a strong alias). Besides, I still don't know how to
> deal with the IS_IN (libm) test in
> sysdeps/ieee754/ldbl-64-128/w_scalblnl.c)
For scalbln, look at math/s_ldexp_template.c and the ldbl-opt s_ldexp*
files for an example - the issues are pretty similar.
For log1p, I'd expect the template file to use -1 (or M_LIT (-1.0) in the
islessequal call) rather than the double value -1.0. And I'd hope that
you can remove the ldbl-128ibm/w_log1pl.c and ldbl-64-128/w_log1pl.c files
completely and the generated file will do the right thing automatically.
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 3/8] float128: Add wrappers for IEEE functions.
2016-12-07 21:47 ` Joseph Myers
@ 2016-12-09 21:24 ` Gabriel F. T. Gomes
2016-12-14 0:47 ` Joseph Myers
0 siblings, 1 reply; 33+ messages in thread
From: Gabriel F. T. Gomes @ 2016-12-09 21:24 UTC (permalink / raw)
To: Joseph Myers; +Cc: libc-alpha
[-- Attachment #1: Type: text/plain, Size: 633 bytes --]
On Wed, 7 Dec 2016 21:47:28 +0000
Joseph Myers <joseph@codesourcery.com> wrote:
> For log1p, I'd expect the template file to use -1 (or M_LIT (-1.0) in the
> islessequal call) rather than the double value -1.0. And I'd hope that
> you can remove the ldbl-128ibm/w_log1pl.c and ldbl-64-128/w_log1pl.c files
> completely and the generated file will do the right thing automatically.
I attached a new version with the suggested changes.
> For scalbln, look at math/s_ldexp_template.c and the ldbl-opt s_ldexp*
> files for an example - the issues are pretty similar.
Thanks for the pointers. I am testing a patch for this part.
[-- Attachment #2: 0001-Make-w_log1p-type-generic.patch --]
[-- Type: text/x-patch, Size: 10609 bytes --]
From 598dcad021afb25605595c29d583a04ea52bf653 Mon Sep 17 00:00:00 2001
From: "Gabriel F. T. Gomes" <gftg@linux.vnet.ibm.com>
Date: Wed, 7 Dec 2016 16:19:11 -0200
Subject: [PATCH] Make w_log1p type-generic
This patch converts the wrapper log1p (which set errno directly rather
than doing anything with __kernel_standard) to use the type-generic
template machinery, in the same way that has been done for ilogb.
Tested for powerpc64le, s390, and x86_64.
2016-12-06 Gabriel F. T. Gomes <gftg@linux.vnet.ibm.com>
* math/Makefile (gen-libm-calls): Add w_log1pF.
(libm-calls): Remove w_log1pF.
* math/w_log1p.c: Remove.
* math/w_log1pf.c: Likewise.
* math/w_log1pl.c: Likewise.
* math/w_log1p_template.c: New file with type-generic
implementation based on math/w_log1p.c.
* sysdeps/ieee754/ldbl-128ibm/w_log1pl.c: Remove.
* sysdeps/ieee754/ldbl-64-128/w_log1pl.c: Likewise.
---
math/Makefile | 5 +++--
math/w_log1p.c | 41 ----------------------------------
math/w_log1p_template.c | 36 +++++++++++++++++++++++++++++
math/w_log1pf.c | 36 -----------------------------
math/w_log1pl.c | 36 -----------------------------
sysdeps/ieee754/ldbl-128ibm/w_log1pl.c | 23 -------------------
sysdeps/ieee754/ldbl-64-128/w_log1pl.c | 23 -------------------
7 files changed, 39 insertions(+), 161 deletions(-)
delete mode 100644 math/w_log1p.c
create mode 100644 math/w_log1p_template.c
delete mode 100644 math/w_log1pf.c
delete mode 100644 math/w_log1pl.c
delete mode 100644 sysdeps/ieee754/ldbl-128ibm/w_log1pl.c
delete mode 100644 sysdeps/ieee754/ldbl-64-128/w_log1pl.c
diff --git a/math/Makefile b/math/Makefile
index 848b093..50ce418 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -52,7 +52,8 @@ gen-libm-calls = cargF conjF cimagF crealF cabsF s_cacosF \
k_casinhF s_csinhF k_casinhF s_csinhF s_catanhF s_catanF \
s_ctanF s_ctanhF s_cexpF s_clogF s_cprojF s_csqrtF \
s_cpowF s_clog10F s_fdimF s_nextdownF s_fmaxF s_fminF \
- s_nanF s_iseqsigF s_canonicalizeF w_ilogbF w_llogbF
+ s_nanF s_iseqsigF s_canonicalizeF w_ilogbF w_llogbF \
+ w_log1pF
libm-calls = \
e_acosF e_acoshF e_asinF e_atan2F e_atanhF e_coshF e_expF e_fmodF \
@@ -61,7 +62,7 @@ libm-calls = \
e_ilogbF \
k_cosF k_sinF k_tanF s_asinhF s_atanF s_cbrtF \
s_ceilF s_cosF s_erfF s_expm1F s_fabsF \
- s_floorF s_log1pF w_log1pF s_logbF \
+ s_floorF s_log1pF s_logbF \
s_nextafterF s_nexttowardF s_rintF s_scalblnF w_scalblnF \
s_significandF s_sinF s_tanF s_tanhF w_acosF w_acoshF w_asinF \
w_atan2F w_atanhF w_coshF w_expF w_exp2F w_exp10F w_fmodF \
diff --git a/math/w_log1p.c b/math/w_log1p.c
deleted file mode 100644
index 282c85c..0000000
--- a/math/w_log1p.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Wrapper for __log1p that handles setting errno.
- Copyright (C) 2015-2016 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 <errno.h>
-#include <math.h>
-#include <math_private.h>
-
-double
-__w_log1p (double x)
-{
- if (__glibc_unlikely (islessequal (x, -1.0)))
- {
- if (x == -1.0)
- __set_errno (ERANGE);
- else
- __set_errno (EDOM);
- }
-
- return __log1p (x);
-}
-weak_alias (__w_log1p, log1p)
-
-#ifdef NO_LONG_DOUBLE
-strong_alias (__w_log1p, __log1pl)
-weak_alias (__w_log1p, log1pl)
-#endif
diff --git a/math/w_log1p_template.c b/math/w_log1p_template.c
new file mode 100644
index 0000000..1ac3450
--- /dev/null
+++ b/math/w_log1p_template.c
@@ -0,0 +1,36 @@
+/* Wrapper for __log1p that handles setting errno.
+ Copyright (C) 2015-2016 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 <errno.h>
+#include <math.h>
+#include <math_private.h>
+
+FLOAT
+M_DECL_FUNC (__w_log1p) (FLOAT x)
+{
+ if (__glibc_unlikely (islessequal (x, M_LIT (-1.0))))
+ {
+ if (x == -1)
+ __set_errno (ERANGE);
+ else
+ __set_errno (EDOM);
+ }
+
+ return M_SUF (__log1p) (x);
+}
+declare_mgen_alias (__w_log1p, log1p)
diff --git a/math/w_log1pf.c b/math/w_log1pf.c
deleted file mode 100644
index ed9992a..0000000
--- a/math/w_log1pf.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Wrapper for __log1pf that handles setting errno.
- Copyright (C) 2015-2016 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 <errno.h>
-#include <math.h>
-#include <math_private.h>
-
-float
-__w_log1pf (float x)
-{
- if (__glibc_unlikely (islessequal (x, -1.0f)))
- {
- if (x == -1.0f)
- __set_errno (ERANGE);
- else
- __set_errno (EDOM);
- }
-
- return __log1pf (x);
-}
-weak_alias (__w_log1pf, log1pf)
diff --git a/math/w_log1pl.c b/math/w_log1pl.c
deleted file mode 100644
index 3478c1c..0000000
--- a/math/w_log1pl.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Wrapper for __log1pl that handles setting errno.
- Copyright (C) 2015-2016 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 <errno.h>
-#include <math.h>
-#include <math_private.h>
-
-long double
-__w_log1pl (long double x)
-{
- if (__glibc_unlikely (islessequal (x, -1.0L)))
- {
- if (x == -1.0L)
- __set_errno (ERANGE);
- else
- __set_errno (EDOM);
- }
-
- return __log1pl (x);
-}
-weak_alias (__w_log1pl, log1pl)
diff --git a/sysdeps/ieee754/ldbl-128ibm/w_log1pl.c b/sysdeps/ieee754/ldbl-128ibm/w_log1pl.c
deleted file mode 100644
index 969fadc..0000000
--- a/sysdeps/ieee754/ldbl-128ibm/w_log1pl.c
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Wrapper for __log1pl that handles setting errno.
- Copyright (C) 2015-2016 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_ldbl_opt.h>
-#undef weak_alias
-#define weak_alias(n,a)
-#include <math/w_log1pl.c>
-long_double_symbol (libm, __w_log1pl, log1pl);
diff --git a/sysdeps/ieee754/ldbl-64-128/w_log1pl.c b/sysdeps/ieee754/ldbl-64-128/w_log1pl.c
deleted file mode 100644
index 969fadc..0000000
--- a/sysdeps/ieee754/ldbl-64-128/w_log1pl.c
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Wrapper for __log1pl that handles setting errno.
- Copyright (C) 2015-2016 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_ldbl_opt.h>
-#undef weak_alias
-#define weak_alias(n,a)
-#include <math/w_log1pl.c>
-long_double_symbol (libm, __w_log1pl, log1pl);
--
2.4.11
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 3/8] float128: Add wrappers for IEEE functions.
2016-12-09 21:24 ` Gabriel F. T. Gomes
@ 2016-12-14 0:47 ` Joseph Myers
2016-12-14 13:36 ` Gabriel F. T. Gomes
0 siblings, 1 reply; 33+ messages in thread
From: Joseph Myers @ 2016-12-14 0:47 UTC (permalink / raw)
To: Gabriel F. T. Gomes; +Cc: libc-alpha
On Fri, 9 Dec 2016, Gabriel F. T. Gomes wrote:
> On Wed, 7 Dec 2016 21:47:28 +0000
> Joseph Myers <joseph@codesourcery.com> wrote:
>
> > For log1p, I'd expect the template file to use -1 (or M_LIT (-1.0) in the
> > islessequal call) rather than the double value -1.0. And I'd hope that
> > you can remove the ldbl-128ibm/w_log1pl.c and ldbl-64-128/w_log1pl.c files
> > completely and the generated file will do the right thing automatically.
>
> I attached a new version with the suggested changes.
This patch is OK.
(For the record for anyone wondering: in this case it's correct that the
template does not use M_LIBM_NEED_COMPAT, because the compat symbol for
long double = double on architectures where it changed points directly to
the underlying implementation that does not set errno.)
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 3/8] float128: Add wrappers for IEEE functions.
2016-12-14 0:47 ` Joseph Myers
@ 2016-12-14 13:36 ` Gabriel F. T. Gomes
2016-12-14 14:33 ` Joseph Myers
0 siblings, 1 reply; 33+ messages in thread
From: Gabriel F. T. Gomes @ 2016-12-14 13:36 UTC (permalink / raw)
To: Joseph Myers; +Cc: libc-alpha
On Wed, 14 Dec 2016 00:47:25 +0000
Joseph Myers <joseph@codesourcery.com> wrote:
> On Fri, 9 Dec 2016, Gabriel F. T. Gomes wrote:
>
> > I attached a new version with the suggested changes.
>
> This patch is OK.
>
> (For the record for anyone wondering: in this case it's correct that the
> template does not use M_LIBM_NEED_COMPAT, because the compat symbol for
> long double = double on architectures where it changed points directly to
> the underlying implementation that does not set errno.)
>
Thanks. Pushed as 14348aaeff5c.
(I'll send the patch for w_scalbln in another thread, because my last
attempts (2) to send it to this thread never made it to libc-alpha).
^ permalink raw reply [flat|nested] 33+ messages in thread
* [PATCH 8/8] float128: Add wrappers to override ldbl-128 as float128.
2016-11-09 18:41 [PATCH 0/8] More float128 declarations Gabriel F. T. Gomes
` (5 preceding siblings ...)
2016-11-09 18:41 ` [PATCH 3/8] float128: Add wrappers for IEEE functions Gabriel F. T. Gomes
@ 2016-11-09 18:41 ` Gabriel F. T. Gomes
2016-11-09 22:13 ` Joseph Myers
2016-11-09 18:41 ` [PATCH 2/8] float128: Add _Float128 make bits to libm Gabriel F. T. Gomes
2016-11-09 21:31 ` [PATCH 0/8] More float128 declarations Joseph Myers
8 siblings, 1 reply; 33+ messages in thread
From: Gabriel F. T. Gomes @ 2016-11-09 18:41 UTC (permalink / raw)
To: libc-alpha
From: "Paul E. Murphy" <murphyp@linux.vnet.ibm.com>
This change defines float128_private.h which contains
macros used to override long double naming conventions
when building a ldbl file.
* sysdeps/ieee754/float128/e_acosf128.c: New file.
* sysdeps/ieee754/float128/e_acoshf128.c: New file.
* sysdeps/ieee754/float128/e_asinf128.c: New file.
* sysdeps/ieee754/float128/e_atan2f128.c: New file.
* sysdeps/ieee754/float128/e_atanhf128.c: New file.
* sysdeps/ieee754/float128/e_coshf128.c: New file.
* sysdeps/ieee754/float128/e_exp10f128.c: New file.
* sysdeps/ieee754/float128/e_exp2f128.c: New file.
* sysdeps/ieee754/float128/e_expf128.c: New file.
* sysdeps/ieee754/float128/e_fmodf128.c: New file.
* sysdeps/ieee754/float128/e_gammaf128_r.c: New file.
* sysdeps/ieee754/float128/e_hypotf128.c: New file.
* sysdeps/ieee754/float128/e_ilogbf128.c: New file.
* sysdeps/ieee754/float128/e_j0f128.c: New file.
* sysdeps/ieee754/float128/e_j1f128.c: New file.
* sysdeps/ieee754/float128/e_jnf128.c: New file.
* sysdeps/ieee754/float128/e_lgammaf128.c: New file.
* sysdeps/ieee754/float128/e_lgammaf128_r.c: New file.
* sysdeps/ieee754/float128/e_log10f128.c: New file.
* sysdeps/ieee754/float128/e_log2f128.c: New file.
* sysdeps/ieee754/float128/e_logf128.c: New file.
* sysdeps/ieee754/float128/e_powf128.c: New file.
* sysdeps/ieee754/float128/e_rem_pio2f128.c: New file.
* sysdeps/ieee754/float128/e_remainderf128.c: New file.
* sysdeps/ieee754/float128/e_scalbf128.c: New file.
* sysdeps/ieee754/float128/e_sinhf128.c: New file.
* sysdeps/ieee754/float128/e_sqrtf128.c: New file.
* sysdeps/ieee754/float128/float128_private.h: New file.
* sysdeps/ieee754/float128/gamma_productf128.c: New file.
* sysdeps/ieee754/float128/ieee754_float128.h: New file.
* sysdeps/ieee754/float128/k_cosf128.c: New file.
* sysdeps/ieee754/float128/k_rem_pio2f128.c: New file.
* sysdeps/ieee754/float128/k_sincosf128.c: New file.
* sysdeps/ieee754/float128/k_sinf128.c: New file.
* sysdeps/ieee754/float128/k_tanf128.c: New file.
* sysdeps/ieee754/float128/lgamma_negf128.c: New file.
* sysdeps/ieee754/float128/lgamma_productf128.c: New file.
* sysdeps/ieee754/float128/s_asinhf128.c: New file.
* sysdeps/ieee754/float128/s_atanf128.c: New file.
* sysdeps/ieee754/float128/s_cbrtf128.c: New file.
* sysdeps/ieee754/float128/s_ceilf128.c: New file.
* sysdeps/ieee754/float128/s_copysignf128.c: New file.
* sysdeps/ieee754/float128/s_cosf128.c: New file.
* sysdeps/ieee754/float128/s_erff128.c: New file.
* sysdeps/ieee754/float128/s_expm1f128.c: New file.
* sysdeps/ieee754/float128/s_fabsf128.c: New file.
* sysdeps/ieee754/float128/s_finitef128.c: New file.
* sysdeps/ieee754/float128/s_floorf128.c: New file.
* sysdeps/ieee754/float128/s_fmaf128.c: New file.
* sysdeps/ieee754/float128/s_fpclassifyf128.c: New file.
* sysdeps/ieee754/float128/s_frexpf128.c: New file.
* sysdeps/ieee754/float128/s_isinff128.c: New file.
* sysdeps/ieee754/float128/s_isnanf128.c: New file.
* sysdeps/ieee754/float128/s_issignalingf128.c: New file.
* sysdeps/ieee754/float128/s_llrintf128.c: New file.
* sysdeps/ieee754/float128/s_llroundf128.c: New file.
* sysdeps/ieee754/float128/s_log1pf128.c: New file.
* sysdeps/ieee754/float128/s_logbf128.c: New file.
* sysdeps/ieee754/float128/s_lrintf128.c: New file.
* sysdeps/ieee754/float128/s_lroundf128.c: New file.
* sysdeps/ieee754/float128/s_modff128.c: New file.
* sysdeps/ieee754/float128/s_nearbyintf128.c: New file.
* sysdeps/ieee754/float128/s_nextafterf128.c: New file.
* sysdeps/ieee754/float128/s_nexttowardf128.c: New file.
* sysdeps/ieee754/float128/s_nextupf128.c: New file.
* sysdeps/ieee754/float128/s_remquof128.c: New file.
* sysdeps/ieee754/float128/s_rintf128.c: New file.
* sysdeps/ieee754/float128/s_roundf128.c: New file.
* sysdeps/ieee754/float128/s_scalblnf128.c: New file.
* sysdeps/ieee754/float128/s_scalbnf128.c: New file.
* sysdeps/ieee754/float128/s_signbitf128.c: New file.
* sysdeps/ieee754/float128/s_significandf128.c: New file.
* sysdeps/ieee754/float128/s_sincosf128.c: New file.
* sysdeps/ieee754/float128/s_sinf128.c: New file.
* sysdeps/ieee754/float128/s_tanf128.c: New file.
* sysdeps/ieee754/float128/s_tanhf128.c: New file.
* sysdeps/ieee754/float128/s_truncf128.c: New file.
* sysdeps/ieee754/float128/t_sincosf128.c: New file.
* sysdeps/ieee754/float128/x2y2m1f128.c: New file.
---
sysdeps/ieee754/float128/e_acosf128.c | 2 +
sysdeps/ieee754/float128/e_acoshf128.c | 2 +
sysdeps/ieee754/float128/e_asinf128.c | 2 +
sysdeps/ieee754/float128/e_atan2f128.c | 2 +
sysdeps/ieee754/float128/e_atanhf128.c | 2 +
sysdeps/ieee754/float128/e_coshf128.c | 2 +
sysdeps/ieee754/float128/e_exp10f128.c | 2 +
sysdeps/ieee754/float128/e_exp2f128.c | 2 +
sysdeps/ieee754/float128/e_expf128.c | 2 +
sysdeps/ieee754/float128/e_fmodf128.c | 2 +
sysdeps/ieee754/float128/e_gammaf128_r.c | 2 +
sysdeps/ieee754/float128/e_hypotf128.c | 2 +
sysdeps/ieee754/float128/e_ilogbf128.c | 2 +
sysdeps/ieee754/float128/e_j0f128.c | 2 +
sysdeps/ieee754/float128/e_j1f128.c | 2 +
sysdeps/ieee754/float128/e_jnf128.c | 2 +
sysdeps/ieee754/float128/e_lgammaf128.c | 1 +
sysdeps/ieee754/float128/e_lgammaf128_r.c | 2 +
sysdeps/ieee754/float128/e_log10f128.c | 2 +
sysdeps/ieee754/float128/e_log2f128.c | 2 +
sysdeps/ieee754/float128/e_logf128.c | 2 +
sysdeps/ieee754/float128/e_powf128.c | 2 +
sysdeps/ieee754/float128/e_rem_pio2f128.c | 2 +
sysdeps/ieee754/float128/e_remainderf128.c | 2 +
sysdeps/ieee754/float128/e_scalbf128.c | 1 +
sysdeps/ieee754/float128/e_sinhf128.c | 2 +
sysdeps/ieee754/float128/e_sqrtf128.c | 2 +
sysdeps/ieee754/float128/float128_private.h | 343 ++++++++++++++++++++++++++
sysdeps/ieee754/float128/gamma_productf128.c | 2 +
sysdeps/ieee754/float128/ieee754_float128.h | 140 +++++++++++
sysdeps/ieee754/float128/k_cosf128.c | 2 +
sysdeps/ieee754/float128/k_rem_pio2f128.c | 2 +
sysdeps/ieee754/float128/k_sincosf128.c | 2 +
sysdeps/ieee754/float128/k_sinf128.c | 2 +
sysdeps/ieee754/float128/k_tanf128.c | 2 +
sysdeps/ieee754/float128/lgamma_negf128.c | 2 +
sysdeps/ieee754/float128/lgamma_productf128.c | 2 +
sysdeps/ieee754/float128/s_asinhf128.c | 2 +
sysdeps/ieee754/float128/s_atanf128.c | 2 +
sysdeps/ieee754/float128/s_cbrtf128.c | 2 +
sysdeps/ieee754/float128/s_ceilf128.c | 2 +
sysdeps/ieee754/float128/s_copysignf128.c | 2 +
sysdeps/ieee754/float128/s_cosf128.c | 2 +
sysdeps/ieee754/float128/s_erff128.c | 2 +
sysdeps/ieee754/float128/s_expm1f128.c | 2 +
sysdeps/ieee754/float128/s_fabsf128.c | 2 +
sysdeps/ieee754/float128/s_finitef128.c | 2 +
sysdeps/ieee754/float128/s_floorf128.c | 2 +
sysdeps/ieee754/float128/s_fmaf128.c | 2 +
sysdeps/ieee754/float128/s_fpclassifyf128.c | 2 +
sysdeps/ieee754/float128/s_frexpf128.c | 2 +
sysdeps/ieee754/float128/s_isinff128.c | 2 +
sysdeps/ieee754/float128/s_isnanf128.c | 2 +
sysdeps/ieee754/float128/s_issignalingf128.c | 2 +
sysdeps/ieee754/float128/s_llrintf128.c | 2 +
sysdeps/ieee754/float128/s_llroundf128.c | 2 +
sysdeps/ieee754/float128/s_log1pf128.c | 2 +
sysdeps/ieee754/float128/s_logbf128.c | 2 +
sysdeps/ieee754/float128/s_lrintf128.c | 2 +
sysdeps/ieee754/float128/s_lroundf128.c | 2 +
sysdeps/ieee754/float128/s_modff128.c | 2 +
sysdeps/ieee754/float128/s_nearbyintf128.c | 2 +
sysdeps/ieee754/float128/s_nextafterf128.c | 2 +
sysdeps/ieee754/float128/s_nexttowardf128.c | 1 +
sysdeps/ieee754/float128/s_nextupf128.c | 2 +
sysdeps/ieee754/float128/s_remquof128.c | 2 +
sysdeps/ieee754/float128/s_rintf128.c | 2 +
sysdeps/ieee754/float128/s_roundf128.c | 2 +
sysdeps/ieee754/float128/s_scalblnf128.c | 2 +
sysdeps/ieee754/float128/s_scalbnf128.c | 2 +
sysdeps/ieee754/float128/s_signbitf128.c | 2 +
sysdeps/ieee754/float128/s_significandf128.c | 1 +
sysdeps/ieee754/float128/s_sincosf128.c | 2 +
sysdeps/ieee754/float128/s_sinf128.c | 2 +
sysdeps/ieee754/float128/s_tanf128.c | 2 +
sysdeps/ieee754/float128/s_tanhf128.c | 2 +
sysdeps/ieee754/float128/s_truncf128.c | 2 +
sysdeps/ieee754/float128/t_sincosf128.c | 2 +
sysdeps/ieee754/float128/x2y2m1f128.c | 2 +
79 files changed, 633 insertions(+)
create mode 100644 sysdeps/ieee754/float128/e_acosf128.c
create mode 100644 sysdeps/ieee754/float128/e_acoshf128.c
create mode 100644 sysdeps/ieee754/float128/e_asinf128.c
create mode 100644 sysdeps/ieee754/float128/e_atan2f128.c
create mode 100644 sysdeps/ieee754/float128/e_atanhf128.c
create mode 100644 sysdeps/ieee754/float128/e_coshf128.c
create mode 100644 sysdeps/ieee754/float128/e_exp10f128.c
create mode 100644 sysdeps/ieee754/float128/e_exp2f128.c
create mode 100644 sysdeps/ieee754/float128/e_expf128.c
create mode 100644 sysdeps/ieee754/float128/e_fmodf128.c
create mode 100644 sysdeps/ieee754/float128/e_gammaf128_r.c
create mode 100644 sysdeps/ieee754/float128/e_hypotf128.c
create mode 100644 sysdeps/ieee754/float128/e_ilogbf128.c
create mode 100644 sysdeps/ieee754/float128/e_j0f128.c
create mode 100644 sysdeps/ieee754/float128/e_j1f128.c
create mode 100644 sysdeps/ieee754/float128/e_jnf128.c
create mode 100644 sysdeps/ieee754/float128/e_lgammaf128.c
create mode 100644 sysdeps/ieee754/float128/e_lgammaf128_r.c
create mode 100644 sysdeps/ieee754/float128/e_log10f128.c
create mode 100644 sysdeps/ieee754/float128/e_log2f128.c
create mode 100644 sysdeps/ieee754/float128/e_logf128.c
create mode 100644 sysdeps/ieee754/float128/e_powf128.c
create mode 100644 sysdeps/ieee754/float128/e_rem_pio2f128.c
create mode 100644 sysdeps/ieee754/float128/e_remainderf128.c
create mode 100644 sysdeps/ieee754/float128/e_scalbf128.c
create mode 100644 sysdeps/ieee754/float128/e_sinhf128.c
create mode 100644 sysdeps/ieee754/float128/e_sqrtf128.c
create mode 100644 sysdeps/ieee754/float128/float128_private.h
create mode 100644 sysdeps/ieee754/float128/gamma_productf128.c
create mode 100644 sysdeps/ieee754/float128/ieee754_float128.h
create mode 100644 sysdeps/ieee754/float128/k_cosf128.c
create mode 100644 sysdeps/ieee754/float128/k_rem_pio2f128.c
create mode 100644 sysdeps/ieee754/float128/k_sincosf128.c
create mode 100644 sysdeps/ieee754/float128/k_sinf128.c
create mode 100644 sysdeps/ieee754/float128/k_tanf128.c
create mode 100644 sysdeps/ieee754/float128/lgamma_negf128.c
create mode 100644 sysdeps/ieee754/float128/lgamma_productf128.c
create mode 100644 sysdeps/ieee754/float128/s_asinhf128.c
create mode 100644 sysdeps/ieee754/float128/s_atanf128.c
create mode 100644 sysdeps/ieee754/float128/s_cbrtf128.c
create mode 100644 sysdeps/ieee754/float128/s_ceilf128.c
create mode 100644 sysdeps/ieee754/float128/s_copysignf128.c
create mode 100644 sysdeps/ieee754/float128/s_cosf128.c
create mode 100644 sysdeps/ieee754/float128/s_erff128.c
create mode 100644 sysdeps/ieee754/float128/s_expm1f128.c
create mode 100644 sysdeps/ieee754/float128/s_fabsf128.c
create mode 100644 sysdeps/ieee754/float128/s_finitef128.c
create mode 100644 sysdeps/ieee754/float128/s_floorf128.c
create mode 100644 sysdeps/ieee754/float128/s_fmaf128.c
create mode 100644 sysdeps/ieee754/float128/s_fpclassifyf128.c
create mode 100644 sysdeps/ieee754/float128/s_frexpf128.c
create mode 100644 sysdeps/ieee754/float128/s_isinff128.c
create mode 100644 sysdeps/ieee754/float128/s_isnanf128.c
create mode 100644 sysdeps/ieee754/float128/s_issignalingf128.c
create mode 100644 sysdeps/ieee754/float128/s_llrintf128.c
create mode 100644 sysdeps/ieee754/float128/s_llroundf128.c
create mode 100644 sysdeps/ieee754/float128/s_log1pf128.c
create mode 100644 sysdeps/ieee754/float128/s_logbf128.c
create mode 100644 sysdeps/ieee754/float128/s_lrintf128.c
create mode 100644 sysdeps/ieee754/float128/s_lroundf128.c
create mode 100644 sysdeps/ieee754/float128/s_modff128.c
create mode 100644 sysdeps/ieee754/float128/s_nearbyintf128.c
create mode 100644 sysdeps/ieee754/float128/s_nextafterf128.c
create mode 100644 sysdeps/ieee754/float128/s_nexttowardf128.c
create mode 100644 sysdeps/ieee754/float128/s_nextupf128.c
create mode 100644 sysdeps/ieee754/float128/s_remquof128.c
create mode 100644 sysdeps/ieee754/float128/s_rintf128.c
create mode 100644 sysdeps/ieee754/float128/s_roundf128.c
create mode 100644 sysdeps/ieee754/float128/s_scalblnf128.c
create mode 100644 sysdeps/ieee754/float128/s_scalbnf128.c
create mode 100644 sysdeps/ieee754/float128/s_signbitf128.c
create mode 100644 sysdeps/ieee754/float128/s_significandf128.c
create mode 100644 sysdeps/ieee754/float128/s_sincosf128.c
create mode 100644 sysdeps/ieee754/float128/s_sinf128.c
create mode 100644 sysdeps/ieee754/float128/s_tanf128.c
create mode 100644 sysdeps/ieee754/float128/s_tanhf128.c
create mode 100644 sysdeps/ieee754/float128/s_truncf128.c
create mode 100644 sysdeps/ieee754/float128/t_sincosf128.c
create mode 100644 sysdeps/ieee754/float128/x2y2m1f128.c
diff --git a/sysdeps/ieee754/float128/e_acosf128.c b/sysdeps/ieee754/float128/e_acosf128.c
new file mode 100644
index 0000000..7ddf7dc
--- /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 0000000..f6dd40c
--- /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 0000000..133ab8d
--- /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 0000000..9aa740f
--- /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 0000000..f26c8d5
--- /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 0000000..2abf067
--- /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 0000000..b3468d2
--- /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_exp2f128.c b/sysdeps/ieee754/float128/e_exp2f128.c
new file mode 100644
index 0000000..adeda15
--- /dev/null
+++ b/sysdeps/ieee754/float128/e_exp2f128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include <math/e_exp2l.c>
diff --git a/sysdeps/ieee754/float128/e_expf128.c b/sysdeps/ieee754/float128/e_expf128.c
new file mode 100644
index 0000000..b727b17
--- /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 0000000..ed8a749
--- /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 0000000..895ac63
--- /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 0000000..1f06555
--- /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 0000000..2861801
--- /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 0000000..b624b5c
--- /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 0000000..445428e
--- /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 0000000..7854e11
--- /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.c b/sysdeps/ieee754/float128/e_lgammaf128.c
new file mode 100644
index 0000000..72f02ac
--- /dev/null
+++ b/sysdeps/ieee754/float128/e_lgammaf128.c
@@ -0,0 +1 @@
+/* _FloatN uses tgamma instead. */
diff --git a/sysdeps/ieee754/float128/e_lgammaf128_r.c b/sysdeps/ieee754/float128/e_lgammaf128_r.c
new file mode 100644
index 0000000..3517ac3
--- /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 0000000..1c3341e
--- /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 0000000..36becaa
--- /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 0000000..b0c9975
--- /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 0000000..3afaf7f
--- /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 0000000..86c2ca1
--- /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 0000000..90c18f8
--- /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 0000000..067b724
--- /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 0000000..42a54e0
--- /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/e_sqrtf128.c b/sysdeps/ieee754/float128/e_sqrtf128.c
new file mode 100644
index 0000000..1ac216f
--- /dev/null
+++ b/sysdeps/ieee754/float128/e_sqrtf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include <math/e_sqrtl.c>
diff --git a/sysdeps/ieee754/float128/float128_private.h b/sysdeps/ieee754/float128/float128_private.h
new file mode 100644
index 0000000..82f2f52
--- /dev/null
+++ b/sysdeps/ieee754/float128/float128_private.h
@@ -0,0 +1,343 @@
+/* _Float128 overrides for building ldbl-128 as _Float128.
+ Copyright (C) 2016 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 <math.h>
+#include <math/mul_splitl.h>
+
+/* Override parts of long double code as float128. */
+#define __LDBL_OVERRIDE 1
+
+#if !__GNUC_PREREQ (7,0)
+# define L(x) x##Q
+typedef __float128 _Float128;
+#else
+# define L(x) x##F128
+#endif
+
+/* 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() SET_RESTORE_ROUNDF128()
+#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 HUGE_VALL
+#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 HUGE_VALL HUGE_VAL_F128
+#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
+
+
+/* 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 __atanl __atanf128
+#define __cbrtl __cbrtf128
+#define __ceill __ceilf128
+#define __ceill __ceilf128
+#define __copysignl __copysignf128
+#define __copysignl __copysignf128
+#define __cosl __cosf128
+#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 __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 __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 __truncl __truncf128
+#define __x2y2m1l __x2y2m1f128
+
+/* __nexttowardf128 is not _Float128 API. */
+#define __nexttowardl __nexttowardf128_do_not_use
+#define nexttowardl nexttowardf128_do_not_use
+
+/* __nanl is actually a macro. */
+#undef __nanl
+#define __nanl(str) __nanf128(str)
+
+
+/* public entry points. */
+#define asinhl asinhf128
+#define atanl atanf128
+#define atanl atanf128
+#define cbrtl cbrtf128
+#define ceill ceilf128
+#define ceill ceilf128
+#define copysignl copysignf128
+#define copysignl copysignf128
+#define cosl cosf128
+#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 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 nanl nanf128
+#define nearbyintl nearbyintf128
+#define nextafterl nextafterf128
+#define nextdownl nextdownf128
+#define nextupl nextupf128
+#define remquol remquof128
+#define rintl rintf128
+#define roundl roundf128
+#define scalbnl scalbnf128
+#define signbitl signbitf128
+#define sincosl sincosf128
+#define sinl sinf128
+#define sqrtl sqrtf128
+#define tanhl tanhf128
+#define tanl tanf128
+#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 __sincosl_table __sincosf128_table
+#define mul_splitl mul_splitf128
+
+/* assume GCC >= 6.2 and use the type-generic builtin. */
+#define __builtin_copysignl __builtin_copysign
+#define __builtin_signbitl __builtin_signbit
+
+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 0000000..be2271f
--- /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 0000000..5bd3a98
--- /dev/null
+++ b/sysdeps/ieee754/float128/ieee754_float128.h
@@ -0,0 +1,140 @@
+/* _Float128 IEEE like macros.
+ Copyright (C) 2016 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 0000000..9db0906
--- /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_rem_pio2f128.c b/sysdeps/ieee754/float128/k_rem_pio2f128.c
new file mode 100644
index 0000000..5140266
--- /dev/null
+++ b/sysdeps/ieee754/float128/k_rem_pio2f128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include <math/k_rem_pio2l.c>
diff --git a/sysdeps/ieee754/float128/k_sincosf128.c b/sysdeps/ieee754/float128/k_sincosf128.c
new file mode 100644
index 0000000..14c0f1e
--- /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 0000000..f3acf1c
--- /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 0000000..ca6be53
--- /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 0000000..9c16f93
--- /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 0000000..5efe5dd
--- /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/s_asinhf128.c b/sysdeps/ieee754/float128/s_asinhf128.c
new file mode 100644
index 0000000..7b93d8c
--- /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 0000000..9b4d7ec
--- /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 0000000..3bd5797
--- /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 0000000..0af15f5
--- /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 0000000..808f7ab
--- /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 0000000..8ba5526
--- /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 0000000..ac16ad6
--- /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 0000000..ea28d89
--- /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_fabsf128.c b/sysdeps/ieee754/float128/s_fabsf128.c
new file mode 100644
index 0000000..79ba47c
--- /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 0000000..801de88
--- /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 0000000..1829843
--- /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 0000000..6497895
--- /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 0000000..15131dc
--- /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 0000000..7b040b3
--- /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_isinff128.c b/sysdeps/ieee754/float128/s_isinff128.c
new file mode 100644
index 0000000..62cc424
--- /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 0000000..efba240
--- /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 0000000..1d45995
--- /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 0000000..bb9ca58
--- /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 0000000..be54a90
--- /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 0000000..48bb84f
--- /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 0000000..167384a
--- /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 0000000..1cfa9d7
--- /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 0000000..13ba9f2
--- /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 0000000..4618c6c
--- /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 0000000..e61a3b3
--- /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 0000000..2c43a00
--- /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 0000000..006e4c9
--- /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 0000000..7d5d0b8
--- /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 0000000..1cef61a
--- /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 0000000..2adb95f
--- /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_roundf128.c b/sysdeps/ieee754/float128/s_roundf128.c
new file mode 100644
index 0000000..1eb36f2
--- /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 0000000..999223c
--- /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 0000000..0e7ab26
--- /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_signbitf128.c b/sysdeps/ieee754/float128/s_signbitf128.c
new file mode 100644
index 0000000..71c1ca3
--- /dev/null
+++ b/sysdeps/ieee754/float128/s_signbitf128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/s_signbitl.c"
diff --git a/sysdeps/ieee754/float128/s_significandf128.c b/sysdeps/ieee754/float128/s_significandf128.c
new file mode 100644
index 0000000..067b724
--- /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 0000000..472adde
--- /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 0000000..d79a116
--- /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 0000000..382961a
--- /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 0000000..e02c9a6
--- /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_truncf128.c b/sysdeps/ieee754/float128/s_truncf128.c
new file mode 100644
index 0000000..474d9dc
--- /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/t_sincosf128.c b/sysdeps/ieee754/float128/t_sincosf128.c
new file mode 100644
index 0000000..7e699d3
--- /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/x2y2m1f128.c b/sysdeps/ieee754/float128/x2y2m1f128.c
new file mode 100644
index 0000000..6888079
--- /dev/null
+++ b/sysdeps/ieee754/float128/x2y2m1f128.c
@@ -0,0 +1,2 @@
+#include <float128_private.h>
+#include "../ldbl-128/x2y2m1l.c"
--
2.4.11
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 8/8] float128: Add wrappers to override ldbl-128 as float128.
2016-11-09 18:41 ` [PATCH 8/8] float128: Add wrappers to override ldbl-128 as float128 Gabriel F. T. Gomes
@ 2016-11-09 22:13 ` Joseph Myers
0 siblings, 0 replies; 33+ messages in thread
From: Joseph Myers @ 2016-11-09 22:13 UTC (permalink / raw)
To: Gabriel F. T. Gomes; +Cc: libc-alpha
On Wed, 9 Nov 2016, Gabriel F. T. Gomes wrote:
> +/* float.h constants. */
> +#include <float.h>
> +#undef HUGE_VALL
HUGE_VALL is not a float.h constant.
> +/* __nanl is actually a macro. */
> +#undef __nanl
> +#define __nanl(str) __nanf128(str)
Not since
2016-09-20 Paul E. Murphy <murphyp@linux.vnet.ibm.com>
* math/s_nanf.c: Remove __nanf undef.
* math/s_nan.c: Remove __nan undef.
* math/s_nanl.c: Remove __nanl undef.
* sysdeps/generic/math_private.h (__nan): Remove macro
override.
(__nanf): Likewise.
(__nanl): Likewise.
it isn't.
> +/* assume GCC >= 6.2 and use the type-generic builtin. */
> +#define __builtin_copysignl __builtin_copysign
> +#define __builtin_signbitl __builtin_signbit
__builtin_copysign is not and never has been type-generic (type-generic
built-in functions don't support the return type depending on the argument
type, so it couldn't possibly work as type-generic). You'll need to use
__builtin_copysignf128 and map to __builtin_copysignq for older compilers
(and for consistency I'd say use __builtin_signbitf128 similarly).
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 33+ messages in thread
* [PATCH 2/8] float128: Add _Float128 make bits to libm.
2016-11-09 18:41 [PATCH 0/8] More float128 declarations Gabriel F. T. Gomes
` (6 preceding siblings ...)
2016-11-09 18:41 ` [PATCH 8/8] float128: Add wrappers to override ldbl-128 as float128 Gabriel F. T. Gomes
@ 2016-11-09 18:41 ` Gabriel F. T. Gomes
2016-12-09 21:23 ` Tulio Magno Quites Machado Filho
2016-11-09 21:31 ` [PATCH 0/8] More float128 declarations Joseph Myers
8 siblings, 1 reply; 33+ messages in thread
From: Gabriel F. T. Gomes @ 2016-11-09 18:41 UTC (permalink / raw)
To: libc-alpha
From: "Paul E. Murphy" <murphyp@linux.vnet.ibm.com>
This adds the appropriate common bits for a platform to
enable float128 and expose ABI.
2016-10-21 Paul E. Murphy <murphyp@linux.vnet.ibm.com>
* math/Makefile:
(type-float128-suffix): New variable
(type-float128-routines): Likewise
(type-float128-yes): Likewise
(types): Append float128 if supported
* sysdeps/ieee754/float128/Makeconfig: New file.
* sysdeps/ieee754/float128/Versions: New file.
---
math/Makefile | 6 ++
sysdeps/ieee754/float128/Makeconfig | 3 +
sysdeps/ieee754/float128/Versions | 133 ++++++++++++++++++++++++++++++++++++
3 files changed, 142 insertions(+)
create mode 100644 sysdeps/ieee754/float128/Makeconfig
create mode 100644 sysdeps/ieee754/float128/Versions
diff --git a/math/Makefile b/math/Makefile
index f400d7b..37e7ea0 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -108,6 +108,11 @@ type-double-routines := branred doasin dosincos halfulp mpa mpatan2 \
type-float-suffix := f
type-float-routines := k_rem_pio2f
+# _Float128 support
+type-float128-suffix := f128
+type-float128-routines := t_sincosf128 k_sincosf128
+type-float128-yes := float128
+types += $(type-float128-$(float128-fcts))
# Apply suffix to each type in arg 1
type-foreach = $(foreach t,$(types),$(subst F,$(type-$(t)-suffix),$(1)))
@@ -374,6 +379,7 @@ endif
CFLAGS-s_modf.c += -fsignaling-nans
CFLAGS-s_modff.c += -fsignaling-nans
CFLAGS-s_modfl.c += -fsignaling-nans
+CFLAGS-s_modff128.c += -fsignaling-nans
# The -lieee library is actually an object file.
# The module just defines the _LIB_VERSION_ variable.
diff --git a/sysdeps/ieee754/float128/Makeconfig b/sysdeps/ieee754/float128/Makeconfig
new file mode 100644
index 0000000..6c385d2
--- /dev/null
+++ b/sysdeps/ieee754/float128/Makeconfig
@@ -0,0 +1,3 @@
+# Include this earlier so it can be used earlier in Makefiles,
+# and sysdep/ makefiles.
+float128-fcts = yes
diff --git a/sysdeps/ieee754/float128/Versions b/sysdeps/ieee754/float128/Versions
new file mode 100644
index 0000000..cee823b
--- /dev/null
+++ b/sysdeps/ieee754/float128/Versions
@@ -0,0 +1,133 @@
+%include <float128-abi.h>
+%ifndef FLOAT128_VERSION
+% error "float128-abi.h must define FLOAT128_VERSION"
+%endif
+libm {
+ FLOAT128_VERSION {
+ acosf128;
+ acoshf128;
+ asinf128;
+ asinhf128;
+ atan2f128;
+ atanf128;
+ atanhf128;
+ copysignf128;
+ cosf128;
+ coshf128;
+ erff128;
+ erfcf128;
+ exp2f128;
+ expf128;
+ expm1f128;
+ fabsf128;
+ fdimf128;
+ floorf128;
+ fmaf128;
+ fmaxf128;
+ fminf128;
+ fmodf128;
+ frexpf128;
+ getpayloadf128;
+ hypotf128;
+ ilogbf128;
+ ldexpf128;
+ lgammaf128;
+ llrintf128;
+ llroundf128;
+ log10f128;
+ log1pf128;
+ log2f128;
+ logf128;
+ logbf128;
+ lrintf128;
+ lroundf128;
+ modff128;
+ nanf128;
+ nearbyintf128;
+ nextafterf128;
+ nextdownf128;
+ nextupf128;
+ powf128;
+ remainderf128;
+ remquof128;
+ rintf128;
+ roundf128;
+ scalblnf128;
+ scalbnf128;
+ sinf128;
+ sinhf128;
+ sqrtf128;
+ tanf128;
+ tanhf128;
+ tgammaf128;
+ totalorderf128;
+ totalordermagf128;
+ truncf128;
+ exp10f128;
+ j0f128;
+ j1f128;
+ jnf128;
+ lgammaf128_r;
+ sincosf128;
+ y0f128;
+ y1f128;
+ ynf128;
+ __finitef128;
+ __fpclassifyf128;
+ __isinff128;
+ __isnanf128;
+ __issignalingf128;
+ __signbitf128;
+ cabsf128;
+ cacosf128;
+ cacoshf128;
+ cargf128;
+ casinf128;
+ casinhf128;
+ catanf128;
+ catanhf128;
+ cbrtf128;
+ ccosf128;
+ ccoshf128;
+ ceilf128;
+ cexpf128;
+ cimagf128;
+ clogf128;
+ conjf128;
+ cprojf128;
+ crealf128;
+ csinf128;
+ csinhf128;
+ csqrtf128;
+ ctanf128;
+ ctanhf128;
+ cpowf128;
+ clog10f128;
+ __acosf128_finite;
+ __acoshf128_finite;
+ __asinf128_finite;
+ __atan2f128_finite;
+ __atanhf128_finite;
+ __coshf128_finite;
+ __exp2f128_finite;
+ __expf128_finite;
+ __fmodf128_finite;
+ __hypotf128_finite;
+ __lgammaf128_r_finite;
+ __log10f128_finite;
+ __log2f128_finite;
+ __logf128_finite;
+ __powf128_finite;
+ __remainderf128_finite;
+ __sinhf128_finite;
+ __sqrtf128_finite;
+ __gammaf128_r_finite;
+ __exp10f128_finite;
+ __j0f128_finite;
+ __j1f128_finite;
+ __jnf128_finite;
+ __y0f128_finite;
+ __y1f128_finite;
+ __ynf128_finite;
+ }
+}
--
2.4.11
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 2/8] float128: Add _Float128 make bits to libm.
2016-11-09 18:41 ` [PATCH 2/8] float128: Add _Float128 make bits to libm Gabriel F. T. Gomes
@ 2016-12-09 21:23 ` Tulio Magno Quites Machado Filho
2016-12-12 22:49 ` Joseph Myers
0 siblings, 1 reply; 33+ messages in thread
From: Tulio Magno Quites Machado Filho @ 2016-12-09 21:23 UTC (permalink / raw)
To: Joseph Myers; +Cc: Gabriel F. T. Gomes, libc-alpha
"Gabriel F. T. Gomes" <gftg@linux.vnet.ibm.com> writes:
> From: "Paul E. Murphy" <murphyp@linux.vnet.ibm.com>
>
> This adds the appropriate common bits for a platform to
> enable float128 and expose ABI.
Joseph, I'd like to clarify one thing:
In a previous thread you mentioned that you'd review one patch of a
patchset after fixing/committing the previous patch.
In this patchset, you replied directly to patch #3, without making comments to
patch #1 and #2. Does that mean they look good for you?
--
Tulio Magno
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 2/8] float128: Add _Float128 make bits to libm.
2016-12-09 21:23 ` Tulio Magno Quites Machado Filho
@ 2016-12-12 22:49 ` Joseph Myers
0 siblings, 0 replies; 33+ messages in thread
From: Joseph Myers @ 2016-12-12 22:49 UTC (permalink / raw)
To: Tulio Magno Quites Machado Filho; +Cc: Gabriel F. T. Gomes, libc-alpha
On Fri, 9 Dec 2016, Tulio Magno Quites Machado Filho wrote:
> "Gabriel F. T. Gomes" <gftg@linux.vnet.ibm.com> writes:
>
> > From: "Paul E. Murphy" <murphyp@linux.vnet.ibm.com>
> >
> > This adds the appropriate common bits for a platform to
> > enable float128 and expose ABI.
>
> Joseph, I'd like to clarify one thing:
> In a previous thread you mentioned that you'd review one patch of a
> patchset after fixing/committing the previous patch.
>
> In this patchset, you replied directly to patch #3, without making comments to
> patch #1 and #2. Does that mean they look good for you?
No. There can be cases where dependencies among patches in a series, and
the likelihood of issues with one patch requiring changes to subsequent
patches, can mean that latter patches are more reviewable once earlier
patches have passed their final review. And it may well end up that this
series is like that. But for the series posted on 9 Nov I didn't do that.
Instead, I did an initial general pass over the whole patch series to
identify the most obvious issues - with all patches rather than just the
first ones, so all patches can be updated accordingly for the next
iteration of the series.
I did comment on patch 2 - in my general comments on patch 0, relating to
having the correct, consistent API/ABI exposed for the new types through
the whole patch series, which affect patch 2 as well as other patches.
https://sourceware.org/ml/libc-alpha/2016-11/msg00361.html
https://sourceware.org/ml/libc-alpha/2016-11/msg00370.html
(Note also the point there that when it comes to such things involving
long lists of functions for the new type - in the cases where it's
unavoidable to have such long lists, as opposed to the cases where
existing lists for existing types can be macroized - one can have more
confidence in the completeness of the list if the patch series as a whole
has passed testing with existing libm tests enabled for the new type, so
showing through the testsuite that all the expected functions are indeed
exported for that type.)
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 0/8] More float128 declarations
2016-11-09 18:41 [PATCH 0/8] More float128 declarations Gabriel F. T. Gomes
` (7 preceding siblings ...)
2016-11-09 18:41 ` [PATCH 2/8] float128: Add _Float128 make bits to libm Gabriel F. T. Gomes
@ 2016-11-09 21:31 ` Joseph Myers
2016-11-09 23:52 ` Joseph Myers
8 siblings, 1 reply; 33+ messages in thread
From: Joseph Myers @ 2016-11-09 21:31 UTC (permalink / raw)
To: Gabriel F. T. Gomes; +Cc: libc-alpha
This seems inconsistent about whether the recently added TS 18661-1
functions are covered or not. I'd expect all of the following to have
version map entries: __iseqsigf128 totalorderf128 totalordermagf128
getpayloadf128 canonicalizef128, and, where the definitions aren't
type-generic, to have function definitions for float128.
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH 0/8] More float128 declarations
2016-11-09 21:31 ` [PATCH 0/8] More float128 declarations Joseph Myers
@ 2016-11-09 23:52 ` Joseph Myers
0 siblings, 0 replies; 33+ messages in thread
From: Joseph Myers @ 2016-11-09 23:52 UTC (permalink / raw)
To: Gabriel F. T. Gomes; +Cc: libc-alpha
On Wed, 9 Nov 2016, Joseph Myers wrote:
> This seems inconsistent about whether the recently added TS 18661-1
> functions are covered or not. I'd expect all of the following to have
> version map entries: __iseqsigf128 totalorderf128 totalordermagf128
> getpayloadf128 canonicalizef128, and, where the definitions aren't
> type-generic, to have function definitions for float128.
Also, this inconsistency suggests to me that the patches haven't been
testing in conjunction with subsequent patches that actually enable the
new functions and their associated tests, because the tests would have
failed to link if some functions were absent.
Anything that involves adding new files / declarations / macros for each
new function should probably best have its final review as part of the
patch series that actually enables the new functions and associated tests
for at least one system, as otherwise it's hard to have confidence in the
completeness and correctness of the changes. (That is, while it's
possible to spot some issues without such testing, final approval of such
patches should wait until the code for the new types has gone through
testing. Whereas e.g. a conversion of math-finite.h to use macros to
declare functions could be done in a way involving no float128
conditionals at all, so entirely suitable to review by itself, with the
float128 patches then just adapting the macro definitions to handle
float128.)
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 33+ messages in thread