[5/9] ldbl-128ibm-compat: Provide ISO C functions not provided by the _Float128 API

Message ID 20180606223909.16675-6-tuliom@linux.ibm.com
State New
Headers show
Series
  • Introduce ieee128 symbols and redirections
Related show

Commit Message

Tulio Magno Quites Machado Filho June 6, 2018, 10:39 p.m.
These functions do not exist in the float128 api, but they need to be
provided for long double (*l api) because they are part of ISO C.

This patch only adds the exported symbols that are used by user
programs, i.e. __gammaieee128 and __dremieee128.

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: Add __dremieee128
	and __gammaieee128.
	* sysdeps/ieee754/ldbl-128ibm-compat/w_lgammaf128.c: New file.
	* sysdeps/ieee754/ldbl-128ibm-compat/w_remainderf128.c: New file.
---
 sysdeps/ieee754/ldbl-128ibm-compat/Versions        |  2 ++
 sysdeps/ieee754/ldbl-128ibm-compat/w_lgammaf128.c  | 22 ++++++++++++++++++++++
 .../ieee754/ldbl-128ibm-compat/w_remainderf128.c   | 22 ++++++++++++++++++++++
 3 files changed, 46 insertions(+)
 create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/w_lgammaf128.c
 create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/w_remainderf128.c

Comments

Joseph Myers June 7, 2018, 2:50 p.m. | #1
On Wed, 6 Jun 2018, Tulio Magno Quites Machado Filho wrote:

> These functions do not exist in the float128 api, but they need to be
> provided for long double (*l api) because they are part of ISO C.

They're not part of ISO C; they are part of *the long double API provided 
by glibc* (and thus need to be provided for any alternative long double 
format just like any other semi-obsolescent but still-available long 
double interface, e.g. qecvt).

Is it possible to provide these particular functions in the API without 
adding extra ABIs for them?  For example, if the relevant case in math.h 
had #defines of __dremieee128 or __ieee128_dreml or whatever it ends up 
being to the corresponding name for remainder, and likewise for gamma / 
lgamma, would that work correctly with __REDIRECT to get calls to dreml 
and gammal working for -mabi=ieeelongdouble without needing to add two new 
ABIs and two new source files?
Tulio Magno Quites Machado Filho June 13, 2018, 9:41 p.m. | #2
Joseph Myers <joseph@codesourcery.com> writes:

> On Wed, 6 Jun 2018, Tulio Magno Quites Machado Filho wrote:
>
>> These functions do not exist in the float128 api, but they need to be
>> provided for long double (*l api) because they are part of ISO C.
>
> They're not part of ISO C; they are part of *the long double API provided 
> by glibc* (and thus need to be provided for any alternative long double 
> format just like any other semi-obsolescent but still-available long 
> double interface, e.g. qecvt).

Indeed.

> Is it possible to provide these particular functions in the API without 
> adding extra ABIs for them?  For example, if the relevant case in math.h 
> had #defines of __dremieee128 or __ieee128_dreml or whatever it ends up 
> being to the corresponding name for remainder, and likewise for gamma / 
> lgamma, would that work correctly with __REDIRECT to get calls to dreml 
> and gammal working for -mabi=ieeelongdouble without needing to add two new 
> ABIs and two new source files?

Yes, it is.

I'm dropping this patch.

Patch

diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/Versions b/sysdeps/ieee754/ldbl-128ibm-compat/Versions
index 06c19569c5..b7efe84918 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/Versions
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/Versions
@@ -41,6 +41,7 @@  libm {
     __csqrtieee128;
     __ctanhieee128;
     __ctanieee128;
+    __dremieee128;
     __erfcieee128;
     __erfieee128;
     __exp10ieee128;
@@ -71,6 +72,7 @@  libm {
     __frexpieee128;
     __fromfpieee128;
     __fromfpxieee128;
+    __gammaieee128;
     __gamma_productieee128;
     __getpayloadieee128;
     __hypotieee128;
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/w_lgammaf128.c b/sysdeps/ieee754/ldbl-128ibm-compat/w_lgammaf128.c
new file mode 100644
index 0000000000..2b213783da
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/w_lgammaf128.c
@@ -0,0 +1,22 @@ 
+/* Deprecated gammal 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/>.  */
+
+#include <math-type-macros-float128.h>
+#include <w_lgamma_template.c>
+
+libm_alias_float128_other_r_ldbl(__lgamma, gamma,)
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/w_remainderf128.c b/sysdeps/ieee754/ldbl-128ibm-compat/w_remainderf128.c
new file mode 100644
index 0000000000..218b8d8a75
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/w_remainderf128.c
@@ -0,0 +1,22 @@ 
+/* Deprecated dreml 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/>.  */
+
+#include <math-type-macros-float128.h>
+#include <w_remainder_template.c>
+
+libm_alias_float128_other_r_ldbl (__remainder, drem, );