This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[RFC PATCH v2 3/3] RFC: powerpc64le: Convert default long double format to IEEE binary128
- From: "Gabriel F. T. Gomes" <gabriel at inconstante dot eti dot br>
- To: <libc-alpha at sourceware dot org>
- Date: Tue, 5 Jun 2018 19:21:20 -0300
- Subject: [RFC PATCH v2 3/3] RFC: powerpc64le: Convert default long double format to IEEE binary128
- References: <20180605222120.24696-1-gabriel@inconstante.eti.br>
Do not commit!
A commit similar to this would be added only when all other changes are
ready, but without the temporary header redirections (explained below).
I'm sending this in the RFC in case someone wishes to test the previous
patches.
A note about temporary header redirections:
On powerpc64le, the implementation of long double with IEEE binary128
format is not complete. The redirections of the stdio.h functions
are supposed to be implemented in bits/stdio-ldbl.h, however, we can
only redirect all or none. In the meantime, bits/stdio-ieee128.h
allows us to redirect part of them for testing purposes. */
---
libio/stdio.h | 13 ++++++++
sysdeps/ieee754/ldbl-128ibm-compat/Makefile | 9 +++++
.../ldbl-128ibm-compat/bits/stdio-ieee128.h | 38 ++++++++++++++++++++++
sysdeps/powerpc/powerpc64/le/Implies-before | 1 +
.../sysv/linux/powerpc/powerpc64/libc-le.abilist | 1 +
5 files changed, 62 insertions(+)
create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/bits/stdio-ieee128.h
diff --git a/libio/stdio.h b/libio/stdio.h
index 731f8e56f4..002f2ef33b 100644
--- a/libio/stdio.h
+++ b/libio/stdio.h
@@ -864,6 +864,19 @@ extern int __overflow (FILE *, int);
# include <bits/stdio-ldbl.h>
#endif
+/* XXX: DO NOT COMMIT.
+
+ On powerpc64le, the implementation of long double with IEEE binary128
+ format is not complete. The redirections of the stdio.h functions
+ are supposed to be implemented in bits/stdio-ldbl.h, however, we can
+ only redirect all or none. In the meantime, bits/stdio-ieee128.h
+ allows us to redirect part of them for testing purposes. */
+#include <bits/floatn.h>
+#if __HAVE_DISTINCT_FLOAT128 && __LDBL_MANT_DIG__ == 113 && \
+ ! defined __BUILDING_EXTRA_LDBL_FORMAT
+# include <bits/stdio-ieee128.h>
+#endif
+
__END_DECLS
#endif /* <stdio.h> included. */
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/Makefile b/sysdeps/ieee754/ldbl-128ibm-compat/Makefile
index 87c3241622..ad82b42585 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/Makefile
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/Makefile
@@ -31,4 +31,13 @@ $(objpfx)test-printf-ibm128.out: \
$(objpfx)test-printf-ibm128
$(SHELL) $^ '$(test-program-prefix)' $@; \
$(evaluate-test)
+
+# XXX: DO NOT COMMIT.
+#
+# On powerpc64le, the implementation of long double with IEEE binary128
+# format is not complete. The redirections of the stdio.h functions
+# are supposed to be implemented in bits/stdio-ldbl.h, however, we can
+# only redirect all or none. In the meantime, bits/stdio-ieee128.h
+# allows us to redirect part of them for testing purposes. */
+headers += bits/stdio-ieee128.h
endif
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/bits/stdio-ieee128.h b/sysdeps/ieee754/ldbl-128ibm-compat/bits/stdio-ieee128.h
new file mode 100644
index 0000000000..f3fa782a78
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/bits/stdio-ieee128.h
@@ -0,0 +1,38 @@
+/* Redirections for stdio functions for -mabi=ieeelongdouble.
+ 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/>. */
+
+/* XXX: DO NOT COMMIT.
+
+ On powerpc64le, the implementation of long double with IEEE binary128
+ format is not complete. The redirections of the stdio.h functions
+ are supposed to be implemented in bits/stdio-ldbl.h, however, we can
+ only redirect all or none. In the meantime, bits/stdio-ieee128.h
+ allows us to redirect part of them for testing purposes. */
+
+#ifndef _STDIO_H
+# error "Never include <bits/stdio-ibm128.h> directly; use <stdio.h> instead."
+#endif
+
+#include <stdio.h>
+
+#define __IBM128_REDIR(name) \
+ extern __typeof (name) __ieee128_##name; \
+ extern __typeof (name) name __asm (__ASMNAME ("__ieee128_" #name));
+
+__IBM128_REDIR (vfprintf)
+/* To be completed with the other functions. */
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/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist
index 9869feb56b..d8e028ed13 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist
@@ -2221,3 +2221,4 @@ GLIBC_2.27 wcstof64 F
GLIBC_2.27 wcstof64_l F
GLIBC_2.27 wcstof64x F
GLIBC_2.27 wcstof64x_l F
+GLIBC_2.28 __ieee128_vfprintf F
--
2.14.4