diff mbox series

[v3,6/6] powerpc64le: Enable support for IEEE long double

Message ID cb74a63078fbbcd09a5c4eb6dd7d3ddc89234f0d.1586199342.git.murphyp@linux.vnet.ibm.com
State New
Headers show
Series IEEE binary128 long double on powerpc64le | expand

Commit Message

Michael Kerrisk \(man-pages\) via Libc-alpha April 6, 2020, 7:12 p.m. UTC
From: "Gabriel F. T. Gomes" <gabrielftg@linux.ibm.com>

Changes since v5:

  - Rebase against inline math test removal

Changes since v4:

  - More Makefile massaging
  - Add ULPs for ieee128 only _Float128 redirects
  - Update for glibc 2.32
  - Add short NEWS entry

Changes since v4:

  - Removed the redirections code (moved to a separate commit).

No changes since v3.

Changes since v2:

  - Added definition of LDBL_IBM128_COMPAT_VERSION and
    LDBL_IBM128_VERSION (moved from a previous commit).

Changes since v1:

  - Use __LONG_DOUBLE_USES_FLOAT128 directly.

-- 8< --
On platforms where long double may have two different formats, i.e.: the
same format as double (64-bits) or something else (128-bits), building
with -mlong-double-128 is the default and function calls in the user
program match the name of the function in Glibc.  When building with
-mlong-double-64, Glibc installed headers redirect such calls to the
appropriate function.

Likewise, the internals of glibc are now built against IEEE long double.
However, the only (minimally) notable usage of long double is difftime.
---
 NEWS                                          |   5 +
 sysdeps/powerpc/fpu/libm-test-ulps            |   4 +
 sysdeps/powerpc/powerpc64/le/Implies-before   |   1 +
 sysdeps/powerpc/powerpc64/le/Makefile         |   4 +
 .../powerpc64/le/ldbl-128ibm-compat-abi.h     |   8 ++
 .../linux/powerpc/powerpc64/le/libc.abilist   |  93 ++++++++++++++
 .../linux/powerpc/powerpc64/le/libm.abilist   | 117 ++++++++++++++++++
 7 files changed, 232 insertions(+)
 create mode 100644 sysdeps/unix/sysv/linux/powerpc/powerpc64/le/ldbl-128ibm-compat-abi.h

Comments

Paul E Murphy April 22, 2020, 3:03 p.m. UTC | #1
On 4/6/20 2:12 PM, Paul E. Murphy via Libc-alpha wrote:
> From: "Gabriel F. T. Gomes" <gabrielftg@linux.ibm.com>
> 
> Changes since v5:
> 
>    - Rebase against inline math test removal
> 
> Changes since v4:
> 
>    - More Makefile massaging
>    - Add ULPs for ieee128 only _Float128 redirects
>    - Update for glibc 2.32
>    - Add short NEWS entry
> 
> Changes since v4:
> 
>    - Removed the redirections code (moved to a separate commit).
> 
> No changes since v3.
> 
> Changes since v2:
> 
>    - Added definition of LDBL_IBM128_COMPAT_VERSION and
>      LDBL_IBM128_VERSION (moved from a previous commit).
> 
> Changes since v1:
> 
>    - Use __LONG_DOUBLE_USES_FLOAT128 directly.
> 
> -- 8< --
> On platforms where long double may have two different formats, i.e.: the
> same format as double (64-bits) or something else (128-bits), building
> with -mlong-double-128 is the default and function calls in the user
> program match the name of the function in Glibc.  When building with
> -mlong-double-64, Glibc installed headers redirect such calls to the
> appropriate function.
> 
> Likewise, the internals of glibc are now built against IEEE long double.
> However, the only (minimally) notable usage of long double is difftime.
> ---
>   NEWS                                          |   5 +
>   sysdeps/powerpc/fpu/libm-test-ulps            |   4 +
>   sysdeps/powerpc/powerpc64/le/Implies-before   |   1 +
>   sysdeps/powerpc/powerpc64/le/Makefile         |   4 +
>   .../powerpc64/le/ldbl-128ibm-compat-abi.h     |   8 ++
>   .../linux/powerpc/powerpc64/le/libc.abilist   |  93 ++++++++++++++
>   .../linux/powerpc/powerpc64/le/libm.abilist   | 117 ++++++++++++++++++
>   7 files changed, 232 insertions(+)
>   create mode 100644 sysdeps/unix/sysv/linux/powerpc/powerpc64/le/ldbl-128ibm-compat-abi.h
> 
> diff --git a/NEWS b/NEWS
> index 07da1545b4..a54c0e0f65 100644

