diff mbox series

[1/9] ldbl-128ibm-compat: Create libm-alias-float128.h

Message ID 20180606223909.16675-2-tuliom@linux.ibm.com
State New
Headers show
Series Introduce ieee128 symbols and redirections | expand

Commit Message

Tulio Magno Quites Machado Filho June 6, 2018, 10:39 p.m. UTC
Add a new libm-alias-float128.h in order to provide the __*ieee128
aliases for the existing *f128 that do not have a globally exported
symbol.

2018-06-06  Tulio Magno Quites Machado Filho  <tuliom@linux.ibm.com>
	    Gabriel F. T. Gomes  <gabriel@inconstante.eti.br>

	* sysdeps/ieee754/ldbl-128ibm-compat/Versions: New file.
	* sysdeps/ieee754/ldbl-128ibm-compat/libm-alias-float128.h: New file.
---
 sysdeps/ieee754/ldbl-128ibm-compat/Versions        | 129 +++++++++++++++++++++
 .../ldbl-128ibm-compat/libm-alias-float128.h       |  64 ++++++++++
 2 files changed, 193 insertions(+)
 create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/Versions
 create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/libm-alias-float128.h

Comments

Joseph Myers June 6, 2018, 11:05 p.m. UTC | #1
On Wed, 6 Jun 2018, Tulio Magno Quites Machado Filho wrote:

> +    __f32addieee128;
> +    __f32divieee128;
> +    __f32mulieee128;
> +    __f32subieee128;
> +    __f64addieee128;
> +    __f64divieee128;
> +    __f64mulieee128;
> +    __f64subieee128;
> +    __f64xaddieee128;
> +    __f64xdivieee128;
> +    __f64xmulieee128;
> +    __f64xsubieee128;

The __f64x* functions shouldn't be needed here.

The __f32* and __f64* ones seem appropriate (for faddl / daddl etc. 
redirection), but in patch 8 you appear to be redirecting instead to the 
f32* / f64* functions (only reserved in TS 18661-3, not in TS 18661-1).

> +    __gamma_productieee128;

__gamma_product is an internal part of libm, not a public exported 
function.  You should start from the *f128 functions that are actually 
exported from libm, and justify any additions to that set carefully 
(generally as functions that are part of the long double API and so need 
*ieee128 versions).

> +    __lgamma_negieee128;
> +    __lgamma_productieee128;

Again, these are internal implementation details, not exported functions.

> +    __x2y2m1ieee128;

Likewise.
Tulio Magno Quites Machado Filho June 13, 2018, 8:15 p.m. UTC | #2
Joseph Myers <joseph@codesourcery.com> writes:

> On Wed, 6 Jun 2018, Tulio Magno Quites Machado Filho wrote:
>
>> +    __f32addieee128;
>> +    __f32divieee128;
>> +    __f32mulieee128;
>> +    __f32subieee128;
>> +    __f64addieee128;
>> +    __f64divieee128;
>> +    __f64mulieee128;
>> +    __f64subieee128;
>> +    __f64xaddieee128;
>> +    __f64xdivieee128;
>> +    __f64xmulieee128;
>> +    __f64xsubieee128;
>
> The __f64x* functions shouldn't be needed here.
>
> The __f32* and __f64* ones seem appropriate (for faddl / daddl etc. 
> redirection), but in patch 8 you appear to be redirecting instead to the 
> f32* / f64* functions (only reserved in TS 18661-3, not in TS 18661-1).

OK.
The __f32*ieee128 and __f64*ieee128 symbols were not getting created.

>> +    __gamma_productieee128;
>
> __gamma_product is an internal part of libm, not a public exported 
> function.  You should start from the *f128 functions that are actually 
> exported from libm, and justify any additions to that set carefully 
> (generally as functions that are part of the long double API and so need 
> *ieee128 versions).
>
>> +    __lgamma_negieee128;
>> +    __lgamma_productieee128;
>
> Again, these are internal implementation details, not exported functions.
>
>> +    __x2y2m1ieee128;
>
> Likewise.

Oops.

Fixed all these errors.
diff mbox series

Patch

diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/Versions b/sysdeps/ieee754/ldbl-128ibm-compat/Versions
new file mode 100644
index 0000000000..af6b4b3f60
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/Versions
@@ -0,0 +1,129 @@ 
+%include <ldbl-128ibm-compat-abi.h>
+%ifndef LDBL_IBM128_VERSION
+% error "ldbl-128ibm-compat-abi.h must define LDBL_IBM128_VERSION"
+%endif
+
+libm {
+  LDBL_IBM128_VERSION {
+    __acoshieee128;
+    __acosieee128;
+    __asinhieee128;
+    __asinieee128;
+    __atan2ieee128;
+    __atanhieee128;
+    __atanieee128;
+    __cabsieee128;
+    __cacoshieee128;
+    __cacosieee128;
+    __canonicalizeieee128;
+    __cargieee128;
+    __casinhieee128;
+    __casinieee128;
+    __catanhieee128;
+    __catanieee128;
+    __cbrtieee128;
+    __ccoshieee128;
+    __ccosieee128;
+    __ceilieee128;
+    __cexpieee128;
+    __cimagieee128;
+    __clog10ieee128;
+    __clogieee128;
+    __conjieee128;
+    __copysignieee128;
+    __coshieee128;
+    __cosieee128;
+    __cpowieee128;
+    __cprojieee128;
+    __crealieee128;
+    __csinhieee128;
+    __csinieee128;
+    __csqrtieee128;
+    __ctanhieee128;
+    __ctanieee128;
+    __erfcieee128;
+    __erfieee128;
+    __exp10ieee128;
+    __exp2ieee128;
+    __expieee128;
+    __expm1ieee128;
+    __f32addieee128;
+    __f32divieee128;
+    __f32mulieee128;
+    __f32subieee128;
+    __f64addieee128;
+    __f64divieee128;
+    __f64mulieee128;
+    __f64subieee128;
+    __f64xaddieee128;
+    __f64xdivieee128;
+    __f64xmulieee128;
+    __f64xsubieee128;
+    __fabsieee128;
+    __fdimieee128;
+    __floorieee128;
+    __fmaieee128;
+    __fmaxieee128;
+    __fmaxmagieee128;
+    __fminieee128;
+    __fminmagieee128;
+    __fmodieee128;
+    __frexpieee128;
+    __fromfpieee128;
+    __fromfpxieee128;
+    __gamma_productieee128;
+    __getpayloadieee128;
+    __hypotieee128;
+    __ilogbieee128;
+    __j0ieee128;
+    __j1ieee128;
+    __jnieee128;
+    __ldexpieee128;
+    __lgammaieee128;
+    __lgammaieee128_r;
+    __lgamma_negieee128;
+    __lgamma_productieee128;
+    __llogbieee128;
+    __llrintieee128;
+    __llroundieee128;
+    __log10ieee128;
+    __log1pieee128;
+    __log2ieee128;
+    __logbieee128;
+    __logieee128;
+    __lrintieee128;
+    __lroundieee128;
+    __modfieee128;
+    __nanieee128;
+    __nearbyintieee128;
+    __nextafterieee128;
+    __nextdownieee128;
+    __nextupieee128;
+    __powieee128;
+    __remainderieee128;
+    __remquoieee128;
+    __rintieee128;
+    __roundevenieee128;
+    __roundieee128;
+    __scalblnieee128;
+    __scalbnieee128;
+    __setpayloadieee128;
+    __setpayloadsigieee128;
+    __sincosieee128;
+    __sinhieee128;
+    __sinieee128;
+    __sqrtieee128;
+    __tanhieee128;
+    __tanieee128;
+    __tgammaieee128;
+    __totalorderieee128;
+    __totalordermagieee128;
+    __truncieee128;
+    __ufromfpieee128;
+    __ufromfpxieee128;
+    __x2y2m1ieee128;
+    __y0ieee128;
+    __y1ieee128;
+    __ynieee128;
+  }
+}
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/libm-alias-float128.h b/sysdeps/ieee754/ldbl-128ibm-compat/libm-alias-float128.h
new file mode 100644
index 0000000000..a21dfcaea5
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/libm-alias-float128.h
@@ -0,0 +1,64 @@ 
+/* Define aliases for libm _Float128 functions.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _LIBM_ALIAS_FLOAT128_H
+#define _LIBM_ALIAS_FLOAT128_H
+
+#include <bits/floatn.h>
+#include <ldbl-128ibm-compat-abi.h>
+
+/* This macro should be used on all long double functions that are not part of
+   the _Float128 API in order to provide *ieee128 symbols without exposing
+   internal *f128 symbols.  */
+#define libm_alias_float128_other_r_ldbl(from, to, r) \
+  strong_alias (from ## f128 ## r, __ ## to ## ieee128 ## r)
+
+/* Define _FloatN / _FloatNx aliases (other than that for _Float128)
+   for a _Float128 libm function that has internal name FROM ## f128
+   ## R and public names TO ## suffix ## R for each suffix of a
+   supported _FloatN / _FloatNx floating-point type with the same
+   format as _Float128.  */
+#if __HAVE_FLOAT64X && !__HAVE_FLOAT64X_LONG_DOUBLE
+# define libm_alias_float128_other_r(from, to, r) \
+  weak_alias (from ## f128 ## r, to ## f64x ## r); \
+  libm_alias_float128_other_r_ldbl(from, to, r)
+#else
+# define libm_alias_float128_other_r(from, to, r) \
+  libm_alias_float128_other_r_ldbl(from, to, r)
+#endif
+
+/* Likewise, but without the R suffix.  */
+#define libm_alias_float128_other(from, to)	\
+  libm_alias_float128_other_r (from, to, )
+
+/* Define aliases for a _Float128 libm function that has internal name
+   FROM ## f128 ## R and public names TO ## suffix ## R for each
+   suffix of a supported floating-point type with the same format as
+   _Float128.  This should only be used for functions where such
+   public names exist for _FloatN types, not for
+   implementation-namespace exported names (where there is one name
+   per format, not per type) or for obsolescent functions not provided
+   for _FloatN types.  */
+#define libm_alias_float128_r(from, to, r)		\
+  weak_alias (from ## f128 ## r, to ## f128 ## r);	\
+  libm_alias_float128_other_r (from, to, r)
+
+/* Likewise, but without the R suffix.  */
+#define libm_alias_float128(from, to) libm_alias_float128_r (from, to, )
+
+#endif