summaryrefslogtreecommitdiff
path: root/libgcc
diff options
context:
space:
mode:
authorrus <rus@138bc75d-0d04-0410-961f-82ee72b054a4>2009-11-09 20:58:24 +0000
committerrus <rus@138bc75d-0d04-0410-961f-82ee72b054a4>2009-11-09 20:58:24 +0000
commit7f4db7c80779ecbc57d1146654daf0acfe18de66 (patch)
tree3af522a3b5e149c3fd498ecb1255994daae2129a /libgcc
parent611349f0ec42a37591db2cd02974a11a48d10edb (diff)
downloadgcc-profile-stdlib.tar.gz
merge from trunkprofile-stdlib
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/profile-stdlib@154052 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgcc')
-rw-r--r--libgcc/ChangeLog45
-rw-r--r--libgcc/config.host7
-rw-r--r--libgcc/config/i386/32/sfp-machine.h5
-rw-r--r--libgcc/config/rx/rx-abi-functions.c90
-rw-r--r--libgcc/config/rx/rx-abi.h235
-rw-r--r--libgcc/config/rx/t-rx44
-rw-r--r--libgcc/config/s390/32/_fixdfdi.c97
-rw-r--r--libgcc/config/s390/32/_fixsfdi.c93
-rw-r--r--libgcc/config/s390/32/_fixtfdi.c102
-rw-r--r--libgcc/config/s390/32/_fixunsdfdi.c94
-rw-r--r--libgcc/config/s390/32/_fixunssfdi.c90
-rw-r--r--libgcc/config/s390/32/_fixunstfdi.c97
-rw-r--r--libgcc/config/s390/32/t-floattodi5
-rw-r--r--libgcc/config/s390/libgcc-glibc.ver116
-rw-r--r--libgcc/config/s390/t-crtstuff6
-rw-r--r--libgcc/config/s390/t-linux7
-rw-r--r--libgcc/config/s390/t-tpf8
17 files changed, 1130 insertions, 11 deletions
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog
index d10d5cc4630..2db5d2901c8 100644
--- a/libgcc/ChangeLog
+++ b/libgcc/ChangeLog
@@ -1,3 +1,34 @@
+2009-10-26 Nick Clifton <nickc@redhat.com>
+
+ * config.host: Add support for RX target.
+ * config/rx: New directory.
+ * config/rx/rx-abi-functions.c: New file. Supplementary
+ functions for libgcc to support the RX ABI.
+ * config/rx/rx-abi.h: New file. Supplementary header file for
+ libgcc RX ABI functions.
+ * config/rx/t-rx: New file: Makefile fragment for building
+ libgcc for the RX.
+
+2009-10-09 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/i386/32/sfp-machine.h (__FP_FRAC_SUB_4): Change operand
+ constraint of y0 to "g".
+
+2009-10-07 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
+
+ * config.host: Include the s390 makefile fragments.
+ * config/s390/32/_fixdfdi.c: New file.
+ * config/s390/32/_fixsfdi.c: New file.
+ * config/s390/32/_fixtfdi.c: New file.
+ * config/s390/32/_fixunsdfdi.c: New file.
+ * config/s390/32/_fixunssfdi.c: New file.
+ * config/s390/32/_fixunstfdi.c: New file.
+ * config/s390/32/t-floattodi: New file.
+ * config/s390/libgcc-glibc.ver: New file.
+ * config/s390/t-crtstuff: New file.
+ * config/s390/t-linux: New file.
+ * config/s390/t-tpf: New file.
+
2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* configure.ac (AC_PREREQ): Bump to 2.64.
@@ -32,7 +63,7 @@
2009-06-22 Kai Tietz <kai.tietz@onevision.com>
* config.host: Add i386/${host_address}/t-fprules-softfp and
- t-softfp to tmake_file for i[34567]86-*-mingw*, x86_64-*-mingw*.
+ t-softfp to tmake_file for i[34567]86-*-mingw*, x86_64-*-mingw*.
* config/i386/64/_divtc3.c: Disable usage of .symver assembly symbol
for mingw targets.
@@ -59,7 +90,7 @@
2009-05-29 David Billinghurst <billingd@gcc.gnu.org>
* config.host: Add i386/${host_address}/t-fprules-softfp and
- t-softfp to tmake_file for i[34567]86-*-cygwin*.
+ t-softfp to tmake_file for i[34567]86-*-cygwin*.
2009-04-17 Aurelien Jarno <aurelien@aurel32.net>
@@ -394,7 +425,7 @@
* config.host: Add i386/${host_address}/t-fprules-softfp to
tmake_file for i[34567]86-*-darwin*, x86_64-*-darwin*,
- i[34567]86-*-linux*, x86_64-*-linux*.
+ i[34567]86-*-linux*, x86_64-*-linux*.
* configure.ac: Set host_address to 64 or 32 for x86.
* configure: Regenerated.
@@ -490,7 +521,7 @@
* Makefile.in: Use @shlib_slibdir@ substitution to get
correct install name on darwin.
* config/t-slibgcc-darwin: Use @shlib_slibdir@ for -install_name.
-
+
2007-12-15 Hans-Peter Nilsson <hp@axis.com>
* config.host (crisv32-*-elf, crisv32-*-none): New, same as
@@ -550,7 +581,7 @@
* config/t-tls: New file.
- * Makefile.in (INTERNAL_CFLAGS): Add @set_have_cc_tls@.
+ * Makefile.in (INTERNAL_CFLAGS): Add @set_have_cc_tls@.
* configure.ac: Include ../config/enable.m4 and
../config/tls.m4. Use GCC_CHECK_CC_TLS to check if assembler
@@ -564,7 +595,7 @@
2007-06-14 Danny Smith <dannysmith@users.sourceforge.net>
* config.host(*-cygwin* |*-mingw* ): Add crtbegin.o, crtend.o to
- extra_parts. Add config/i386/t-cygming to tmake_file.
+ extra_parts. Add config/i386/t-cygming to tmake_file.
* config/i386/t-cygming: New file with rules for crtbegin.o, crtend.o.
2007-05-29 Zuxy Meng <zuxy.meng@gmail.com>
@@ -689,7 +720,7 @@
* configure.ac: Add GCC_TOPLEV_SUBDIRS.
* configure: Regenerate.
* Makefile.in (host_subdir): Substitute it.
- (gcc_objdir): Use it.
+ (gcc_objdir): Use it.
2007-01-04 Daniel Jacobowitz <dan@codesourcery.com>
diff --git a/libgcc/config.host b/libgcc/config.host
index da4600489ba..f0861159adc 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -482,11 +482,18 @@ rs6000-ibm-aix5.1.* | powerpc-ibm-aix5.1.*)
;;
rs6000-ibm-aix[56789].* | powerpc-ibm-aix[56789].*)
;;
+rx-*-elf)
+ extra_parts="crtbegin.o crtend.o"
+ tmake_file="rx/t-rx"
+ ;;
s390-*-linux*)
+ tmake_file="${tmake_file} s390/t-crtstuff s390/t-linux s390/32/t-floattodi"
;;
s390x-*-linux*)
+ tmake_file="${tmake_file} s390/t-crtstuff s390/t-linux"
;;
s390x-ibm-tpf*)
+ tmake_file="${tmake_file} s390/t-crtstuff s390/t-tpf"
;;
score-*-elf)
;;
diff --git a/libgcc/config/i386/32/sfp-machine.h b/libgcc/config/i386/32/sfp-machine.h
index 746ae7c1287..85ddb74b643 100644
--- a/libgcc/config/i386/32/sfp-machine.h
+++ b/libgcc/config/i386/32/sfp-machine.h
@@ -38,9 +38,6 @@ typedef int __gcc_CMPtype __attribute__ ((mode (__libgcc_cmp_return__)));
"g" ((USItype) (y1)), \
"%2" ((USItype) (x0)), \
"g" ((USItype) (y0)))
-
-/* FIXME: Change last operand constraint
- from "im" to "g" when reload works properly. */
#define __FP_FRAC_SUB_4(r3,r2,r1,r0,x3,x2,x1,x0,y3,y2,y1,y0) \
__asm__ ("sub{l} {%11,%3|%3,%11}\n\t" \
"sbb{l} {%9,%2|%2,%9}\n\t" \
@@ -57,7 +54,7 @@ typedef int __gcc_CMPtype __attribute__ ((mode (__libgcc_cmp_return__)));
"2" ((USItype) (x1)), \
"g" ((USItype) (y1)), \
"3" ((USItype) (x0)), \
- "im" ((USItype) (y0)))
+ "g" ((USItype) (y0)))
#define __FP_FRAC_SUB_3(r2,r1,r0,x2,x1,x0,y2,y1,y0) \
__asm__ ("sub{l} {%8,%2|%2,%8}\n\t" \
"sbb{l} {%6,%1|%1,%6}\n\t" \
diff --git a/libgcc/config/rx/rx-abi-functions.c b/libgcc/config/rx/rx-abi-functions.c
new file mode 100644
index 00000000000..10dd9530d6b
--- /dev/null
+++ b/libgcc/config/rx/rx-abi-functions.c
@@ -0,0 +1,90 @@
+/* RX C ABI functions
+ Copyright (C) 2009 Free Software Foundation, Inc.
+ Contributed by Red Hat.
+
+ This file is part of GCC.
+
+ GCC is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3, or (at your option)
+ any later version.
+
+ GCC 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 General Public License for more details.
+
+ Under Section 7 of GPL version 3, you are granted additional
+ permissions described in the GCC Runtime Library Exception, version
+ 3.1, as published by the Free Software Foundation.
+
+ You should have received a copy of the GNU General Public License
+ along with GCC; see the file COPYING3. If not see
+ <http://www.gnu.org/licenses/>. */
+
+
+/* The RX C ABI includes the specification of a set of compiler support
+ functions. Libgcc2 includes some of them, although the names have to
+ be changed (see rx-abi.h), and the rest are defined here.
+
+ FIXME: Given that FINE_GRAINED_LIBRARIES is defined we ought to consider
+ compiling this file multiple times with one function per iteration being
+ compiled. */
+
+#ifdef __RX_64BIT_DOUBLES__
+
+int _COM_CMPLTd (double a, double b) { return __ltdf2 (a, b) == -1; }
+int _COM_CMPGTd (double a, double b) { return __gtdf2 (a, b) == 1; }
+int _COM_CMPLEd (double a, double b) { return __ledf2 (a, b) != 1; }
+int _COM_CMPGEd (double a, double b) { return __gedf2 (a, b) != -1; }
+int _COM_CMPEQd (double a, double b) { return __eqdf2 (a, b) == 0; }
+int _COM_CMPNEd (double a, double b) { return __nedf2 (a, b) != 0; }
+
+int _COM_CMPLTf (double, double) __attribute__ ((weak, alias ("_COM_CMPLTd")));
+int _COM_CMPGTf (double, double) __attribute__ ((weak, alias ("_COM_CMPGTd")));
+int _COM_CMPLEf (double, double) __attribute__ ((weak, alias ("_COM_CMPLEd")));
+int _COM_CMPGEf (double, double) __attribute__ ((weak, alias ("_COM_CMPGEd")));
+int _COM_CMPEQf (double, double) __attribute__ ((weak, alias ("_COM_CMPEQd")));
+int _COM_CMPNEf (double, double) __attribute__ ((weak, alias ("_COM_CMPNEd")));
+
+#else /* 32-bit doubles. */
+
+double _COM_CONVfd (float a) { return a; }
+float _COM_CONVdf (double a) { return a; }
+
+int _COM_CMPLTd (double a, double b) __attribute__ ((weak, alias ("_COM_CMPLTf")));
+int _COM_CMPGTd (double a, double b) __attribute__ ((weak, alias ("_COM_CMPGTf")));
+int _COM_CMPLEd (double a, double b) __attribute__ ((weak, alias ("_COM_CMPLEf")));
+int _COM_CMPGEd (double a, double b) __attribute__ ((weak, alias ("_COM_CMPGEf")));
+int _COM_CMPEQd (double a, double b) __attribute__ ((weak, alias ("_COM_CMPEQf")));
+int _COM_CMPNEd (double a, double b) __attribute__ ((weak, alias ("_COM_CMPNEf")));
+
+signed long long _COM_CONVd64s (double a) { return (signed long long) a; }
+unsigned long long _COM_CONVd64u (double a) { return (unsigned long long) a; }
+
+int _COM_CMPLTf (float a, float b) { return __ltsf2 (a, b) == -1; }
+int _COM_CMPGTf (float a, float b) { return __gtsf2 (a, b) == 1; }
+int _COM_CMPLEf (float a, float b) { return __lesf2 (a, b) != 1; }
+int _COM_CMPGEf (float a, float b) { return __gesf2 (a, b) != -1; }
+int _COM_CMPEQf (float a, float b) { return __eqsf2 (a, b) == 0; }
+int _COM_CMPNEf (float a, float b) { return __nesf2 (a, b) != 0; }
+
+#endif /* 64-bit vs 32-bit doubles. */
+
+double _COM_CONV64sd (signed long long a) { return (double) a; }
+double _COM_CONV64ud (unsigned long long a) { return (double) a; }
+
+extern int __cmpdi2 (long long, long long);
+extern int __ucmpdi2 (long long, long long);
+
+int _COM_CMPLT64s (long long a, long long b) { return __cmpdi2 (a, b) == 0; }
+int _COM_CMPLT64u (long long a, long long b) { return __ucmpdi2 (a, b) == 0; }
+int _COM_CMPGT64s (long long a, long long b) { return __cmpdi2 (a, b) == 2; }
+int _COM_CMPGT64u (long long a, long long b) { return __ucmpdi2 (a, b) == 2; }
+int _COM_CMPLE64s (long long a, long long b) { return __cmpdi2 (a, b) != 2; }
+int _COM_CMPLE64u (long long a, long long b) { return __ucmpdi2 (a, b) != 2; }
+int _COM_CMPGE64s (long long a, long long b) { return __cmpdi2 (a, b) != 0; }
+int _COM_CMPGE64u (long long a, long long b) { return __ucmpdi2 (a, b) != 0; }
+int _COM_CMPEQ64 (long long a, long long b) { return __cmpdi2 (a, b) == 1; }
+int _COM_CMPNE64 (long long a, long long b) { return __cmpdi2 (a, b) != 1; }
+
diff --git a/libgcc/config/rx/rx-abi.h b/libgcc/config/rx/rx-abi.h
new file mode 100644
index 00000000000..8a0bbdcd82c
--- /dev/null
+++ b/libgcc/config/rx/rx-abi.h
@@ -0,0 +1,235 @@
+/* Header file for RX ABI versions of libgcc functions.
+ Copyright (C) 2009
+ Free Software Foundation, Inc.
+ Contributed by Red Hat.
+
+ This file is part of GCC.
+
+ GCC is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 3, or (at your
+ option) any later version.
+
+ GCC 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 General Public
+ License for more details.
+
+ Under Section 7 of GPL version 3, you are granted additional
+ permissions described in the GCC Runtime Library Exception, version
+ 3.1, as published by the Free Software Foundation.
+
+ You should have received a copy of the GNU General Public License
+ along with GCC; see the file COPYING3. If not see
+ <http://www.gnu.org/licenses/>. */
+
+/* Make __COM_<RX_NAME> an alias for __<GCC_NAME>. */
+#define RENAME_LIBRARY(GCC_NAME, RX_NAME) \
+ __asm__ (".globl\t__COM_" #RX_NAME "\n" \
+ ".set\t__COM_" #RX_NAME ", ___" #GCC_NAME "\n");
+
+
+/* The long-long aliases... */
+
+#ifdef L_muldi3
+#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (muldi3, MUL64)
+#endif
+
+#ifdef L_divdi3
+#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (divdi3, DIV64s)
+#endif
+
+#ifdef L_udivdi3
+#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (udivdi3, DIV64u)
+#endif
+
+#ifdef L_ashldi3
+#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (ashldi3, SHLL64)
+#endif
+
+#ifdef L_lshrdi3
+#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (lshrdi3, SHLR64)
+#endif
+
+#ifdef L_ashrdi3
+#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (ashrdi3, SHAR64)
+#endif
+
+#ifdef L_fixsfdi
+#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (fixsfdi, CONVf64s)
+#endif
+
+#ifdef L_fixunssfdi
+#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (fixunssfdi, CONVf64u)
+#endif
+
+#ifdef L_floatdisf
+#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (floatdisf, CONV64sf)
+#endif
+
+#ifdef L_floatundisf
+#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (floatundisf, CONV64uf)
+#endif
+
+#ifdef L_moddi3
+#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (moddi3, MOD64s)
+#endif
+
+#ifdef L_umoddi3
+#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (umoddi3, MOD64u)
+#endif
+
+
+#ifdef L_si_to_sf
+#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (floatsisf, CONV32sf)
+#endif
+
+#ifdef L_usi_to_sf
+#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (floatunsisf, CONV32uf)
+#endif
+
+
+
+#ifdef __RX_64BIT_DOUBLES__
+
+/* Float (32-bit) aliases... */
+
+#ifdef L_sf_to_si
+#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (fixsfsi, CONVf32s)
+#endif
+
+#ifdef L_fixunssfsi
+#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (fixunssfsi, CONVf32u)
+#endif
+
+#ifdef L_addsub_sf
+#define DECLARE_LIBRARY_RENAMES \
+ RENAME_LIBRARY (addsf3, ADDf) \
+ RENAME_LIBRARY (subsf3, SUBf)
+#endif
+
+#ifdef L_mul_sf
+#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (mulsf3, MULf)
+#endif
+
+#ifdef L_div_sf
+#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (divsf3, DIVf)
+#endif
+
+/* Double (64-bit) aliases... */
+
+#ifdef L_addsub_df
+#define DECLARE_LIBRARY_RENAMES \
+ RENAME_LIBRARY (adddf3, ADDd) \
+ RENAME_LIBRARY (subdf3, SUBd)
+#endif
+
+#ifdef L_mul_df
+#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (muldf3, MULd)
+#endif
+
+#ifdef L_div_df
+#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (divdf3, DIVd)
+#endif
+
+#ifdef L_fixdfdi
+#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (fixdfdi, CONVd64s)
+#endif
+
+#ifdef L_fixunsdfdi
+#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (fixunsdfdi, CONVd64u)
+#endif
+
+#ifdef L_floatdidf
+#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (floatdisf, CONV64sd)
+#endif
+
+#ifdef L_floatundidf
+#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (floatdisf, CONV64ud)
+#endif
+
+#ifdef L_df_to_si
+#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (fixdfsi, CONVd32s)
+#endif
+
+#ifdef L_fixunsdfsi
+#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (fixunsdfsi, CONVd32u)
+#endif
+
+#ifdef L_si_to_df
+#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (floatsidf, CONV32sd)
+#endif
+
+#ifdef L_usi_to_df
+#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (floatunsidf, CONV32ud)
+#endif
+
+#ifdef L_sf_to_df
+#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (extendsfdf2, CONVfd)
+#endif
+
+#ifdef L_df_to_sf
+#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (truncdfsf2, CONVdf)
+#endif
+
+#ifdef L_negate_df
+#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (negdf2, NEGd)
+#endif
+
+/* The 64-bit comparison functions do not have aliases because libgcc2
+ does not provide them. Instead they have to be supplied in
+ rx-abi-functions.c. */
+
+
+#else /* 32-bit doubles. */
+
+
+#ifdef L_addsub_sf
+#define DECLARE_LIBRARY_RENAMES \
+ RENAME_LIBRARY (addsf3, ADDd) \
+ RENAME_LIBRARY (subsf3, SUBd) \
+ RENAME_LIBRARY (addsf3, ADDf) \
+ RENAME_LIBRARY (subsf3, SUBf)
+#endif
+
+#ifdef L_mul_sf
+#define DECLARE_LIBRARY_RENAMES \
+ RENAME_LIBRARY (mulsf3, MULd) \
+ RENAME_LIBRARY (mulsf3, MULf)
+#endif
+
+#ifdef L_div_sf
+#define DECLARE_LIBRARY_RENAMES \
+ RENAME_LIBRARY (divsf3, DIVd) \
+ RENAME_LIBRARY (divsf3, DIVf)
+#endif
+
+#ifdef L_sf_to_si
+#define DECLARE_LIBRARY_RENAMES \
+ RENAME_LIBRARY (fixsfsi, CONVd32s) \
+ RENAME_LIBRARY (fixsfsi, CONVf32s)
+#endif
+
+#ifdef L_fixunssfsi
+#define DECLARE_LIBRARY_RENAMES \
+ RENAME_LIBRARY (fixunssfsi, CONVd32u) \
+ RENAME_LIBRARY (fixunssfsi, CONVf32u)
+#endif
+
+#ifdef L_si_to_sf
+#define DECLARE_LIBRARY_RENAMES \
+ RENAME_LIBRARY (floatsisf, CONV32sd) \
+ RENAME_LIBRARY (floatsisf, CONV32sf)
+#endif
+
+#ifdef L_usi_to_sf
+#define DECLARE_LIBRARY_RENAMES \
+ RENAME_LIBRARY (floatunsisf, CONV32ud) \
+ RENAME_LIBRARY (floatunsisf, CONV32uf)
+#endif
+
+#ifdef L_negate_sf
+#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (negsf2, NEGd)
+#endif
+
+#endif /* 64-bit vs 32-bit doubles. */
diff --git a/libgcc/config/rx/t-rx b/libgcc/config/rx/t-rx
new file mode 100644
index 00000000000..1e66af0c8d3
--- /dev/null
+++ b/libgcc/config/rx/t-rx
@@ -0,0 +1,44 @@
+# Makefile fragment for building LIBGCC for the Renesas RX target.
+# Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+# Contributed by Red Hat.
+#
+# This file is part of GCC.
+#
+# GCC is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published
+# by the Free Software Foundation; either version 3, or (at your
+# option) any later version.
+#
+# GCC 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+
+# Add functions required by the RX ABI which are not part of
+# the normal libgcc sources:
+
+LIB2ADD = $(srcdir)/config/rx/rx-abi-functions.c
+
+
+# We need special handling of the floating point conversion
+# routines, to allow for the varying size of a double:
+
+FPBIT = fp-bit.c
+$(gcc_objdir)/fp-bit.c: $(gcc_srcdir)/config/fp-bit.c
+ echo '#define FLOAT' > $@
+ echo '#ifndef __RX_64BIT_DOUBLES__' >> $@
+ echo '#define DF SF' >> $@
+ echo '#define FLOAT_ONLY' >> $@
+ echo '#endif' >> $@
+ cat $(gcc_srcdir)/config/fp-bit.c >> $@
+
+DPBIT = dp-bit.c
+$(gcc_objdir)/dp-bit.c: $(gcc_srcdir)/config/fp-bit.c
+ echo '#ifdef __RX_64BIT_DOUBLES__' > $@
+ cat $(gcc_srcdir)/config/fp-bit.c >> $@
+ echo '#endif' >> $@
diff --git a/libgcc/config/s390/32/_fixdfdi.c b/libgcc/config/s390/32/_fixdfdi.c
new file mode 100644
index 00000000000..364849c2d56
--- /dev/null
+++ b/libgcc/config/s390/32/_fixdfdi.c
@@ -0,0 +1,97 @@
+/* Definitions of target machine for GNU compiler, for IBM S/390
+ Copyright (C) 1999, 2000, 2001, 2007, 2008 and 2009
+ Free Software Foundation, Inc.
+ Contributed by Hartmut Penner (hpenner@de.ibm.com) and
+ Ulrich Weigand (uweigand@de.ibm.com).
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC 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 General Public License
+for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#define EXPD(fp) (((fp.l.upper) >> 20) & 0x7FF)
+#define EXCESSD 1022
+#define SIGNBIT 0x80000000
+#define SIGND(fp) ((fp.l.upper) & SIGNBIT)
+#define MANTD_LL(fp) ((fp.ll & (HIDDEND_LL-1)) | HIDDEND_LL)
+#define FRACD_LL(fp) (fp.ll & (HIDDEND_LL-1))
+#define HIDDEND_LL ((UDItype_x)1 << 52)
+
+typedef int DItype_x __attribute__ ((mode (DI)));
+typedef unsigned int UDItype_x __attribute__ ((mode (DI)));
+typedef int SItype_x __attribute__ ((mode (SI)));
+typedef unsigned int USItype_x __attribute__ ((mode (SI)));
+
+union double_long {
+ double d;
+ struct {
+ SItype_x upper;
+ USItype_x lower;
+ } l;
+ UDItype_x ll;
+};
+
+DItype_x __fixdfdi (double a1);
+
+/* convert double to int */
+DItype_x
+__fixdfdi (double a1)
+{
+ register union double_long dl1;
+ register int exp;
+ register DItype_x l;
+
+ dl1.d = a1;
+
+ /* +/- 0, denormalized */
+
+ if (!EXPD (dl1))
+ return 0;
+
+ exp = EXPD (dl1) - EXCESSD - 53;
+
+ /* number < 1 */
+
+ if (exp < -53)
+ return 0;
+
+ /* NaN */
+
+ if ((EXPD(dl1) == 0x7ff) && (FRACD_LL(dl1) != 0)) /* NaN */
+ return 0x8000000000000000ULL;
+
+ /* Number big number & +/- inf */
+
+ if (exp >= 11) {
+ l = (long long)1<<63;
+ if (!SIGND(dl1))
+ l--;
+ return l;
+ }
+
+ l = MANTD_LL(dl1);
+
+ /* shift down until exp < 12 or l = 0 */
+ if (exp > 0)
+ l <<= exp;
+ else
+ l >>= -exp;
+
+ return (SIGND (dl1) ? -l : l);
+}
diff --git a/libgcc/config/s390/32/_fixsfdi.c b/libgcc/config/s390/32/_fixsfdi.c
new file mode 100644
index 00000000000..06336c12d2b
--- /dev/null
+++ b/libgcc/config/s390/32/_fixsfdi.c
@@ -0,0 +1,93 @@
+/* Definitions of target machine for GNU compiler, for IBM S/390
+ Copyright (C) 1999, 2000, 2001, 2007, 2008 and 2009
+ Free Software Foundation, Inc.
+ Contributed by Hartmut Penner (hpenner@de.ibm.com) and
+ Ulrich Weigand (uweigand@de.ibm.com).
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC 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 General Public License
+for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#define EXP(fp) (((fp.l) >> 23) & 0xFF)
+#define EXCESS 126
+#define SIGNBIT 0x80000000
+#define SIGN(fp) ((fp.l) & SIGNBIT)
+#define HIDDEN (1 << 23)
+#define MANT(fp) (((fp.l) & 0x7FFFFF) | HIDDEN)
+#define FRAC(fp) ((fp.l) & 0x7FFFFF)
+
+typedef int DItype_x __attribute__ ((mode (DI)));
+typedef unsigned int UDItype_x __attribute__ ((mode (DI)));
+typedef int SItype_x __attribute__ ((mode (SI)));
+typedef unsigned int USItype_x __attribute__ ((mode (SI)));
+
+union float_long
+ {
+ float f;
+ USItype_x l;
+ };
+
+DItype_x __fixsfdi (float a1);
+
+/* convert double to int */
+DItype_x
+__fixsfdi (float a1)
+{
+ register union float_long fl1;
+ register int exp;
+ register DItype_x l;
+
+ fl1.f = a1;
+
+ /* +/- 0, denormalized */
+
+ if (!EXP (fl1))
+ return 0;
+
+ exp = EXP (fl1) - EXCESS - 24;
+
+ /* number < 1 */
+
+ if (exp < -24)
+ return 0;
+
+ /* NaN */
+
+ if ((EXP(fl1) == 0xff) && (FRAC(fl1) != 0)) /* NaN */
+ return 0x8000000000000000ULL;
+
+ /* Number big number & +/- inf */
+
+ if (exp >= 40) {
+ l = (long long)1<<63;
+ if (!SIGN(fl1))
+ l--;
+ return l;
+ }
+
+ l = MANT(fl1);
+
+ if (exp > 0)
+ l <<= exp;
+ else
+ l >>= -exp;
+
+ return (SIGN (fl1) ? -l : l);
+}
diff --git a/libgcc/config/s390/32/_fixtfdi.c b/libgcc/config/s390/32/_fixtfdi.c
new file mode 100644
index 00000000000..719703ee189
--- /dev/null
+++ b/libgcc/config/s390/32/_fixtfdi.c
@@ -0,0 +1,102 @@
+/* Definitions of target machine for GNU compiler, for IBM S/390
+ Copyright (C) 1999, 2000, 2001, 2007, 2008 and 2009
+ Free Software Foundation, Inc.
+ Contributed by Hartmut Penner (hpenner@de.ibm.com) and
+ Ulrich Weigand (uweigand@de.ibm.com).
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC 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 General Public License
+for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#define EXPD(fp) (((fp.l.i[0]) >> 16) & 0x7FFF)
+#define EXPONENT_BIAS 16383
+#define MANTISSA_BITS 112
+#define PRECISION (MANTISSA_BITS + 1)
+#define SIGNBIT 0x80000000
+#define SIGND(fp) ((fp.l.i[0]) & SIGNBIT)
+#define MANTD_HIGH_LL(fp) ((fp.ll[0] & HIGH_LL_FRAC_MASK) | HIGH_LL_UNIT_BIT)
+#define MANTD_LOW_LL(fp) (fp.ll[1])
+#define FRACD_ZERO_P(fp) (!fp.ll[1] && !(fp.ll[0] & HIGH_LL_FRAC_MASK))
+#define HIGH_LL_FRAC_BITS 48
+#define HIGH_LL_UNIT_BIT ((UDItype_x)1 << HIGH_LL_FRAC_BITS)
+#define HIGH_LL_FRAC_MASK (HIGH_LL_UNIT_BIT - 1)
+
+typedef int DItype_x __attribute__ ((mode (DI)));
+typedef unsigned int UDItype_x __attribute__ ((mode (DI)));
+typedef int SItype_x __attribute__ ((mode (SI)));
+typedef unsigned int USItype_x __attribute__ ((mode (SI)));
+
+union double_long {
+ long double d;
+ struct {
+ SItype_x i[4]; /* 32 bit parts: 0 upper ... 3 lowest */
+ } l;
+ UDItype_x ll[2]; /* 64 bit parts: 0 upper, 1 lower */
+};
+
+DItype_x __fixtfdi (long double a1);
+
+/* convert double to unsigned int */
+DItype_x
+__fixtfdi (long double a1)
+{
+ register union double_long dl1;
+ register int exp;
+ register UDItype_x l;
+
+ dl1.d = a1;
+
+ /* +/- 0, denormalized */
+ if (!EXPD (dl1))
+ return 0;
+
+ /* The exponent - considered the binary point at the right end of
+ the mantissa. */
+ exp = EXPD (dl1) - EXPONENT_BIAS - MANTISSA_BITS;
+
+ /* number < 1: If the mantissa would need to be right-shifted more bits than
+ its size the result would be zero. */
+ if (exp <= -PRECISION)
+ return 0;
+
+ /* NaN: All exponent bits set and a nonzero fraction. */
+ if ((EXPD(dl1) == 0x7fff) && !FRACD_ZERO_P (dl1))
+ return 0x8000000000000000ULL;
+
+ /* One extra bit is needed for the unit bit which is appended by
+ MANTD_HIGH_LL on the left of the matissa. */
+ exp += HIGH_LL_FRAC_BITS + 1;
+
+ /* If the result would still need a left shift it will be too large
+ to be represented. Compared to the unsigned variant we have to
+ take care that there is still space for the sign bit to be
+ applied. So we can only go on if there is a right-shift by one
+ or more. */
+ if (exp >= 0)
+ {
+ l = 1ULL << 63; /* long long min */
+ return SIGND (dl1) ? l : l - 1;
+ }
+
+ l = MANTD_LOW_LL (dl1) >> (HIGH_LL_FRAC_BITS + 1)
+ | MANTD_HIGH_LL (dl1) << (64 - (HIGH_LL_FRAC_BITS + 1));
+
+ return SIGND (dl1) ? -(l >> -exp) : l >> -exp;
+}
diff --git a/libgcc/config/s390/32/_fixunsdfdi.c b/libgcc/config/s390/32/_fixunsdfdi.c
new file mode 100644
index 00000000000..2c336529967
--- /dev/null
+++ b/libgcc/config/s390/32/_fixunsdfdi.c
@@ -0,0 +1,94 @@
+/* Definitions of target machine for GNU compiler, for IBM S/390
+ Copyright (C) 1999, 2000, 2001, 2007, 2008 and 2009
+ Free Software Foundation, Inc.
+ Contributed by Hartmut Penner (hpenner@de.ibm.com) and
+ Ulrich Weigand (uweigand@de.ibm.com).
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC 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 General Public License
+for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#define EXPD(fp) (((fp.l.upper) >> 20) & 0x7FF)
+#define EXCESSD 1022
+#define SIGNBIT 0x80000000
+#define SIGND(fp) ((fp.l.upper) & SIGNBIT)
+#define MANTD_LL(fp) ((fp.ll & (HIDDEND_LL-1)) | HIDDEND_LL)
+#define FRACD_LL(fp) (fp.ll & (HIDDEND_LL-1))
+#define HIDDEND_LL ((UDItype_x)1 << 52)
+
+typedef int DItype_x __attribute__ ((mode (DI)));
+typedef unsigned int UDItype_x __attribute__ ((mode (DI)));
+typedef int SItype_x __attribute__ ((mode (SI)));
+typedef unsigned int USItype_x __attribute__ ((mode (SI)));
+
+union double_long {
+ double d;
+ struct {
+ SItype_x upper;
+ USItype_x lower;
+ } l;
+ UDItype_x ll;
+};
+
+UDItype_x __fixunsdfdi (double a1);
+
+/* convert double to unsigned int */
+UDItype_x
+__fixunsdfdi (double a1)
+{
+ register union double_long dl1;
+ register int exp;
+ register UDItype_x l;
+
+ dl1.d = a1;
+
+ /* +/- 0, denormalized, negative */
+
+ if (!EXPD (dl1) || SIGND(dl1))
+ return 0;
+
+ exp = EXPD (dl1) - EXCESSD - 53;
+
+ /* number < 1 */
+
+ if (exp < -53)
+ return 0;
+
+ /* NaN */
+
+ if ((EXPD(dl1) == 0x7ff) && (FRACD_LL(dl1) != 0)) /* NaN */
+ return 0x0ULL;
+
+ /* Number big number & + inf */
+
+ if (exp >= 12) {
+ return 0xFFFFFFFFFFFFFFFFULL;
+ }
+
+ l = MANTD_LL(dl1);
+
+ /* shift down until exp < 12 or l = 0 */
+ if (exp > 0)
+ l <<= exp;
+ else
+ l >>= -exp;
+
+ return l;
+}
diff --git a/libgcc/config/s390/32/_fixunssfdi.c b/libgcc/config/s390/32/_fixunssfdi.c
new file mode 100644
index 00000000000..eaaad9648d0
--- /dev/null
+++ b/libgcc/config/s390/32/_fixunssfdi.c
@@ -0,0 +1,90 @@
+/* Definitions of target machine for GNU compiler, for IBM S/390
+ Copyright (C) 1999, 2000, 2001, 2007, 2008 and 2009
+ Free Software Foundation, Inc.
+ Contributed by Hartmut Penner (hpenner@de.ibm.com) and
+ Ulrich Weigand (uweigand@de.ibm.com).
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC 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 General Public License
+for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#define EXP(fp) (((fp.l) >> 23) & 0xFF)
+#define EXCESS 126
+#define SIGNBIT 0x80000000
+#define SIGN(fp) ((fp.l) & SIGNBIT)
+#define HIDDEN (1 << 23)
+#define MANT(fp) (((fp.l) & 0x7FFFFF) | HIDDEN)
+#define FRAC(fp) ((fp.l) & 0x7FFFFF)
+
+typedef int DItype_x __attribute__ ((mode (DI)));
+typedef unsigned int UDItype_x __attribute__ ((mode (DI)));
+typedef int SItype_x __attribute__ ((mode (SI)));
+typedef unsigned int USItype_x __attribute__ ((mode (SI)));
+
+union float_long
+ {
+ float f;
+ USItype_x l;
+ };
+
+UDItype_x __fixunssfdi (float a1);
+
+/* convert float to unsigned int */
+UDItype_x
+__fixunssfdi (float a1)
+{
+ register union float_long fl1;
+ register int exp;
+ register UDItype_x l;
+
+ fl1.f = a1;
+
+ /* +/- 0, denormalized, negative */
+
+ if (!EXP (fl1) || SIGN(fl1))
+ return 0;
+
+ exp = EXP (fl1) - EXCESS - 24;
+
+ /* number < 1 */
+
+ if (exp < -24)
+ return 0;
+
+ /* NaN */
+
+ if ((EXP(fl1) == 0xff) && (FRAC(fl1) != 0)) /* NaN */
+ return 0x0ULL;
+
+ /* Number big number & + inf */
+
+ if (exp >= 41) {
+ return 0xFFFFFFFFFFFFFFFFULL;
+ }
+
+ l = MANT(fl1);
+
+ if (exp > 0)
+ l <<= exp;
+ else
+ l >>= -exp;
+
+ return l;
+}
diff --git a/libgcc/config/s390/32/_fixunstfdi.c b/libgcc/config/s390/32/_fixunstfdi.c
new file mode 100644
index 00000000000..cc7ada5e0cf
--- /dev/null
+++ b/libgcc/config/s390/32/_fixunstfdi.c
@@ -0,0 +1,97 @@
+/* Definitions of target machine for GNU compiler, for IBM S/390
+ Copyright (C) 1999, 2000, 2001, 2007, 2008 and 2009
+ Free Software Foundation, Inc.
+ Contributed by Hartmut Penner (hpenner@de.ibm.com) and
+ Ulrich Weigand (uweigand@de.ibm.com).
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC 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 General Public License
+for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#define EXPD(fp) (((fp.l.i[0]) >> 16) & 0x7FFF)
+#define EXPONENT_BIAS 16383
+#define MANTISSA_BITS 112
+#define PRECISION (MANTISSA_BITS + 1)
+#define SIGNBIT 0x80000000
+#define SIGND(fp) ((fp.l.i[0]) & SIGNBIT)
+#define MANTD_HIGH_LL(fp) ((fp.ll[0] & HIGH_LL_FRAC_MASK) | HIGH_LL_UNIT_BIT)
+#define MANTD_LOW_LL(fp) (fp.ll[1])
+#define FRACD_ZERO_P(fp) (!fp.ll[1] && !(fp.ll[0] & HIGH_LL_FRAC_MASK))
+#define HIGH_LL_FRAC_BITS 48
+#define HIGH_LL_UNIT_BIT ((UDItype_x)1 << HIGH_LL_FRAC_BITS)
+#define HIGH_LL_FRAC_MASK (HIGH_LL_UNIT_BIT - 1)
+
+typedef int DItype_x __attribute__ ((mode (DI)));
+typedef unsigned int UDItype_x __attribute__ ((mode (DI)));
+typedef int SItype_x __attribute__ ((mode (SI)));
+typedef unsigned int USItype_x __attribute__ ((mode (SI)));
+
+union double_long {
+ long double d;
+ struct {
+ SItype_x i[4]; /* 32 bit parts: 0 upper ... 3 lowest */
+ } l;
+ UDItype_x ll[2]; /* 64 bit parts: 0 upper, 1 lower */
+};
+
+UDItype_x __fixunstfdi (long double a1);
+
+/* convert double to unsigned int */
+UDItype_x
+__fixunstfdi (long double a1)
+{
+ register union double_long dl1;
+ register int exp;
+ register UDItype_x l;
+
+ dl1.d = a1;
+
+ /* +/- 0, denormalized, negative */
+ if (!EXPD (dl1) || SIGND(dl1))
+ return 0;
+
+ /* The exponent - considered the binary point at the right end of
+ the mantissa. */
+ exp = EXPD (dl1) - EXPONENT_BIAS - MANTISSA_BITS;
+
+ /* number < 1: If the mantissa would need to be right-shifted more bits than
+ its size (plus the implied one bit on the left) the result would be
+ zero. */
+ if (exp <= -PRECISION)
+ return 0;
+
+ /* NaN: All exponent bits set and a nonzero fraction. */
+ if ((EXPD(dl1) == 0x7fff) && !FRACD_ZERO_P (dl1))
+ return 0x0ULL;
+
+ /* One extra bit is needed for the unit bit which is appended by
+ MANTD_HIGH_LL on the left of the matissa. */
+ exp += HIGH_LL_FRAC_BITS + 1;
+
+ /* If the result would still need a left shift it will be too large
+ to be represented. */
+ if (exp > 0)
+ return 0xFFFFFFFFFFFFFFFFULL;
+
+ l = MANTD_LOW_LL (dl1) >> (HIGH_LL_FRAC_BITS + 1)
+ | MANTD_HIGH_LL (dl1) << (64 - (HIGH_LL_FRAC_BITS + 1));
+
+ return l >> -exp;
+}
diff --git a/libgcc/config/s390/32/t-floattodi b/libgcc/config/s390/32/t-floattodi
new file mode 100644
index 00000000000..4bd87b1f888
--- /dev/null
+++ b/libgcc/config/s390/32/t-floattodi
@@ -0,0 +1,5 @@
+floattodi-functions = _fixsfdi _fixdfdi _fixtfdi _fixunssfdi _fixunsdfdi _fixunstfdi
+LIB2FUNCS_EXCLUDE += $(floattodi-functions)
+
+floattodi-src = $(addsuffix .c, $(floattodi-functions))
+LIB2ADD = $(addprefix $(srcdir)/config/s390/32/, $(floattodi-src))
diff --git a/libgcc/config/s390/libgcc-glibc.ver b/libgcc/config/s390/libgcc-glibc.ver
new file mode 100644
index 00000000000..6fc52e40d78
--- /dev/null
+++ b/libgcc/config/s390/libgcc-glibc.ver
@@ -0,0 +1,116 @@
+# Copyright (C) 2002, 2006, 2008 Free Software Foundation, Inc.
+#
+# This file is part of GCC.
+#
+# GCC is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GCC 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# In order to work around the very problems that force us to now generally
+# create a libgcc.so, glibc reexported a number of routines from libgcc.a.
+# By now choosing the same version tags for these specific routines, we
+# maintain enough binary compatibility to allow future versions of glibc
+# to defer implementation of these routines to libgcc.so via DT_AUXILIARY.
+
+# Note that we cannot use the default libgcc-glibc.ver file on s390x,
+# because GLIBC_2.0 does not exist on this architecture, as the first
+# ever glibc release on the platform was GLIBC_2.2.
+
+%ifndef __s390x__
+%exclude {
+ __divdi3
+ __moddi3
+ __udivdi3
+ __umoddi3
+ __register_frame
+ __register_frame_table
+ __deregister_frame
+ __register_frame_info
+ __deregister_frame_info
+ __frame_state_for
+ __register_frame_info_table
+}
+
+%inherit GCC_3.0 GLIBC_2.0
+GLIBC_2.0 {
+ __divdi3
+ __moddi3
+ __udivdi3
+ __umoddi3
+
+ __register_frame
+ __register_frame_table
+ __deregister_frame
+ __register_frame_info
+ __deregister_frame_info
+ __frame_state_for
+ __register_frame_info_table
+}
+%endif
+
+%ifdef __s390x__
+%exclude {
+ __register_frame
+ __register_frame_table
+ __deregister_frame
+ __register_frame_info
+ __deregister_frame_info
+ __frame_state_for
+ __register_frame_info_table
+}
+
+%inherit GCC_3.0 GLIBC_2.2
+GLIBC_2.2 {
+ __register_frame
+ __register_frame_table
+ __deregister_frame
+ __register_frame_info
+ __deregister_frame_info
+ __frame_state_for
+ __register_frame_info_table
+}
+%endif
+
+# With GCC 4.1.0 long double 128 bit support was introduced. The
+# following symbols coming from libgcc are enabled when -mlong-double-128
+# is specified. These lines make the symbols to get a @@GCC_4.1.0 attached.
+
+%exclude {
+ __divtc3
+ __multc3
+ __powitf2
+ __fixtfti
+ __fixunstfti
+ __floattitf
+
+ __fixtfdi
+ __fixunstfdi
+ __floatditf
+}
+
+GCC_4.1.0 {
+ __divtc3
+ __multc3
+ __powitf2
+
+%ifdef __s390x__
+ __fixtfti
+ __fixunstfti
+ __floattitf
+
+%else
+ __fixtfdi
+ __fixunstfdi
+ __floatditf
+%endif
+}
diff --git a/libgcc/config/s390/t-crtstuff b/libgcc/config/s390/t-crtstuff
new file mode 100644
index 00000000000..92e87b2da7e
--- /dev/null
+++ b/libgcc/config/s390/t-crtstuff
@@ -0,0 +1,6 @@
+# crtend*.o cannot be compiled without -fno-asynchronous-unwind-tables,
+# because then __FRAME_END__ might not be the last thing in .eh_frame
+# section.
+CRTSTUFF_T_CFLAGS += -fno-asynchronous-unwind-tables
+CRTSTUFF_T_CFLAGS_S += -fno-asynchronous-unwind-tables
+
diff --git a/libgcc/config/s390/t-linux b/libgcc/config/s390/t-linux
new file mode 100644
index 00000000000..a0f10cb2995
--- /dev/null
+++ b/libgcc/config/s390/t-linux
@@ -0,0 +1,7 @@
+DFP_ENABLE = true
+
+# Override t-slibgcc-elf-ver to export some libgcc symbols with
+# the symbol versions that glibc used.
+SHLIB_MAPFILES = $(gcc_srcdir)/libgcc-std.ver $(srcdir)/config/s390/libgcc-glibc.ver
+
+HOST_LIBGCC2_CFLAGS += -mlong-double-128 \ No newline at end of file
diff --git a/libgcc/config/s390/t-tpf b/libgcc/config/s390/t-tpf
new file mode 100644
index 00000000000..b1e8f6910da
--- /dev/null
+++ b/libgcc/config/s390/t-tpf
@@ -0,0 +1,8 @@
+# Compile libgcc2.a with pic.
+HOST_LIBGCC2_CFLAGS += -fPIC
+
+# Use unwind-dw2-fde-glibc.
+LIB2ADDEH = $(gcc_srcdir)/unwind-dw2.c $(gcc_srcdir)/unwind-dw2-fde-glibc.c \
+ $(gcc_srcdir)/unwind-sjlj.c $(gcc_srcdir)/gthr-gnat.c $(gcc_srcdir)/unwind-c.c \
+ $(gcc_srcdir)/emutls.c
+LIB2ADDEHDEP = unwind.inc unwind-dw2-fde.h