I will commit the remaining ppc64le specific enablement patches Friday 
if there are no further requests for improvement.
Florian Weimer April 22, 2020, 3:15 p.m. UTC | #2
* Paul E. Murphy via Libc-alpha:

> diff --git a/NEWS b/NEWS
> index 07da1545b4..a54c0e0f65 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -14,6 +14,11 @@ Major new features:
>  * The GNU C Library now loads audit modules listed in the DT_AUDIT and
>    DT_DEPAUDIT dynamic section entries of the main executable.
>  
> +* powerpc64le supports IEEE128 long double libm/libc redirects when
> +  using the -mabi=ieeelongdouble to compile C code on supported GCC
> +  toolchains.  It is recommended to use GCC 8 or newer when testing
> +  this option.

Why do you write “testing this option”?

To me, this implies that the feature is not ready yet.  Is that the
case?
Paul E Murphy April 22, 2020, 4:20 p.m. UTC | #3
On 4/22/20 10:15 AM, Florian Weimer wrote:
> * Paul E. Murphy via Libc-alpha:
> 
>> diff --git a/NEWS b/NEWS
>> index 07da1545b4..a54c0e0f65 100644
>> --- a/NEWS
>> +++ b/NEWS
>> @@ -14,6 +14,11 @@ Major new features:
>>   * The GNU C Library now loads audit modules listed in the DT_AUDIT and
>>     DT_DEPAUDIT dynamic section entries of the main executable.
>>   
>> +* powerpc64le supports IEEE128 long double libm/libc redirects when
>> +  using the -mabi=ieeelongdouble to compile C code on supported GCC
>> +  toolchains.  It is recommended to use GCC 8 or newer when testing
>> +  this option.
> 
> Why do you write “testing this option”?
> 
> To me, this implies that the feature is not ready yet.  Is that the
> case?
> 
I still consider the IEEE128 ldouble feature experimental on ppc64le. 
Thus, why we need to explicitly invoke extra compiler options today. 
This is another necessary step towards maturing the feature.  The ABI 
needs to be stablized to continue gcc enablement, and I think the ABI 
piece is ready.
Florian Weimer April 22, 2020, 4:23 p.m. UTC | #4
* Paul E. Murphy:

> On 4/22/20 10:15 AM, Florian Weimer wrote:
>> * Paul E. Murphy via Libc-alpha:
>> 
>>> diff --git a/NEWS b/NEWS
>>> index 07da1545b4..a54c0e0f65 100644
>>> --- a/NEWS
>>> +++ b/NEWS
>>> @@ -14,6 +14,11 @@ Major new features:
>>>   * The GNU C Library now loads audit modules listed in the DT_AUDIT and
>>>     DT_DEPAUDIT dynamic section entries of the main executable.
>>>   
>>> +* powerpc64le supports IEEE128 long double libm/libc redirects when
>>> +  using the -mabi=ieeelongdouble to compile C code on supported GCC
>>> +  toolchains.  It is recommended to use GCC 8 or newer when testing
>>> +  this option.
>> 
>> Why do you write “testing this option”?
>> 
>> To me, this implies that the feature is not ready yet.  Is that the
>> case?
>> 
> I still consider the IEEE128 ldouble feature experimental on ppc64le. 
> Thus, why we need to explicitly invoke extra compiler options today. 
> This is another necessary step towards maturing the feature.  The ABI 
> needs to be stablized to continue gcc enablement, and I think the ABI 
> piece is ready.

Ahh, thanks.  I think then the text is fine, and we can revisit the
overall presentation of this feature in the NEWS file later, closer to
the glibc 2.32 release.
diff mbox series

