]> git.ipfire.org Git - thirdparty/gcc.git/blame - libgcc/config/t-hardfp
decl.c, [...]: Remove redundant enum from machine_mode.
[thirdparty/gcc.git] / libgcc / config / t-hardfp
CommitLineData
1c51d688
RS
1# Copyright (C) 2014 Free Software Foundation, Inc.
2
3# This file is part of GCC.
4
5# GCC is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 3, or (at your option)
8# any later version.
9
10# GCC is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13# GNU General Public License for more details.
14
15# You should have received a copy of the GNU General Public License
16# along with GCC; see the file COPYING3. If not see
17# <http://www.gnu.org/licenses/>.
18
19# For historical reasons, some targets provide a full set of FP routines
20# even if there is native hardware support for some of them. This file
21# is used to define functions that can be implemented directly in hardware.
22# For example, an __adddf3 defined by this file will use an FPU addition.
23#
24# The following variables should be set up before including this file:
25#
26# hardfp_float_modes: a list of hardware floating-point modes.
27# e.g. sf df
28# hardfp_int_modes: a list of integer modes for which to define conversions;
29# usually this is "si", since libgcc2.c provides routines
30# for wider modes
31# hardfp_extensions: a list of extensions between hardware floating-point modes,
32# e.g. sfdf
33# hardfp_truncations: a list of truncations between hardware floating-point
34# modes, e.g. dfsf
35
36# Functions parameterized by a floating-point mode M.
37hardfp_func_bases := addM3 subM3 negM2 mulM3 divM3
38hardfp_func_bases += eqM2 neM2 geM2 gtM2 leM2 ltM2 unordM2
39
40# Functions parameterized by both a floating-point mode M and an integer mode N.
41hardfp_int_func_bases := fixMN floatNM floatunNM
42hardfp_func_bases += $(foreach n, $(hardfp_int_modes), \
43 $(subst N,$(n),$(hardfp_int_func_bases)))
44
45# Get the full list of functions.
46hardfp_func_list := $(foreach m, $(hardfp_float_modes), \
47 $(subst M,$(m),$(hardfp_func_bases)))
48hardfp_func_list += $(foreach pair, $(hardfp_extensions), \
49 $(subst M,$(pair),extendM2))
50hardfp_func_list += $(foreach pair, $(hardfp_truncations), \
51 $(subst M,$(pair),truncM2))
52
53# Regexp for matching a floating-point mode.
54hardfp_mode_regexp := $(shell echo $(hardfp_float_modes) | sed 's/ /\\|/g')
55
56# Regexp for matching the end of a function name, after the last
57# floating-point mode.
58hardfp_suffix_regexp := $(shell echo $(hardfp_int_modes) 2 3 | sed 's/ /\\|/g')
59
60# Add -D options to define:
61# FUNC: the function name (e.g. __addsf3)
62# OP: the function name without the leading __ and with the last
63# floating-point mode removed (e.g. add3)
64# TYPE: the last floating-point mode (e.g. sf)
65hardfp_defines_for = \
66 $(shell echo $1 | \
67 sed 's/\(.*\)\($(hardfp_mode_regexp)\)\($(hardfp_suffix_regexp)\|\)$$/-DFUNC=__& -DOP_\1\3 -DTYPE=\2/')
68
69hardfp-o = $(patsubst %,%$(objext),$(hardfp_func_list))
70$(hardfp-o): %$(objext): $(srcdir)/config/hardfp.c
71 @echo "Mode = $(hardfp_mode_regexp)"
72 @echo "Suffix = $(hardfp_suffix_regexp)"
73 $(gcc_compile) $(call hardfp_defines_for, $*) -c $< $(vis_hide) -Wno-missing-prototypes
74libgcc-objects += $(hardfp-o)
75
76ifeq ($(enable_shared),yes)
77hardfp-s-o = $(patsubst %,%_s$(objext),$(hardfp_func_list))
78$(hardfp-s-o): %_s$(objext): $(srcdir)/config/hardfp.c
79 $(gcc_s_compile) $(call hardfp_defines_for, $*) -c $< -Wno-missing-prototypes
80libgcc-s-objects += $(hardfp-s-o)
81endif