]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libgcc/
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 7 Feb 2014 07:46:34 +0000 (07:46 +0000)
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 7 Feb 2014 07:46:34 +0000 (07:46 +0000)
* configure.ac (libgcc_cv_mips_hard_float): New.
* configure: Regenerate.
* config.host (mips*-*-*): Use t-hardfp-sfdf rather than
t-softfp-sfdf for hard-float targets.
* config/mips/t-mips (LIB2_SIDITI_CONV_FUNCS): Reinstate.
(softfp_float_modes, softfp_int_modes, softfp_extensions)
(softfp_truncations, softfp_exclude_libgcc2): New.
* config/t-hardfp: New file.
* config/t-hardfp-sfdf: Likewise.
* config/hardfp.c: Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@207593 138bc75d-0d04-0410-961f-82ee72b054a4

libgcc/ChangeLog
libgcc/config.host
libgcc/config/hardfp.c [new file with mode: 0644]
libgcc/config/mips/t-mips
libgcc/config/t-hardfp [new file with mode: 0644]
libgcc/config/t-hardfp-sfdf [new file with mode: 0644]
libgcc/configure
libgcc/configure.ac

index 68b7eaf23cf2b7a1a6869b51fda76ec09df884ba..2389df557386150679debbf55a356f66f47b1a86 100644 (file)
@@ -1,3 +1,16 @@
+2014-02-07  Richard Sandiford  <rdsandiford@googlemail.com>
+
+       * configure.ac (libgcc_cv_mips_hard_float): New.
+       * configure: Regenerate.
+       * config.host (mips*-*-*): Use t-hardfp-sfdf rather than
+       t-softfp-sfdf for hard-float targets.
+       * config/mips/t-mips (LIB2_SIDITI_CONV_FUNCS): Reinstate.
+       (softfp_float_modes, softfp_int_modes, softfp_extensions)
+       (softfp_truncations, softfp_exclude_libgcc2): New.
+       * config/t-hardfp: New file.
+       * config/t-hardfp-sfdf: Likewise.
+       * config/hardfp.c: Likewise.
+
 2014-02-05  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
 
        * config.host: Include t-floattodi also for s390x.
index 902a5827a1b50afbc221ce5de2943e320e745742..0b83fc05464e38bf7168b2e11848183946a8226a 100644 (file)
@@ -142,7 +142,12 @@ microblaze*-*-*)
 mips*-*-*)
        # All MIPS targets provide a full set of FP routines.
        cpu_type=mips
-       tmake_file="mips/t-mips t-softfp-sfdf"
+       tmake_file="mips/t-mips"
+       if test "${libgcc_cv_mips_hard_float}" = yes; then
+               tmake_file="${tmake_file} t-hardfp-sfdf t-hardfp"
+       else
+               tmake_file="${tmake_file} t-softfp-sfdf"
+       fi
        if test "${ac_cv_sizeof_long_double}" = 16; then
                tmake_file="${tmake_file} mips/t-softfp-tf"
        fi
