diff options
Diffstat (limited to 'libgcc')
-rw-r--r-- | libgcc/ChangeLog | 11 | ||||
-rw-r--r-- | libgcc/config.host | 4 | ||||
-rw-r--r-- | libgcc/config/rx/rx-abi-functions.c | 90 | ||||
-rw-r--r-- | libgcc/config/rx/rx-abi.h | 235 | ||||
-rw-r--r-- | libgcc/config/rx/t-rx | 44 |
5 files changed, 384 insertions, 0 deletions
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index e951502ca76..2db5d2901c8 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,14 @@ +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 diff --git a/libgcc/config.host b/libgcc/config.host index 91b70548101..f0861159adc 100644 --- a/libgcc/config.host +++ b/libgcc/config.host @@ -482,6 +482,10 @@ 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" ;; 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' >> $@ |