aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libgcc/ChangeLog.meissner12
-rw-r--r--libgcc/config.host3
-rw-r--r--libgcc/config/rs6000/float128-decimal.c78
-rw-r--r--libgcc/config/rs6000/float128-decimal.ver7
-rw-r--r--libgcc/config/rs6000/t-float128-decimal7
-rwxr-xr-xlibgcc/configure108
-rw-r--r--libgcc/configure.ac46
7 files changed, 259 insertions, 2 deletions
diff --git a/libgcc/ChangeLog.meissner b/libgcc/ChangeLog.meissner
index b76e585..2b8512e 100644
--- a/libgcc/ChangeLog.meissner
+++ b/libgcc/ChangeLog.meissner
@@ -1,5 +1,17 @@
2020-05-05 Michael Meissner <meissner@linux.ibm.com>
+ (ieee128-lib-patch010b)
+ * config.host (powerpc*-*-linux): Add support if glibc does not
+ provide the appropriate IEEE 128-bit conversions to/from Decimal.
+ * config/rs6000/float128-decimal.c: New file.
+ * config/rs6000/float128-decimal.ver: New file.
+ * config/rs6000/t-float128-decimal: New file.
+ * configure.ac (powerpc*-*-linux): Add support if glibc does not
+ provide the appropriate IEEE 128-bit conversions to/from Decimal.
+ * configure: Regenerate.
+
+2020-05-05 Michael Meissner <meissner@linux.ibm.com>
+
(ieee128-lib-patch003b)
PR target/94630
* config/rs6000/t-float128 (ibm-ldouble$(objext)): Add the
diff --git a/libgcc/config.host b/libgcc/config.host
index 1ff4159..7b48a3d 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -1220,6 +1220,9 @@ powerpc*-*-linux*)
if test $libgcc_cv_powerpc_float128 = yes; then
tmake_file="${tmake_file} rs6000/t-float128"
+ if test $libgcc_cv_powerpc_float128_dec = no; then
+ tmake_file="${tmake_file} rs6000/t-float128-decimal"
+ fi
fi
if test $libgcc_cv_powerpc_float128_hw = yes; then
diff --git a/libgcc/config/rs6000/float128-decimal.c b/libgcc/config/rs6000/float128-decimal.c
index e69de29..31af26b 100644
--- a/libgcc/config/rs6000/float128-decimal.c
+++ b/libgcc/config/rs6000/float128-decimal.c
@@ -0,0 +1,78 @@
+/* Provide missing conversions between IEEE 128-bit floating point and Decimal
+ floating point for PowerPC.
+
+ Copyright (C) 2020 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Michael Meissner (meissner@linux.ibm.com)
+
+ 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.
+
+ In addition to the permissions in the GNU Lesser General Public
+ License, the Free Software Foundation gives you unlimited
+ permission to link the compiled version of this file into
+ combinations with other programs, and to distribute those
+ combinations without any restriction coming from the use of this
+ file. (The Lesser General Public License restrictions do apply in
+ other respects; for example, they cover modification of the file,
+ and distribution when not linked into a combine executable.)
+
+ 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/>. */
+
+extern __float128 __dpd_trunctdkf (_Decimal128);
+extern __float128 __dpd_truncddkf (_Decimal64);
+extern __float128 __dpd_truncsdkf (_Decimal64);
+extern _Decimal128 __dpd_extendkftd (__float128);
+extern _Decimal64 __dpd_trunckfdd (__float128);
+extern _Decimal32 __dpd_trunckfsd (__float128);
+
+__float128
+__dpd_trunctdkf (_Decimal128 x)
+{
+ __ibm128 ibm = (__ibm128) x;
+ return (__float128) ibm;
+}
+
+__float128
+__dpd_truncddkf (_Decimal64 x)
+{
+ __ibm128 ibm = (__ibm128) x;
+ return (__float128) ibm;
+}
+
+__float128
+__dpd_truncsdkf (_Decimal64 x)
+{
+ __ibm128 ibm = (__ibm128) x;
+ return (__float128) ibm;
+}
+
+_Decimal128
+__dpd_extendkftd (__float128 x)
+{
+ __ibm128 ibm = (__ibm128) x;
+ return (_Decimal128) ibm;
+}
+
+_Decimal64
+__dpd_trunckfdd (__float128 x)
+{
+ __ibm128 ibm = (__ibm128) x;
+ return (_Decimal64) ibm;
+}
+
+_Decimal32
+__dpd_trunckfsd (__float128 x)
+{
+ __ibm128 ibm = (__ibm128) x;
+ return (_Decimal32) ibm;
+}
diff --git a/libgcc/config/rs6000/float128-decimal.ver b/libgcc/config/rs6000/float128-decimal.ver
index e69de29..08c15e2 100644
--- a/libgcc/config/rs6000/float128-decimal.ver
+++ b/libgcc/config/rs6000/float128-decimal.ver
@@ -0,0 +1,7 @@
+GCC_10.0.0 {
+ # float128 <-> decimal conversions
+ __dpd_extendkftd
+ __dpd_trunckfdd
+ __dpd_trunckfsd
+ __dpd_trunctdkf
+}
diff --git a/libgcc/config/rs6000/t-float128-decimal b/libgcc/config/rs6000/t-float128-decimal
index e69de29..2854c51 100644
--- a/libgcc/config/rs6000/t-float128-decimal
+++ b/libgcc/config/rs6000/t-float128-decimal
@@ -0,0 +1,7 @@
+# Add support for doing conversions between IEEE 128-bit floating point and
+# Decimal types if glibc does not provide the necessary functions.
+
+LIB2ADD += $(srcdir)/config/rs6000/float128-decimal.c
+SHLIB_MAPFILES += $(srcdir)/config/rs6000/float128-decimal.ver
+
+float128-decimal$(objext) : INTERNAL_CFLAGS += -mno-gnu-attribute
diff --git a/libgcc/configure b/libgcc/configure
index 26bf757..943086e 100755
--- a/libgcc/configure
+++ b/libgcc/configure
@@ -1801,6 +1801,52 @@ $as_echo "$ac_res" >&6; }
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_header_preproc
+
+# ac_fn_c_try_link LINENO
+# -----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_link ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ rm -f conftest.$ac_objext conftest$ac_exeext
+ if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ test -x conftest$ac_exeext
+ }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+ # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+ # interfere with the next link command; also delete a directory that is
+ # left behind by Apple's compiler. We do this before executing the actions.
+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_link
cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
@@ -5201,7 +5247,9 @@ case ${host} in
# At present, we cannot turn -mfloat128 on via #pragma GCC target, so just
# check if we have VSX (ISA 2.06) support to build the software libraries, and
# whether the assembler can handle xsaddqp for hardware support. Also check if
-# a new glibc is being used so that __builtin_cpu_supports can be used.
+# a new glibc is being used so that __builtin_cpu_supports can be used. Check
+# to see if glibc provides the necessary decimal <-> IEEE 128 function, and
+# arrange to build our own version if they are not provided.
powerpc*-*-linux*)
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -mabi=altivec -mvsx -mfloat128"
@@ -5258,6 +5306,64 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgcc_cv_powerpc_float128_hw" >&5
$as_echo "$libgcc_cv_powerpc_float128_hw" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PowerPC convert __float128 to/from _Decimal libraries" >&5
+$as_echo_n "checking for PowerPC convert __float128 to/from _Decimal libraries... " >&6; }
+if ${libgcc_cv_powerpc_float128_dec+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test x$gcc_no_link = xyes; then
+ as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
+fi
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+ __attribute__((noinline)) __float128 f128_from_d128 (_Decimal128 d128)
+ {
+ return (__float128)d128;
+ }
+ __attribute__((noinline)) __float128 f128_from_d64 (_Decimal128 d64)
+ {
+ return (__float128)d64;
+ }
+ __attribute__((noinline)) __float128 f128_from_d32 (_Decimal128 d32)
+ {
+ return (__float128)d32;
+ }
+ __attribute__((noinline)) _Decimal128 d128_from_f128 (__float128 f128)
+ {
+ return (_Decimal128)f128;
+ }
+ __attribute__((noinline)) _Decimal64 d64_from_f128 (__float128 f128)
+ {
+ return (_Decimal64)f128;
+ }
+ __attribute__((noinline)) _Decimal32 d32_from_f128 (__float128 f128)
+ {
+ return (_Decimal32)f128;
+ }
+ int main (void)
+ {
+ __float128 five = 5.0;
+ if (f128_from_d128 (5.0dl) != five
+ || f128_from_d64 (5.0dd) != five
+ || f128_from_d32 (5.0df) != five
+ || d128_from_f128 (five) != 5.0dl
+ || d64_from_f128 (five) != 5.0dd
+ || d32_from_f128 (five) != 5.0df)
+ abort ();
+ return 0;
+ }
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ libgcc_cv_powerpc_float128_dec=yes
+else
+ libgcc_cv_powerpc_float128_dec=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgcc_cv_powerpc_float128_dec" >&5
+$as_echo "$libgcc_cv_powerpc_float128_dec" >&6; }
CFLAGS="$saved_CFLAGS"
esac
diff --git a/libgcc/configure.ac b/libgcc/configure.ac
index bff6e54..4aa03a4 100644
--- a/libgcc/configure.ac
+++ b/libgcc/configure.ac
@@ -424,7 +424,9 @@ case ${host} in
# At present, we cannot turn -mfloat128 on via #pragma GCC target, so just
# check if we have VSX (ISA 2.06) support to build the software libraries, and
# whether the assembler can handle xsaddqp for hardware support. Also check if
-# a new glibc is being used so that __builtin_cpu_supports can be used.
+# a new glibc is being used so that __builtin_cpu_supports can be used. Check
+# to see if glibc provides the necessary decimal <-> IEEE 128 function, and
+# arrange to build our own version if they are not provided.
powerpc*-*-linux*)
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -mabi=altivec -mvsx -mfloat128"
@@ -457,6 +459,48 @@ powerpc*-*-linux*)
__attribute__ ((__ifunc__ ("add_resolver")));])],
[libgcc_cv_powerpc_float128_hw=yes],
[libgcc_cv_powerpc_float128_hw=no])])
+ AC_CACHE_CHECK([for PowerPC convert __float128 to/from _Decimal libraries],
+ [libgcc_cv_powerpc_float128_dec],
+ [AC_LINK_IFELSE(
+ [AC_LANG_SOURCE([#include <stdlib.h>
+ __attribute__((noinline)) __float128 f128_from_d128 (_Decimal128 d128)
+ {
+ return (__float128)d128;
+ }
+ __attribute__((noinline)) __float128 f128_from_d64 (_Decimal128 d64)
+ {
+ return (__float128)d64;
+ }
+ __attribute__((noinline)) __float128 f128_from_d32 (_Decimal128 d32)
+ {
+ return (__float128)d32;
+ }
+ __attribute__((noinline)) _Decimal128 d128_from_f128 (__float128 f128)
+ {
+ return (_Decimal128)f128;
+ }
+ __attribute__((noinline)) _Decimal64 d64_from_f128 (__float128 f128)
+ {
+ return (_Decimal64)f128;
+ }
+ __attribute__((noinline)) _Decimal32 d32_from_f128 (__float128 f128)
+ {
+ return (_Decimal32)f128;
+ }
+ int main (void)
+ {
+ __float128 five = 5.0;
+ if (f128_from_d128 (5.0dl) != five
+ || f128_from_d64 (5.0dd) != five
+ || f128_from_d32 (5.0df) != five
+ || d128_from_f128 (five) != 5.0dl
+ || d64_from_f128 (five) != 5.0dd
+ || d32_from_f128 (five) != 5.0df)
+ abort ();
+ return 0;
+ }])],
+ [libgcc_cv_powerpc_float128_dec=yes],
+ [libgcc_cv_powerpc_float128_dec=no])])
CFLAGS="$saved_CFLAGS"
esac