new file mode 100644
@@ -0,0 +1,34 @@
+ifeq ($(subdir),stdio-common)
+# Wrappers for *printf functions that take long double arguments with
+# IEEE binary128 format
+routines += ieee128-vfprintf
+
+# Printing long double values with IEEE binary128 format reuses the part
+# of the internal float128 implementation (__printf_fp, __printf_fphex,
+# and __float128 variables and union members). Thus, the compilation of
+# the following functions, must have -mfloat128 passed to the compiler.
+CFLAGS-vfprintf-internal.c += -mfloat128
+
+# Basic tests for the implementation of long double with IEEE binary128
+# format and for the related redirections in installed headers.
+tests-internal += test-printf-ieee128 test-printf-ibm128
+CFLAGS-test-printf-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
+CFLAGS-test-printf-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
+
+ifeq ($(run-built-tests),yes)
+tests-special += $(objpfx)test-printf-ieee128.out
+tests-special += $(objpfx)test-printf-ibm128.out
+endif
+
+$(objpfx)test-printf-ieee128.out: \
+ ../sysdeps/ieee754/ldbl-128ibm-compat/test-printf-ldbl-compat.sh \
+ $(objpfx)test-printf-ieee128
+ $(SHELL) $^ '$(test-program-prefix)' $@; \
+ $(evaluate-test)
+
+$(objpfx)test-printf-ibm128.out: \
+ ../sysdeps/ieee754/ldbl-128ibm-compat/test-printf-ldbl-compat.sh \
+ $(objpfx)test-printf-ibm128
+ $(SHELL) $^ '$(test-program-prefix)' $@; \
+ $(evaluate-test)
+endif
new file mode 100644
@@ -0,0 +1,10 @@
+%include <ldbl-128ibm-compat-abi.h>
+%ifndef LDBL_IBM128_VERSION
+% error "ldbl-128ibm-compat-abi.h must define LDBL_IBM128_VERSION"
+%endif
+
+libc {
+ LDBL_IBM128_VERSION {
+ __ieee128_vfprintf;
+ }
+}
new file mode 100644
@@ -0,0 +1,25 @@
+/* Wrapper for vfprintf. IEEE128 version.
+ Copyright (C) 1991-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 <libio/libioP.h>
+
+extern int
+__ieee128_vfprintf (FILE *fp, const char *format, va_list ap)
+{
+ return __vfprintf_internal (fp, format, ap, PRINTF_LDBL_USES_FLOAT128);
+}
new file mode 100644
@@ -0,0 +1 @@
+#include <test-printf-ldbl-compat.c>
new file mode 100644
@@ -0,0 +1 @@
+#include <test-printf-ldbl-compat.c>
new file mode 100644
@@ -0,0 +1,51 @@
+/* Test for the long double variants of *printf 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 <stdarg.h>
+#include <stdint.h>
+#include <stdio.h>
+
+#include <support/check.h>
+
+static void
+do_test_call_varg (FILE *stream, const char *format, ...)
+{
+ va_list args;
+
+ printf ("%20s", "vfprintf: ");
+ va_start (args, format);
+ vfprintf (stream, format, args);
+ va_end (args);
+ printf ("\n");
+}
+
+static int
+do_test (void)
+{
+ long double ld = -1;
+
+ /* Print in decimal notation. */
+ do_test_call_varg (stdout, "%.60Lf", ld);
+
+ /* Print in hexadecimal notation. */
+ do_test_call_varg (stdout, "%.60La", ld);
+
+ return 0;
+}
+
+#include <support/test-driver.c>
new file mode 100644
@@ -0,0 +1,42 @@
+#!/bin/sh
+# Testing of *printf. IEEE binary128 for powerpc64le version.
+# 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/>.
+
+set -e
+
+test_program=$1; shift
+test_program_prefix=$1; shift
+test_program_output=$1; shift
+
+status=0
+
+${test_program_prefix} \
+ ${test_program} \
+ > ${test_program_output} || status=1
+
+cat <<'EOF' |
+ vfprintf: -1.000000000000000000000000000000000000000000000000000000000000
+ vfprintf: -0x1.000000000000000000000000000000000000000000000000000000000000p+0
+EOF
+cmp - ${test_program_output} > /dev/null 2>&1 ||
+{
+ status=1
+ echo "*** output comparison failed"
+}
+
+exit $status
new file mode 100644
@@ -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.28
+#define LDBL_IBM128_COMPAT_VERSION GLIBC_2_28