diff --git a/libgcc/config/hardfp.c b/libgcc/config/hardfp.c
new file mode 100644 (file)
index 0000000..4d938d4
--- /dev/null
@@ -0,0 +1,62 @@
+/* Dummy floating-point routines for hard-float code.
+   Copyright (C) 2014 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.
+
+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 sf float
+#define df double
+
+#if defined (OP_add3)
+TYPE FUNC (TYPE x, TYPE y) { return x + y; }
+#elif defined (OP_sub3)
+TYPE FUNC (TYPE x, TYPE y) { return x - y; }
+#elif defined (OP_neg2)
+TYPE FUNC (TYPE x) { return -x; }
+#elif defined (OP_mul3)
+TYPE FUNC (TYPE x, TYPE y) { return x * y; }
+#elif defined (OP_div3)
+TYPE FUNC (TYPE x, TYPE y) { return x / y; }
+#elif defined (OP_eq2) || defined (OP_ne2)
+int FUNC (TYPE x, TYPE y) { return x == y ? 0 : 1; }
+#elif defined (OP_ge2)
+int FUNC (TYPE x, TYPE y) { return x >= y ? 0 : -1; }
+#elif defined (OP_gt2)
+int FUNC (TYPE x, TYPE y) { return x > y ? 1 : 0; }
+#elif defined (OP_le2)
+int FUNC (TYPE x, TYPE y) { return x <= y ? 0 : 1; }
+#elif defined (OP_lt2)
+int FUNC (TYPE x, TYPE y) { return x < y ? -1 : 0; }
+#elif defined (OP_unord2)
+int FUNC (TYPE x, TYPE y) { return __builtin_isunordered (x, y); }
+#elif defined (OP_fixsi)
+int FUNC (TYPE x) { return (int) x; }
+#elif defined (OP_floatsi)
+TYPE FUNC (int x) { return (TYPE) x; }
+#elif defined (OP_floatunsi)
+TYPE FUNC (unsigned int x) { return (TYPE) x; }
+#elif defined (OP_extendsf2)
+TYPE FUNC (float x) { return (TYPE) x; }
+#elif defined (OP_truncdf2)
+TYPE FUNC (double x) { return (TYPE) x; }
+#else
+#error Unknown operation
+#endif
index 4f94ee66be36b78b1fdabc49da120923c2780528..4fb8e1362171201a3f640188b5f530420803d9d7 100644 (file)
@@ -1 +1,9 @@
+LIB2_SIDITI_CONV_FUNCS = yes
+
+softfp_float_modes :=
+softfp_int_modes := si di
+softfp_extensions :=
+softfp_truncations :=
+softfp_exclude_libgcc2 := n
+
 LIB2ADD_ST += $(srcdir)/config/mips/lib2funcs.c
diff --git a/libgcc/config/t-hardfp b/libgcc/config/t-hardfp
new file mode 100644 (file)
index 0000000..fe02f8e
--- /dev/null
@@ -0,0 +1,81 @@
+# Copyright (C) 2014 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/>.
+
+# For historical reasons, some targets provide a full set of FP routines
+# even if there is native hardware support for some of them.  This file
+# is used to define functions that can be implemented directly in hardware.
+# For example, an __adddf3 defined by this file will use an FPU addition.
+#
+# The following variables should be set up before including this file:
+#
+# hardfp_float_modes: a list of hardware floating-point modes.
+#                     e.g. sf df
+# hardfp_int_modes: a list of integer modes for which to define conversions;
+#                  usually this is "si", since libgcc2.c provides routines
+#                  for wider modes
+# hardfp_extensions: a list of extensions between hardware floating-point modes,
+#                    e.g. sfdf
+# hardfp_truncations: a list of truncations between hardware floating-point
+#                     modes, e.g. dfsf
+
+# Functions parameterized by a floating-point mode M.
+hardfp_func_bases := addM3 subM3 negM2 mulM3 divM3
+hardfp_func_bases += eqM2 neM2 geM2 gtM2 leM2 ltM2 unordM2
+
+# Functions parameterized by both a floating-point mode M and an integer mode N.
+hardfp_int_func_bases := fixMN floatNM floatunNM
+hardfp_func_bases += $(foreach n, $(hardfp_int_modes), \
+                              $(subst N,$(n),$(hardfp_int_func_bases)))
+
+# Get the full list of functions.
+hardfp_func_list := $(foreach m, $(hardfp_float_modes), \
+                             $(subst M,$(m),$(hardfp_func_bases)))
+hardfp_func_list += $(foreach pair, $(hardfp_extensions), \
+                             $(subst M,$(pair),extendM2))
+hardfp_func_list += $(foreach pair, $(hardfp_truncations), \
+                             $(subst M,$(pair),truncM2))
+
+# Regexp for matching a floating-point mode.
+hardfp_mode_regexp := $(shell echo $(hardfp_float_modes) | sed 's/ /\\|/g')
+
+# Regexp for matching the end of a function name, after the last
+# floating-point mode.
+hardfp_suffix_regexp := $(shell echo $(hardfp_int_modes) 2 3 | sed 's/ /\\|/g')
+
+# Add -D options to define:
+#   FUNC: the function name (e.g. __addsf3)
+#   OP:   the function name without the leading __ and with the last
+#            floating-point mode removed (e.g. add3)
+#   TYPE: the last floating-point mode (e.g. sf)
+hardfp_defines_for = \
+  $(shell echo $1 | \
+    sed 's/\(.*\)\($(hardfp_mode_regexp)\)\($(hardfp_suffix_regexp)\|\)$$/-DFUNC=__& -DOP_\1\3 -DTYPE=\2/')
+
+hardfp-o = $(patsubst %,%$(objext),$(hardfp_func_list))
+$(hardfp-o): %$(objext): $(srcdir)/config/hardfp.c
+       @echo "Mode = $(hardfp_mode_regexp)"
+       @echo "Suffix = $(hardfp_suffix_regexp)"
+       $(gcc_compile) $(call hardfp_defines_for, $*) -c $< $(vis_hide) -Wno-missing-prototypes
+libgcc-objects += $(hardfp-o)
+
+ifeq ($(enable_shared),yes)
+hardfp-s-o = $(patsubst %,%_s$(objext),$(hardfp_func_list))
+$(hardfp-s-o): %_s$(objext): $(srcdir)/config/hardfp.c
+       $(gcc_s_compile) $(call hardfp_defines_for, $*) -c $< -Wno-missing-prototypes
+libgcc-s-objects += $(hardfp-s-o)
+endif
diff --git a/libgcc/config/t-hardfp-sfdf b/libgcc/config/t-hardfp-sfdf
new file mode 100644 (file)
index 0000000..5d39b78
--- /dev/null
@@ -0,0 +1,23 @@
+# Copyright (C) 2014 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/>.
+
+hardfp_float_modes := sf df
+# di and ti are provided by libgcc2.c where needed.
+hardfp_int_modes := si
+hardfp_extensions := sfdf
+hardfp_truncations := dfsf
index 092e20ee633ee08f6dcda8ac800d0257f66f192f..35896deb7bf69aa823c4c0140c2f2dd3734d5b85 100644 (file)
@@ -4330,6 +4330,30 @@ EOF
 eval `${CC-cc} -E conftest.c | grep host_address=`
 rm -f conftest.c
 
+case ${host} in
+mips*-*-*)
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the target is hard-float" >&5
+$as_echo_n "checking whether the target is hard-float... " >&6; }
+if test "${libgcc_cv_mips_hard_float+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifndef __mips_hard_float
+     #error FOO
+     #endif
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  libgcc_cv_mips_hard_float=yes
+else
+  libgcc_cv_mips_hard_float=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgcc_cv_mips_hard_float" >&5
+$as_echo "$libgcc_cv_mips_hard_float" >&6; }
+esac
+
 # Collect host-machine-specific information.
 . ${srcdir}/config.host
 
index d77a8f09e6c83791b15c08917816185e8d2588a6..d877d21c092e036b8fefdc0d02d8895606537e2a 100644 (file)
@@ -292,6 +292,18 @@ EOF
 eval `${CC-cc} -E conftest.c | grep host_address=`
 rm -f conftest.c
 
+case ${host} in
+mips*-*-*)
+  AC_CACHE_CHECK([whether the target is hard-float],
+                [libgcc_cv_mips_hard_float],
+                [AC_COMPILE_IFELSE(
+    [#ifndef __mips_hard_float
+     #error FOO
+     #endif],
+    [libgcc_cv_mips_hard_float=yes],
+    [libgcc_cv_mips_hard_float=no])])
+esac
+
 # Collect host-machine-specific information.
 . ${srcdir}/config.host