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
This commit is contained in:
parent
6d6af79282
commit
1c51d6883a
8 changed files with 229 additions and 1 deletions
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
62
libgcc/config/hardfp.c
Normal file
62
libgcc/config/hardfp.c
Normal file
|
@ -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
|
|
@ -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
|
||||
|
|
81
libgcc/config/t-hardfp
Normal file
81
libgcc/config/t-hardfp
Normal file
|
@ -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
|
23
libgcc/config/t-hardfp-sfdf
Normal file
23
libgcc/config/t-hardfp-sfdf
Normal file
|
@ -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
|
24
libgcc/configure
vendored
24
libgcc/configure
vendored
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue