1*ec02198aSmrg# Copyright (C) 2014-2020 Free Software Foundation, Inc. 210d565efSmrg 310d565efSmrg# This file is part of GCC. 410d565efSmrg 510d565efSmrg# GCC is free software; you can redistribute it and/or modify 610d565efSmrg# it under the terms of the GNU General Public License as published by 710d565efSmrg# the Free Software Foundation; either version 3, or (at your option) 810d565efSmrg# any later version. 910d565efSmrg 1010d565efSmrg# GCC is distributed in the hope that it will be useful, 1110d565efSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 1210d565efSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1310d565efSmrg# GNU General Public License for more details. 1410d565efSmrg 1510d565efSmrg# You should have received a copy of the GNU General Public License 1610d565efSmrg# along with GCC; see the file COPYING3. If not see 1710d565efSmrg# <http://www.gnu.org/licenses/>. 1810d565efSmrg 1910d565efSmrg# For historical reasons, some targets provide a full set of FP routines 2010d565efSmrg# even if there is native hardware support for some of them. This file 2110d565efSmrg# is used to define functions that can be implemented directly in hardware. 2210d565efSmrg# For example, an __adddf3 defined by this file will use an FPU addition. 2310d565efSmrg# 2410d565efSmrg# The following variables should be set up before including this file: 2510d565efSmrg# 2610d565efSmrg# hardfp_float_modes: a list of hardware floating-point modes. 2710d565efSmrg# e.g. sf df 2810d565efSmrg# hardfp_int_modes: a list of integer modes for which to define conversions; 2910d565efSmrg# usually this is "si", since libgcc2.c provides routines 3010d565efSmrg# for wider modes 3110d565efSmrg# hardfp_extensions: a list of extensions between hardware floating-point modes, 3210d565efSmrg# e.g. sfdf 3310d565efSmrg# hardfp_truncations: a list of truncations between hardware floating-point 3410d565efSmrg# modes, e.g. dfsf 3510d565efSmrg# 3610d565efSmrg# If some functions that would otherwise be defined should not be 3710d565efSmrg# defined by this file (typically because the target would compile 3810d565efSmrg# certain operations into a call to the libgcc function, which thus 3910d565efSmrg# needs to be defined elsewhere to use software floating point), also 4010d565efSmrg# define hardfp_exclusions to be a list of those functions, 4110d565efSmrg# e.g. unorddf2. 4210d565efSmrg 4310d565efSmrg# Functions parameterized by a floating-point mode M. 4410d565efSmrghardfp_func_bases := addM3 subM3 negM2 mulM3 divM3 4510d565efSmrghardfp_func_bases += eqM2 neM2 geM2 gtM2 leM2 ltM2 unordM2 4610d565efSmrg 4710d565efSmrg# Functions parameterized by both a floating-point mode M and an integer mode N. 4810d565efSmrghardfp_int_func_bases := fixMN floatNM floatunNM 4910d565efSmrghardfp_func_bases += $(foreach n, $(hardfp_int_modes), \ 5010d565efSmrg $(subst N,$(n),$(hardfp_int_func_bases))) 5110d565efSmrg 5210d565efSmrg# Get the full list of functions. 5310d565efSmrghardfp_func_list := $(foreach m, $(hardfp_float_modes), \ 5410d565efSmrg $(subst M,$(m),$(hardfp_func_bases))) 5510d565efSmrghardfp_func_list += $(foreach pair, $(hardfp_extensions), \ 5610d565efSmrg $(subst M,$(pair),extendM2)) 5710d565efSmrghardfp_func_list += $(foreach pair, $(hardfp_truncations), \ 5810d565efSmrg $(subst M,$(pair),truncM2)) 5910d565efSmrg 6010d565efSmrghardfp_func_list := $(filter-out $(hardfp_exclusions),$(hardfp_func_list)) 6110d565efSmrg 6210d565efSmrg# Regexp for matching a floating-point mode. 6310d565efSmrghardfp_mode_regexp := $(shell echo $(hardfp_float_modes) | sed 's/ /\\|/g') 6410d565efSmrg 6510d565efSmrg# Regexp for matching the end of a function name, after the last 6610d565efSmrg# floating-point mode. 6710d565efSmrghardfp_suffix_regexp := $(shell echo $(hardfp_int_modes) 2 3 | sed 's/ /\\|/g') 6810d565efSmrg 6910d565efSmrg# Add -D options to define: 7010d565efSmrg# FUNC: the function name (e.g. __addsf3) 7110d565efSmrg# OP: the function name without the leading __ and with the last 7210d565efSmrg# floating-point mode removed (e.g. add3) 7310d565efSmrg# TYPE: the last floating-point mode (e.g. sf) 7410d565efSmrghardfp_defines_for = \ 7510d565efSmrg $(shell echo $1 | \ 7610d565efSmrg sed 's/\(.*\)\($(hardfp_mode_regexp)\)\($(hardfp_suffix_regexp)\|\)$$/-DFUNC=__& -DOP_\1\3 -DTYPE=\2/') 7710d565efSmrg 7810d565efSmrghardfp-o = $(patsubst %,%$(objext),$(hardfp_func_list)) 7910d565efSmrg$(hardfp-o): %$(objext): $(srcdir)/config/hardfp.c 8010d565efSmrg @echo "Mode = $(hardfp_mode_regexp)" 8110d565efSmrg @echo "Suffix = $(hardfp_suffix_regexp)" 8210d565efSmrg $(gcc_compile) $(call hardfp_defines_for, $*) -c $< $(vis_hide) -Wno-missing-prototypes 8310d565efSmrglibgcc-objects += $(hardfp-o) 8410d565efSmrg 8510d565efSmrgifeq ($(enable_shared),yes) 8610d565efSmrghardfp-s-o = $(patsubst %,%_s$(objext),$(hardfp_func_list)) 8710d565efSmrg$(hardfp-s-o): %_s$(objext): $(srcdir)/config/hardfp.c 8810d565efSmrg $(gcc_s_compile) $(call hardfp_defines_for, $*) -c $< -Wno-missing-prototypes 8910d565efSmrglibgcc-s-objects += $(hardfp-s-o) 9010d565efSmrgendif 91