diff options
author | Richard Sandiford <rdsandiford@googlemail.com> | 2014-02-07 07:46:34 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2014-02-07 07:46:34 +0000 |
commit | 1c51d6883ae957c26cbd2a71c09291e34a21f73c (patch) | |
tree | 9d53b8933341fc4dff85d5421e2b2231852248bd /libgcc/config | |
parent | 6d6af792827fa779531662366b6dadad477a84dc (diff) | |
download | gcc-1c51d6883ae957c26cbd2a71c09291e34a21f73c.zip gcc-1c51d6883ae957c26cbd2a71c09291e34a21f73c.tar.gz gcc-1c51d6883ae957c26cbd2a71c09291e34a21f73c.tar.bz2 |
configure.ac (libgcc_cv_mips_hard_float): New.
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.
From-SVN: r207593
Diffstat (limited to 'libgcc/config')
-rw-r--r-- | libgcc/config/hardfp.c | 62 | ||||
-rw-r--r-- | libgcc/config/mips/t-mips | 8 | ||||
-rw-r--r-- | libgcc/config/t-hardfp | 81 | ||||
-rw-r--r-- | libgcc/config/t-hardfp-sfdf | 23 |
4 files changed, 174 insertions, 0 deletions
diff --git a/libgcc/config/hardfp.c b/libgcc/config/hardfp.c new file mode 100644 index 0000000..4d938d4 --- /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 4f94ee6..4fb8e13 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 0000000..fe02f8e --- /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 0000000..5d39b78 --- /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 |