summaryrefslogtreecommitdiffstats
path: root/libgcc
diff options
context:
space:
mode:
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2014-02-07 07:46:34 +0000
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2014-02-07 07:46:34 +0000
commit4b366ca99e51b2e80ceb5f2b7ece5189f43bd661 (patch)
tree9d53b8933341fc4dff85d5421e2b2231852248bd /libgcc
parentd0f12d442bcc3dd04b66458fc73bf21e837b6b00 (diff)
downloadppe42-gcc-4b366ca99e51b2e80ceb5f2b7ece5189f43bd661.tar.gz
ppe42-gcc-4b366ca99e51b2e80ceb5f2b7ece5189f43bd661.zip
libgcc/
* 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
Diffstat (limited to 'libgcc')
-rw-r--r--libgcc/ChangeLog13
-rw-r--r--libgcc/config.host7
-rw-r--r--libgcc/config/hardfp.c62
-rw-r--r--libgcc/config/mips/t-mips8
-rw-r--r--libgcc/config/t-hardfp81
-rw-r--r--libgcc/config/t-hardfp-sfdf23
-rw-r--r--libgcc/configure24
-rw-r--r--libgcc/configure.ac12
8 files changed, 229 insertions, 1 deletions
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog
index 68b7eaf23cf..2389df55738 100644
--- a/libgcc/ChangeLog
+++ b/libgcc/ChangeLog
@@ -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.
diff --git a/libgcc/config.host b/libgcc/config.host
index 902a5827a1b..0b83fc05464 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -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
index 00000000000..4d938d44b07
--- /dev/null
+++ b/libgcc/config/hardfp.c
@@ -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
diff --git a/libgcc/config/mips/t-mips b/libgcc/config/mips/t-mips
index 4f94ee66be3..4fb8e136217 100644
--- a/libgcc/config/mips/t-mips
+++ b/libgcc/config/mips/t-mips
@@ -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
index 00000000000..fe02f8e3dde
--- /dev/null
+++ b/libgcc/config/t-hardfp
@@ -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
index 00000000000..5d39b78929d
--- /dev/null
+++ b/libgcc/config/t-hardfp-sfdf
@@ -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
diff --git a/libgcc/configure b/libgcc/configure
index 092e20ee633..35896deb7bf 100644
--- a/libgcc/configure
+++ b/libgcc/configure
@@ -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
diff --git a/libgcc/configure.ac b/libgcc/configure.ac
index d77a8f09e6c..d877d21c092 100644
--- a/libgcc/configure.ac
+++ b/libgcc/configure.ac
@@ -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
OpenPOWER on IntegriCloud