Patch

diff --git a/NEWS b/NEWS
index 07da1545b4..a54c0e0f65 100644
--- a/NEWS
+++ b/NEWS
@@ -14,6 +14,11 @@  Major new features:
 * The GNU C Library now loads audit modules listed in the DT_AUDIT and
   DT_DEPAUDIT dynamic section entries of the main executable.
 
+* powerpc64le supports IEEE128 long double libm/libc redirects when
+  using the -mabi=ieeelongdouble to compile C code on supported GCC
+  toolchains.  It is recommended to use GCC 8 or newer when testing
+  this option.
+
 Deprecated and removed features, and other changes affecting compatibility:
 
   [Add deprecations, removals and changes affecting compatibility here]
diff --git a/sysdeps/powerpc/fpu/libm-test-ulps b/sysdeps/powerpc/fpu/libm-test-ulps
index 73f18cf1df..695c5eee7e 100644
--- a/sysdeps/powerpc/fpu/libm-test-ulps
+++ b/sysdeps/powerpc/fpu/libm-test-ulps
@@ -1264,21 +1264,25 @@  ldouble: 1
 Function: "gamma":
 double: 3
 float: 4
+float128: 5
 ldouble: 3
 
 Function: "gamma_downward":
 double: 4
 float: 4
+float128: 8
 ldouble: 15
 
 Function: "gamma_towardzero":
 double: 4
 float: 3
+float128: 5
 ldouble: 16
 
 Function: "gamma_upward":
 double: 4
 float: 5
+float128: 8
 ldouble: 11
 
 Function: "hypot":
diff --git a/sysdeps/powerpc/powerpc64/le/Implies-before b/sysdeps/powerpc/powerpc64/le/Implies-before
index 7c20db4e97..2139f4dae8 100644
--- a/sysdeps/powerpc/powerpc64/le/Implies-before
+++ b/sysdeps/powerpc/powerpc64/le/Implies-before
@@ -1,4 +1,5 @@ 
 # On PowerPC we use the IBM extended long double format.
+ieee754/ldbl-128ibm-compat
 ieee754/ldbl-128ibm
 ieee754/ldbl-opt
 ieee754/dbl-64
diff --git a/sysdeps/powerpc/powerpc64/le/Makefile b/sysdeps/powerpc/powerpc64/le/Makefile
index 6afa1228dd..05ab13d85c 100644
--- a/sysdeps/powerpc/powerpc64/le/Makefile
+++ b/sysdeps/powerpc/powerpc64/le/Makefile
@@ -20,6 +20,10 @@  no-gnu-attribute-CFLAGS = -mno-gnu-attribute
 # We built an object file and extract the desired .gnu.attributes section
 # to be inserted into lib{c,m}.so.
 ifeq ($(build-shared),yes)
+
+# Build everything with IEEE 128-bit long double.
+sysdep-CFLAGS += -mabi=ieeelongdouble -Wno-psabi $(no-gnu-attribute-CFLAGS)
+
 before-compile += $(common-objpfx)no_ldbl_gnu_attribute.bin
 
 $(common-objpfx)no_ldbl_gnu_attribute.bin: $(..)sysdeps/powerpc/powerpc64/le/no_ldbl_gnu_attribute.c
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/ldbl-128ibm-compat-abi.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/ldbl-128ibm-compat-abi.h
new file mode 100644
index 0000000000..34c7b6bed6
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/ldbl-128ibm-compat-abi.h
@@ -0,0 +1,8 @@ 
+/* ABI version for long double switch to IEEE 128-bit floating point..
+   This is used by the Versions and math_ldbl_opt.h files in
+   sysdeps/ieee754/ldbl-128ibm-compat/.  It gives the ABI version where
+   long double == ibm128 was replaced with long double == _Float128
+   for libm *l functions and libc functions using long double.  */
+
+#define LDBL_IBM128_VERSION		GLIBC_2.32
+#define LDBL_IBM128_COMPAT_VERSION	GLIBC_2_32
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
index 2229a1dcc0..c0ca0d6907 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist
@@ -2247,3 +2247,96 @@  GLIBC_2.30 getdents64 F
 GLIBC_2.30 gettid F
 GLIBC_2.30 tgkill F
 GLIBC_2.30 twalk_r F
