Assuming the 17 sub-patches within patch #7 are approved, this patch adds the necessary bits to libgcc to build the __float128 emulation functions.
Originally, it was thought that since it uses the TFmode emulation functions from the libgcc/soft-fp directory, that we would need to submit the patches through glibc where the master source lives. However, since we don't do any modification of the soft-fp sources, but do it all through support in the libgcc/config/rs6000 directory, I'm submitting this patch to libgcc. This patch passes bootstrap and regression testing on a little endian power8 system (previous versions of the patch also were tested on a big endian power7 system). Once the patch #7 sub-patches are checked in, is this patch appropriate to be checked in? 2015-10-27 Michael Meissner <meiss...@linux.vnet.ibm.com> * Makefile.in (EXTRA_CLEAN): New variable of additional files to clean. (FLAGS_TO_PASS): Add EXTRA_CLEAN. (clean): Delete EXTRA_CLEAN files. * configure.ac (powerpc*-*-linux*): If the compiler is capable of generating __float128 code, build the __float128 emulation libraries. * configure: Regenerate. * config/rs6000/extendkftf2.c: New files for IEEE 128-bit floating point support. * config/rs6000/cmpukf2.c: Likewise. * config/rs6000/trunctfk2.c: Likewise. * config/rs6000/quad-float128.h: Likewise. * config/rs6000/t-float128: Likewise. * config/rs6000/float128-sed: Likewise. * config/rs6000/sfp-machine.h (_FP_W_TYPE_SIZE): Update defintiions to use 64-bit types for 64-bit systems or 32-bit VSX systems with IEEE 128-bit floating point support. (_FP_W_TYPE): Likewise. (_FP_WS_TYPE): Likewise. (_FP_I_TYPE): Likewise. (TItype): Add defintions for IEEE 128-bit floating point support. (UTItype): Likewise. (TI_BITS): Likewise. (_FP_MUL_MEAT_Q): Use 64-bit types on 64-bit systems and for 32-bit VSX systems with IEEE 128-bit floating point. (_FP_DIV_MEAT_Q): Likewise. (_FP_NANFRAC_Q): Likewise. * config/rs6000/libgcc-glibc.ver: Add requires for GCC 6.0 adding IEEE 128-bit floating point support. -- Michael Meissner, IBM IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA email: meiss...@linux.vnet.ibm.com, phone: +1 (978) 899-4797
Index: libgcc/config.host =================================================================== --- libgcc/config.host (revision 229390) +++ libgcc/config.host (working copy) @@ -1058,6 +1058,11 @@ powerpc*-*-linux*) exit 1 ;; esac + + if test $libgcc_cv_powerpc_float128 = yes; then + tmake_file="${tmake_file} rs6000/t-float128" + fi + extra_parts="$extra_parts ecrti.o ecrtn.o ncrti.o ncrtn.o" md_unwind_header=rs6000/linux-unwind.h ;; Index: libgcc/Makefile.in =================================================================== --- libgcc/Makefile.in (revision 229390) +++ libgcc/Makefile.in (working copy) @@ -70,6 +70,8 @@ INSTALL_DATA = @INSTALL_DATA@ mkinstalldirs = $(SHELL) $(libgcc_topdir)/mkinstalldirs INSTALL_PARTS = $(EXTRA_PARTS) +EXTRA_CLEAN = + objext = .o AR = @AR@ @@ -90,6 +92,7 @@ FLAGS_TO_PASS = \ "CFLAGS=$(CFLAGS)" \ "DESTDIR=$(DESTDIR)" \ "EXTRA_OFILES=$(EXTRA_OFILES)" \ + "EXTRA_CLEAN=$(EXTRA_CLEAN)" \ "HDEFINES=$(HDEFINES)" \ "INSTALL=$(INSTALL)" \ "INSTALL_DATA=$(INSTALL_DATA)" \ @@ -128,7 +131,7 @@ installcheck: clean: -rm -f libgcc_tm.h libgcc.map -rm -f libgcc_tm.stamp stmp-ldirs - -rm -f *$(objext) + -rm -f *$(objext) $(EXTRA_CLEAN) -rm -f *.dep -rm -f *.a -rm -f libunwind$(SHLIB_EXT) Index: libgcc/configure.ac =================================================================== --- libgcc/configure.ac (revision 229390) +++ libgcc/configure.ac (working copy) @@ -373,6 +373,17 @@ esac ;; esac +case ${host} in +powerpc*-*-linux*) + AC_CACHE_CHECK([whether the PowerPC compiler can do __float128], + [libgcc_cv_powerpc_float128], + [AC_COMPILE_IFELSE( + [#pragma GCC target ("vsx,float128") + __float128 add (__float128 *a) { return *a + *(a+1); }], + [libgcc_cv_powerpc_float128=yes], + [libgcc_cv_powerpc_float128=no])]) +esac + # Collect host-machine-specific information. . ${srcdir}/config.host Index: libgcc/config/rs6000/extendkftf2.c =================================================================== --- libgcc/config/rs6000/extendkftf2.c (revision 0) +++ libgcc/config/rs6000/extendkftf2.c (revision 0) @@ -0,0 +1,59 @@ +/* Software IEEE 128-bit floating-point emulation for PowerPC. + Copyright (C) 2014 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Michael Meissner (meiss...@linux.vnet.ibm.com) + Code is based on the main soft-fp library written by: + Richard Henderson (r...@cygnus.com) and + Jakub Jelinek (j...@ultra.linux.cz). + + 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/>. */ + +/* Convert IEEE 128-bit floating point to IBM long double. */ + +/* Force the use of the VSX instruction set. */ +#if defined(_ARCH_PPC) && (!defined(__VSX__) || !defined(__FLOAT128__)) +#pragma GCC target ("vsx,float128") +#endif + +extern __ibm128 __extendkftf2 (__float128); + +__ibm128 +__extendkftf2 (__float128 value) +{ + double high, low; + + high = (double) value; + if (__builtin_isnan (high) || __builtin_isinf (high)) + low = high; + + else + { + low = (double) (value - (__float128)high); + + /* Use copysign to propigate the sign bit so that -0.0Q becomes -0.0L. */ + low = __builtin_copysign (low, high); + } + + return __builtin_pack_longdouble (high, low); +} Index: libgcc/config/rs6000/sfp-machine.h =================================================================== --- libgcc/config/rs6000/sfp-machine.h (revision 229390) +++ libgcc/config/rs6000/sfp-machine.h (working copy) @@ -1,7 +1,26 @@ +/* Decide whether to use 64 or 32-bit types to do the emulation. If we are + doing IEEE-128 with VSX, use 64-bit emulation even if we are compiling for a + 32-bit target. */ + +#if defined(_ARCH_PPC64) || defined(__VSX__) || defined(__FLOAT128__) +#define _FP_W_TYPE_SIZE 64 +#define _FP_W_TYPE unsigned long long +#define _FP_WS_TYPE signed long long +#define _FP_I_TYPE long long + +#ifdef _ARCH_PPC64 +typedef int TItype __attribute__ ((mode (TI))); +typedef unsigned int UTItype __attribute__ ((mode (TI))); + +#define TI_BITS (__CHAR_BIT__ * (int)sizeof(TItype)) +#endif + +#else /* 32-bits */ #define _FP_W_TYPE_SIZE 32 -#define _FP_W_TYPE unsigned long -#define _FP_WS_TYPE signed long -#define _FP_I_TYPE long +#define _FP_W_TYPE unsigned int +#define _FP_WS_TYPE signed int +#define _FP_I_TYPE int +#endif /* 32-bits */ /* The type of the result of a floating point comparison. This must match `__libgcc_cmp_return__' in GCC for the target. */ @@ -12,16 +31,34 @@ typedef int __gcc_CMPtype __attribute__ _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm) #define _FP_MUL_MEAT_D(R,X,Y) \ _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm) + +#if (_FP_W_TYPE_SIZE==64) +#define _FP_MUL_MEAT_Q(R,X,Y) \ + _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm) + +#else #define _FP_MUL_MEAT_Q(R,X,Y) \ _FP_MUL_MEAT_4_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm) +#endif #define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_loop(S,R,X,Y) #define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv(D,R,X,Y) + +#if (_FP_W_TYPE_SIZE==64) +#define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_2_udiv(Q,R,X,Y) +#else #define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_4_udiv(Q,R,X,Y) +#endif #define _FP_NANFRAC_S ((_FP_QNANBIT_S << 1) - 1) #define _FP_NANFRAC_D ((_FP_QNANBIT_D << 1) - 1), -1 + +#if (_FP_W_TYPE_SIZE==64) +#define _FP_NANFRAC_Q ((_FP_QNANBIT_Q << 1) - 1), -1 +#else #define _FP_NANFRAC_Q ((_FP_QNANBIT_Q << 1) - 1), -1, -1, -1 +#endif + #define _FP_NANSIGN_S 0 #define _FP_NANSIGN_D 0 #define _FP_NANSIGN_Q 0 Index: libgcc/config/rs6000/cmpukf2.c =================================================================== --- libgcc/config/rs6000/cmpukf2.c (revision 0) +++ libgcc/config/rs6000/cmpukf2.c (revision 0) @@ -0,0 +1,87 @@ +/* Software IEEE 128-bit floating-point emulation for PowerPC. + Copyright (C) 2015 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Michael Meissner (meiss...@linux.vnet.ibm.com) + Code is based on the main soft-fp library written by: + Richard Henderson (r...@cygnus.com) and + Jakub Jelinek (j...@ultra.linux.cz). + + 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/>. */ + +/* Force the use of the VSX instruction set. */ +#if defined(_ARCH_PPC) && (!defined(__VSX__) || !defined(__FLOAT128__)) +#pragma GCC target ("vsx,float128") +#endif + +#include "soft-fp.h" +#include "double.h" +#include "single.h" +#include "quad-float128.h" + +/* PowerPC condition register bits. */ +#define PPC_UNORDERED 0x1 /* isnan (a) || isnan (b). */ +#define PPC_EQUAL 0x2 /* a == b. */ +#define PPC_GREATER_THEN 0x4 /* a > b. */ +#define PPC_LESS_THEN 0x8 /* a < b. */ + +/* Map FP_CMP_Q output to PowerPC condition register bits. */ +#define CMP_UNORDERED (-2) /* isnan (a) || isnan (b). */ +#define CMP_LESS_THEN (-1) /* a < b. */ +#define CMP_EQUAL 0 /* a == b. */ +#define CMP_GREATER_THEN 1 /* a < b. */ +#define CMP_INVALID 2 /* raise invalid exception. */ + +#define CMP_LOW CMP_UNORDERED /* comparison low value. */ +#define CMP_HIGH CMP_INVALID /* comparison high value. */ + +static const unsigned char ppc_cr_map[] = { + PPC_UNORDERED, /* -2: unordered. */ + PPC_LESS_THEN, /* -1: a < b. */ + PPC_EQUAL, /* 0: a == b. */ + PPC_GREATER_THEN, /* 1: a > b. */ + PPC_UNORDERED, /* 2: invalid. */ +}; + +/* Compare two IEEE 128-bit floating point values and return the status. We + return the status as a 4-bit value that can be copied into an appropriate + PowerPC conditon code register. */ + +CMPtype +__cmpukf2 (TFtype a, TFtype b) +{ + FP_DECL_EX; + FP_DECL_Q (A); + FP_DECL_Q (B); + CMPtype r; + + FP_INIT_EXCEPTIONS; + FP_UNPACK_RAW_Q (A, a); + FP_UNPACK_RAW_Q (B, b); + FP_CMP_Q (r, A, B, 2, 2); + if (r == CMP_INVALID) + FP_SET_EXCEPTION (FP_EX_INVALID); + FP_HANDLE_EXCEPTIONS; + + return (r < CMP_LOW || r > CMP_HIGH) ? PPC_UNORDERED : ppc_cr_map[r-CMP_LOW]; +} Index: libgcc/config/rs6000/trunctfk2.c =================================================================== --- libgcc/config/rs6000/trunctfk2.c (revision 0) +++ libgcc/config/rs6000/trunctfk2.c (revision 0) @@ -0,0 +1,65 @@ +/* Software IEEE 128-bit floating-point emulation for PowerPC. + Copyright (C) 2014 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Michael Meissner (meiss...@linux.vnet.ibm.com) + Code is based on the main soft-fp library written by: + Richard Henderson (r...@cygnus.com) and + Jakub Jelinek (j...@ultra.linux.cz). + + 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/>. */ + +/* Convert IBM long double to IEEE 128-bit floating point. */ + +/* Force the use of the VSX instruction set. */ +#if defined(_ARCH_PPC) && (!defined(__VSX__) || !defined(__FLOAT128__)) +#pragma GCC target ("vsx,float128") +#endif + +extern __float128 __trunctfkf2 (__ibm128); + +#ifdef __LITTLE_ENDIAN__ +#define HIGH_WORD 1 +#define LOW_WORD 0 +#else +#define HIGH_WORD 0 +#define LOW_WORD 1 +#endif + +__float128 +__trunctfkf2 (__ibm128 value) +{ + double high = __builtin_unpack_longdouble (value, HIGH_WORD); + double low = __builtin_unpack_longdouble (value, LOW_WORD); + + /* Handle the special cases of NAN and inifinity. */ + if (__builtin_isnan (high) || __builtin_isinf (high)) + return (__float128) high; + + /* If low is 0.0, there no need to do the add. In addition, avoiding the add + produces the correct sign if high is -0.0. */ + if (low == 0.0) + return (__float128) high; + + return ((__float128)high) + ((__float128)low); +} Index: libgcc/config/rs6000/quad-float128.h =================================================================== --- libgcc/config/rs6000/quad-float128.h (revision 0) +++ libgcc/config/rs6000/quad-float128.h (revision 0) @@ -0,0 +1,72 @@ +/* Software floating-point emulation. + Definitions for IEEE Quad Precision on the PowerPC. + Copyright (C) 2015 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Michael Meissner (meiss...@linux.vnet.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/>. */ + +/* quad.h defines the TFtype type by: + typedef float TFtype __attribute__ ((mode (TF))); + + This define forces it to use KFmode (aka, ieee 128-bit floating point). */ +#define TF KF + +/* Force the use of the VSX instruction set. */ +#if defined(_ARCH_PPC) && (!defined(__VSX__) || !defined(__FLOAT128__)) +#pragma GCC target ("vsx,float128") +#endif + +#include <quad.h> + +/* Add prototypes of the library functions created. In case the appropriate + int/long types are not declared in scope by the time quad.h is included, + provide our own version. */ +typedef int SItype_ppc __attribute__ ((__mode__ (__SI__))); +typedef int DItype_ppc __attribute__ ((__mode__ (__DI__))); +typedef unsigned USItype_ppc __attribute__ ((__mode__ (__SI__))); +typedef unsigned UDItype_ppc __attribute__ ((__mode__ (__DI__))); + +TFtype __addkf3 (TFtype, TFtype); +TFtype __subkf3 (TFtype, TFtype); +TFtype __mulkf3 (TFtype, TFtype); +TFtype __divkf3 (TFtype, TFtype); +TFtype __negkf2 (TFtype); +CMPtype __cmpukf2 (TFtype, TFtype); +CMPtype __eqkf2 (TFtype, TFtype); +CMPtype __gekf2 (TFtype, TFtype); +CMPtype __lekf2 (TFtype, TFtype); +CMPtype __unordkf2 (TFtype, TFtype); +TFtype __extendsfkf2 (float); +TFtype __extenddfkf2 (double); +float __trunckfsf2 (TFtype); +double __trunckfdf2 (TFtype); +SItype_ppc __fixkfsi (TFtype); +DItype_ppc __fixkfdi (TFtype); +USItype_ppc __fixunskfsi (TFtype); +UDItype_ppc __fixunskfdi (TFtype); +TFtype __floatsikf (SItype_ppc); +TFtype __floatdikf (DItype_ppc); +TFtype __floatunsikf (USItype_ppc); +TFtype __floatundikf (UDItype_ppc); Index: libgcc/config/rs6000/libgcc-glibc.ver =================================================================== --- libgcc/config/rs6000/libgcc-glibc.ver (revision 229390) +++ libgcc/config/rs6000/libgcc-glibc.ver (working copy) @@ -71,3 +71,81 @@ GCC_4.2.0 { __gcc_qunord %endif } + + +# IEEE 128-bit support (__float128) was introduced with GCC 6.0. + +%exclude { + __addkf3 + __cmpukf2 + __divkf3 + __eqkf2 + __extenddfkf2 + __extendkftf2 + __extendsfkf2 + __fixkfdi + __fixkfsi + __fixkfti + __fixunskfdi + __fixunskfsi + __fixunskfti + __floattikf + __floatuntikf + __gekf2 + __gtkf2 + __lekf2 + __ltkf2 + __mulkf3 + __negkf3 + __nekf2 + __orderedkf2 + __sqrtkf3 + __subkf3 + __trunckfdf2 + __trunckfsf2 + __trunctfkf2 + __uneqkf2 + __ungekf2 + __ungtkf2 + __unlekf2 + __unltkf2 + __unordkf2 +} + +GCC_6.0.0 { + __addkf3 + __cmpukf2 + __divkf3 + __eqkf2 + __extenddfkf2 + __extendkftf2 + __extendsfkf2 + __fixkfdi + __fixkfsi + __fixkfti + __fixunskfdi + __fixunskfsi + __fixunskfti + __floattikf + __floatuntikf + __gekf2 + __gtkf2 + __lekf2 + __ltkf2 + __mulkf3 + __negkf3 + __nekf2 + __orderedkf2 + __sqrtkf3 + __subkf3 + __trunckfdf2 + __trunckfsf2 + __trunctfkf2 + __uneqkf2 + __ungekf2 + __ungtkf2 + __unlekf2 + __unltkf2 + __unordkf2 +} + Index: libgcc/config/rs6000/t-float128 =================================================================== --- libgcc/config/rs6000/t-float128 (revision 0) +++ libgcc/config/rs6000/t-float128 (revision 0) @@ -0,0 +1,77 @@ +# Support for adding __float128 to the powerpc. + +# The standard 128-bit floating point support functions are TFmode. Most +# PowerPC targets use a long double format that has a pair of doubles to give +# you more precision, but no extra expoenent range. This long double format is +# mostly compatible with the format used by the IBM XL compilers. Some of the +# names used by the IBM double-double format use TF in them, so we rename +# all of the functions provided for the new IEEE 128-bit support. +# +# We use the TF functions in soft-fp for 128-bit floating point support, using +# sed to transform the names in the files from TF names to KF names. + +# Emulator functions from the soft-fp directory +fp128_softfp_funcs = addkf3 subkf3 mulkf3 divkf3 \ + negkf2 eqkf2 gekf2 lekf2 unordkf2 \ + extendsfkf2 extenddfkf2 trunckfsf2 trunckfdf2 \ + fixkfsi fixkfdi fixunskfsi fixunskfdi \ + floatsikf floatdikf floatunsikf floatundikf + +fp128_softfp_src = $(addsuffix .c,$(fp128_softfp_funcs)) +fp128_softfp_static_obj = $(addsuffix $(objext),$(fp128_softfp_funcs)) +fp128_softfp_shared_obj = $(addsuffix _s$(objext),$(fp128_softfp_funcs)) +fp128_softfp_obj = $(fp128_softfp_static_obj) $(fp128_softfp_shared_obj) + +# New functions +fp128_ppc_funcs = cmpukf2 extendkftf2 trunctfk2 +fp128_ppc_src = $(addprefix $(srcdir)/config/rs6000/,$(addsuffix .c,$(fp128_ppc_funcs))) +fp128_ppc_static_obj = $(addsuffix $(objext),$(fp128_ppc_funcs)) +fp128_ppc_shared_obj = $(addsuffix _s$(objext),$(fp128_ppc_funcs)) +fp128_ppc_obj = $(fp128_ppc_static_obj) $(fp128_ppc_shared_obj) + +# All functions +fp128_funcs = $(fp128_softfp_funcs) $(fp128_ppc_funcs) +fp128_src = $(fp128_softfp_src) $(fp128_ppc_src) +fp128_obj = $(fp128_softfp_obj) $(fp128_ppc_obj) +fp128_sed = $(srcdir)/config/rs6000/float128-sed +fp128_dep = $(fp128_sed) $(srcdir)/config/rs6000/t-float128 + +fp128_includes = $(srcdir)/soft-fp/double.h \ + $(srcdir)/soft-fp/op-1.h \ + $(srcdir)/soft-fp/op-4.h \ + $(srcdir)/soft-fp/op-common.h \ + $(srcdir)/soft-fp/single.h \ + $(srcdir)/soft-fp/extended.h \ + $(srcdir)/soft-fp/op-2.h \ + $(srcdir)/soft-fp/op-8.h \ + $(srcdir)/soft-fp/quad.h \ + $(srcdir)/soft-fp/soft-fp.h + +EXTRA_CLEAN += $(fp128_softfp_src) + +FP128_CFLAGS = -Wno-type-limits -mvsx -mfloat128 \ + -I$(srcdir)/soft-fp \ + -I$(srcdir)/config/rs6000 + +$(fp128_obj) : INTERNAL_CFLAGS += $(FP128_CFLAGS) +$(fp128_obj) : $(fp128_includes) +$(fp128_obj) : $(srcdir)/config/rs6000/quad-float128.h + +$(fp128_softfp_src) : $(srcdir)/soft-fp/$(subst kf,tf,$@) $(fp128_dep) + @src="$(srcdir)/soft-fp/$(subst kf,tf,$@)"; \ + echo "Create $@"; \ + (echo "/* file created from $$src */"; \ + echo; \ + sed -f $(fp128_sed) < $$src) > $@ + +test: + @echo "fp128_src:"; \ + for x in $(fp128_src); do echo " $$x"; done; \ + echo; \ + echo "fp128_obj:"; \ + for x in $(fp128_obj); do echo " $$x"; done; + +# For now, only put it in the static library +# LIB2ADD += $(fp128_src) + +LIB2ADD_ST += $(fp128_src) Index: libgcc/config/rs6000/float128-sed =================================================================== --- libgcc/config/rs6000/float128-sed (revision 0) +++ libgcc/config/rs6000/float128-sed (revision 0) @@ -0,0 +1,25 @@ +s/__addtf3/__addkf3/g +s/__divtf3/__divkf3/g +s/__eqtf2/__eqkf2/g +s/__extenddftf2/__extenddfkf2/g +s/__extendsftf2/__extendsfkf2/g +s/__fixtfdi/__fixkfdi/g +s/__fixtfsi/__fixkfsi/g +s/__fixunstfdi/__fixunskfdi/g +s/__fixunstfsi/__fixunskfsi/g +s/__floatditf/__floatdikf/g +s/__floatsitf/__floatsikf/g +s/__floatunditf/__floatundikf/g +s/__floatunsitf/__floatunsikf/g +s/__getf2/__gekf2/g +s/__gttf2/__gtkf2/g +s/__letf2/__lekf2/g +s/__lttf2/__ltkf2/g +s/__multf3/__mulkf3/g +s/__negtf2/__negkf2/g +s/__netf2/__nekf2/g +s/quad[.]h/quad-float128.h/g +s/__subtf3/__subkf3/g +s/__trunctfdf2/__trunckfdf2/g +s/__trunctfsf2/__trunckfsf2/g +s/__unordtf2/__unordkf2/g Index: libgcc/configure =================================================================== --- libgcc/configure (revision 229390) +++ libgcc/configure (working copy) @@ -4766,6 +4766,29 @@ esac ;; esac +case ${host} in +powerpc*-*-linux*) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the PowerPC compiler can do __float128" >&5 +$as_echo_n "checking whether the PowerPC compiler can do __float128... " >&6; } +if test "${libgcc_cv_powerpc_float128+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#pragma GCC target ("vsx,float128") + __float128 add (__float128 *a) { return *a + *(a+1); } +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + libgcc_cv_powerpc_float128=yes +else + libgcc_cv_powerpc_float128=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgcc_cv_powerpc_float128" >&5 +$as_echo "$libgcc_cv_powerpc_float128" >&6; } +esac + # Collect host-machine-specific information. . ${srcdir}/config.host