+GLIBC_2.32 __argp_errorieee128 F
+GLIBC_2.32 __argp_failureieee128 F
+GLIBC_2.32 __asprintf_chkieee128 F
+GLIBC_2.32 __asprintfieee128 F
+GLIBC_2.32 __dprintf_chkieee128 F
+GLIBC_2.32 __dprintfieee128 F
+GLIBC_2.32 __errieee128 F
+GLIBC_2.32 __error_at_lineieee128 F
+GLIBC_2.32 __errorieee128 F
+GLIBC_2.32 __errxieee128 F
+GLIBC_2.32 __fprintf_chkieee128 F
+GLIBC_2.32 __fprintfieee128 F
+GLIBC_2.32 __fscanfieee128 F
+GLIBC_2.32 __fwprintf_chkieee128 F
+GLIBC_2.32 __fwprintfieee128 F
+GLIBC_2.32 __fwscanfieee128 F
+GLIBC_2.32 __isoc99_fscanfieee128 F
+GLIBC_2.32 __isoc99_fwscanfieee128 F
+GLIBC_2.32 __isoc99_scanfieee128 F
+GLIBC_2.32 __isoc99_sscanfieee128 F
+GLIBC_2.32 __isoc99_swscanfieee128 F
+GLIBC_2.32 __isoc99_vfscanfieee128 F
+GLIBC_2.32 __isoc99_vfwscanfieee128 F
+GLIBC_2.32 __isoc99_vscanfieee128 F
+GLIBC_2.32 __isoc99_vsscanfieee128 F
+GLIBC_2.32 __isoc99_vswscanfieee128 F
+GLIBC_2.32 __isoc99_vwscanfieee128 F
+GLIBC_2.32 __isoc99_wscanfieee128 F
+GLIBC_2.32 __obstack_printf_chkieee128 F
+GLIBC_2.32 __obstack_printfieee128 F
+GLIBC_2.32 __obstack_vprintf_chkieee128 F
+GLIBC_2.32 __obstack_vprintfieee128 F
+GLIBC_2.32 __printf_chkieee128 F
+GLIBC_2.32 __printf_sizeieee128 F
+GLIBC_2.32 __printfieee128 F
+GLIBC_2.32 __qecvtieee128 F
+GLIBC_2.32 __qecvtieee128_r F
+GLIBC_2.32 __qfcvtieee128 F
+GLIBC_2.32 __qfcvtieee128_r F
+GLIBC_2.32 __qgcvtieee128 F
+GLIBC_2.32 __scanfieee128 F
+GLIBC_2.32 __snprintf_chkieee128 F
+GLIBC_2.32 __snprintfieee128 F
+GLIBC_2.32 __sprintf_chkieee128 F
+GLIBC_2.32 __sprintfieee128 F
+GLIBC_2.32 __sscanfieee128 F
+GLIBC_2.32 __strfmon_lieee128 F
+GLIBC_2.32 __strfmonieee128 F
+GLIBC_2.32 __strfromieee128 F
+GLIBC_2.32 __strtoieee128 F
+GLIBC_2.32 __strtoieee128_l F
+GLIBC_2.32 __swprintf_chkieee128 F
+GLIBC_2.32 __swprintfieee128 F
+GLIBC_2.32 __swscanfieee128 F
+GLIBC_2.32 __syslog_chkieee128 F
+GLIBC_2.32 __syslogieee128 F
+GLIBC_2.32 __vasprintf_chkieee128 F
+GLIBC_2.32 __vasprintfieee128 F
+GLIBC_2.32 __vdprintf_chkieee128 F
+GLIBC_2.32 __vdprintfieee128 F
+GLIBC_2.32 __verrieee128 F
+GLIBC_2.32 __verrxieee128 F
+GLIBC_2.32 __vfprintf_chkieee128 F
+GLIBC_2.32 __vfprintfieee128 F
+GLIBC_2.32 __vfscanfieee128 F
+GLIBC_2.32 __vfwprintf_chkieee128 F
+GLIBC_2.32 __vfwprintfieee128 F
+GLIBC_2.32 __vfwscanfieee128 F
+GLIBC_2.32 __vprintf_chkieee128 F
+GLIBC_2.32 __vprintfieee128 F
+GLIBC_2.32 __vscanfieee128 F
+GLIBC_2.32 __vsnprintf_chkieee128 F
+GLIBC_2.32 __vsnprintfieee128 F
+GLIBC_2.32 __vsprintf_chkieee128 F
+GLIBC_2.32 __vsprintfieee128 F
+GLIBC_2.32 __vsscanfieee128 F
+GLIBC_2.32 __vswprintf_chkieee128 F
+GLIBC_2.32 __vswprintfieee128 F
+GLIBC_2.32 __vswscanfieee128 F
+GLIBC_2.32 __vsyslog_chkieee128 F
+GLIBC_2.32 __vsyslogieee128 F
+GLIBC_2.32 __vwarnieee128 F
+GLIBC_2.32 __vwarnxieee128 F
+GLIBC_2.32 __vwprintf_chkieee128 F
+GLIBC_2.32 __vwprintfieee128 F
+GLIBC_2.32 __vwscanfieee128 F
+GLIBC_2.32 __warnieee128 F
+GLIBC_2.32 __warnxieee128 F
+GLIBC_2.32 __wcstoieee128 F
+GLIBC_2.32 __wcstoieee128_l F
+GLIBC_2.32 __wprintf_chkieee128 F
+GLIBC_2.32 __wprintfieee128 F
+GLIBC_2.32 __wscanfieee128 F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libm.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libm.abilist
index d479a64fca..aa45e2639c 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libm.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libm.abilist
@@ -1097,3 +1097,120 @@  GLIBC_2.31 totalordermagf32x F
 GLIBC_2.31 totalordermagf64 F
 GLIBC_2.31 totalordermagf64x F
 GLIBC_2.31 totalordermagl F
+GLIBC_2.32 __acoshieee128 F
+GLIBC_2.32 __acosieee128 F
+GLIBC_2.32 __asinhieee128 F
+GLIBC_2.32 __asinieee128 F
+GLIBC_2.32 __atan2ieee128 F
+GLIBC_2.32 __atanhieee128 F
+GLIBC_2.32 __atanieee128 F
+GLIBC_2.32 __cabsieee128 F
+GLIBC_2.32 __cacoshieee128 F
+GLIBC_2.32 __cacosieee128 F
+GLIBC_2.32 __canonicalizeieee128 F
+GLIBC_2.32 __cargieee128 F
+GLIBC_2.32 __casinhieee128 F
+GLIBC_2.32 __casinieee128 F
+GLIBC_2.32 __catanhieee128 F
+GLIBC_2.32 __catanieee128 F
+GLIBC_2.32 __cbrtieee128 F
+GLIBC_2.32 __ccoshieee128 F
+GLIBC_2.32 __ccosieee128 F
+GLIBC_2.32 __ceilieee128 F
+GLIBC_2.32 __cexpieee128 F
+GLIBC_2.32 __cimagieee128 F
+GLIBC_2.32 __clog10ieee128 F
+GLIBC_2.32 __clogieee128 F
+GLIBC_2.32 __conjieee128 F
+GLIBC_2.32 __copysignieee128 F
+GLIBC_2.32 __coshieee128 F
+GLIBC_2.32 __cosieee128 F
+GLIBC_2.32 __cpowieee128 F
+GLIBC_2.32 __cprojieee128 F
+GLIBC_2.32 __crealieee128 F
+GLIBC_2.32 __csinhieee128 F
+GLIBC_2.32 __csinieee128 F
+GLIBC_2.32 __csqrtieee128 F
+GLIBC_2.32 __ctanhieee128 F
+GLIBC_2.32 __ctanieee128 F
+GLIBC_2.32 __erfcieee128 F
+GLIBC_2.32 __erfieee128 F
+GLIBC_2.32 __exp10ieee128 F
+GLIBC_2.32 __exp2ieee128 F
+GLIBC_2.32 __expieee128 F
+GLIBC_2.32 __expm1ieee128 F
+GLIBC_2.32 __f32addieee128 F
+GLIBC_2.32 __f32divieee128 F
+GLIBC_2.32 __f32mulieee128 F
+GLIBC_2.32 __f32subieee128 F
+GLIBC_2.32 __f64addieee128 F
+GLIBC_2.32 __f64divieee128 F
+GLIBC_2.32 __f64mulieee128 F
+GLIBC_2.32 __f64subieee128 F
+GLIBC_2.32 __fabsieee128 F
+GLIBC_2.32 __fdimieee128 F
+GLIBC_2.32 __floorieee128 F
+GLIBC_2.32 __fmaieee128 F
+GLIBC_2.32 __fmaxieee128 F
+GLIBC_2.32 __fmaxmagieee128 F
+GLIBC_2.32 __fminieee128 F
+GLIBC_2.32 __fminmagieee128 F
+GLIBC_2.32 __fmodieee128 F
+GLIBC_2.32 __frexpieee128 F
+GLIBC_2.32 __fromfpieee128 F
+GLIBC_2.32 __fromfpxieee128 F
+GLIBC_2.32 __getpayloadieee128 F
+GLIBC_2.32 __hypotieee128 F
+GLIBC_2.32 __ilogbieee128 F
+GLIBC_2.32 __j0ieee128 F
+GLIBC_2.32 __j1ieee128 F
+GLIBC_2.32 __jnieee128 F
+GLIBC_2.32 __ldexpieee128 F
+GLIBC_2.32 __lgammaieee128 F
+GLIBC_2.32 __lgammaieee128_r F
+GLIBC_2.32 __llogbieee128 F
+GLIBC_2.32 __llrintieee128 F
+GLIBC_2.32 __llroundieee128 F
+GLIBC_2.32 __log10ieee128 F
+GLIBC_2.32 __log1pieee128 F
+GLIBC_2.32 __log2ieee128 F
+GLIBC_2.32 __logbieee128 F
+GLIBC_2.32 __logieee128 F
+GLIBC_2.32 __lrintieee128 F
+GLIBC_2.32 __lroundieee128 F
+GLIBC_2.32 __modfieee128 F
+GLIBC_2.32 __nanieee128 F
+GLIBC_2.32 __nearbyintieee128 F
+GLIBC_2.32 __nextafterieee128 F
+GLIBC_2.32 __nextdownieee128 F
+GLIBC_2.32 __nexttoward_to_ieee128 F
+GLIBC_2.32 __nexttowardf_to_ieee128 F
+GLIBC_2.32 __nexttowardieee128 F
+GLIBC_2.32 __nextupieee128 F
+GLIBC_2.32 __powieee128 F
+GLIBC_2.32 __remainderieee128 F
+GLIBC_2.32 __remquoieee128 F
+GLIBC_2.32 __rintieee128 F
+GLIBC_2.32 __roundevenieee128 F
+GLIBC_2.32 __roundieee128 F
+GLIBC_2.32 __scalbieee128 F
+GLIBC_2.32 __scalblnieee128 F
+GLIBC_2.32 __scalbnieee128 F
+GLIBC_2.32 __setpayloadieee128 F
+GLIBC_2.32 __setpayloadsigieee128 F
+GLIBC_2.32 __significandieee128 F
+GLIBC_2.32 __sincosieee128 F
+GLIBC_2.32 __sinhieee128 F
+GLIBC_2.32 __sinieee128 F
+GLIBC_2.32 __sqrtieee128 F
+GLIBC_2.32 __tanhieee128 F
+GLIBC_2.32 __tanieee128 F
+GLIBC_2.32 __tgammaieee128 F
+GLIBC_2.32 __totalorderieee128 F
+GLIBC_2.32 __totalordermagieee128 F
+GLIBC_2.32 __truncieee128 F
+GLIBC_2.32 __ufromfpieee128 F
+GLIBC_2.32 __ufromfpxieee128 F
+GLIBC_2.32 __y0ieee128 F
+GLIBC_2.32 __y1ieee128 F
+GLIBC_2.32 __ynieee128 F