1*e4b17023SJohn Marino# Copyright (C) 2006, 2007, 2011 Free Software Foundation, Inc. 2*e4b17023SJohn Marino 3*e4b17023SJohn Marino# This file is part of GCC. 4*e4b17023SJohn Marino 5*e4b17023SJohn Marino# GCC is free software; you can redistribute it and/or modify 6*e4b17023SJohn Marino# it under the terms of the GNU General Public License as published by 7*e4b17023SJohn Marino# the Free Software Foundation; either version 3, or (at your option) 8*e4b17023SJohn Marino# any later version. 9*e4b17023SJohn Marino 10*e4b17023SJohn Marino# GCC is distributed in the hope that it will be useful, 11*e4b17023SJohn Marino# but WITHOUT ANY WARRANTY; without even the implied warranty of 12*e4b17023SJohn Marino# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13*e4b17023SJohn Marino# GNU General Public License for more details. 14*e4b17023SJohn Marino 15*e4b17023SJohn Marino# You should have received a copy of the GNU General Public License 16*e4b17023SJohn Marino# along with GCC; see the file COPYING3. If not see 17*e4b17023SJohn Marino# <http://www.gnu.org/licenses/>. 18*e4b17023SJohn Marino 19*e4b17023SJohn Marino# Targets using soft-fp should define the following variables: 20*e4b17023SJohn Marino# 21*e4b17023SJohn Marino# softfp_float_modes: a list of soft-float floating-point modes, 22*e4b17023SJohn Marino# e.g. sf df 23*e4b17023SJohn Marino# softfp_int_modes: a list of integer modes for which to define conversions, 24*e4b17023SJohn Marino# e.g. si di 25*e4b17023SJohn Marino# softfp_extensions: a list of extensions between floating-point modes, 26*e4b17023SJohn Marino# e.g. sfdf 27*e4b17023SJohn Marino# softfp_truncations: a list of truncations between floating-point modes, 28*e4b17023SJohn Marino# e.g. dfsf 29*e4b17023SJohn Marino# 30*e4b17023SJohn Marino# Extensions and truncations should include those where only one mode 31*e4b17023SJohn Marino# is a soft-float mode; for example, sftf where sf is hard-float and 32*e4b17023SJohn Marino# tf is soft-float. 33*e4b17023SJohn Marino# 34*e4b17023SJohn Marino# If the libgcc2.c functions should not be replaced, also define: 35*e4b17023SJohn Marino# 36*e4b17023SJohn Marino# softfp_exclude_libgcc2 := y 37*e4b17023SJohn Marino# 38*e4b17023SJohn Marino# Avoiding replacing the libgcc2.c functions is a temporary measure 39*e4b17023SJohn Marino# for targets with both hard-float and soft-float multilibs, since 40*e4b17023SJohn Marino# these variables apply for all multilibs. With toplevel libgcc, 41*e4b17023SJohn Marino# soft-fp can be used conditionally on the multilib instead. 42*e4b17023SJohn Marino# 43*e4b17023SJohn Marino# If the code should not be compiled at all for some multilibs, define: 44*e4b17023SJohn Marino# 45*e4b17023SJohn Marino# softfp_wrap_start: text to put at the start of wrapper source files, 46*e4b17023SJohn Marino# output with echo 47*e4b17023SJohn Marino# e.g. '#ifndef __powerpc64__' 48*e4b17023SJohn Marino# softfp_wrap_end: text to put at the end of wrapper source files, 49*e4b17023SJohn Marino# e.g. '#endif' 50*e4b17023SJohn Marino# 51*e4b17023SJohn Marino# This is another temporary measure. 52*e4b17023SJohn Marino 53*e4b17023SJohn Marinosoftfp_float_funcs = add$(m)3 div$(m)3 eq$(m)2 ge$(m)2 le$(m)2 mul$(m)3 \ 54*e4b17023SJohn Marino neg$(m)2 sub$(m)3 unord$(m)2 55*e4b17023SJohn Marinosoftfp_floatint_funcs = fix$(m)$(i) fixuns$(m)$(i) \ 56*e4b17023SJohn Marino float$(i)$(m) floatun$(i)$(m) 57*e4b17023SJohn Marino 58*e4b17023SJohn Marinosoftfp_func_list := \ 59*e4b17023SJohn Marino $(foreach m,$(softfp_float_modes), \ 60*e4b17023SJohn Marino $(softfp_float_funcs) \ 61*e4b17023SJohn Marino $(foreach i,$(softfp_int_modes), \ 62*e4b17023SJohn Marino $(softfp_floatint_funcs))) \ 63*e4b17023SJohn Marino $(foreach e,$(softfp_extensions),extend$(e)2) \ 64*e4b17023SJohn Marino $(foreach t,$(softfp_truncations),trunc$(t)2) 65*e4b17023SJohn Marino 66*e4b17023SJohn Marinoifeq ($(softfp_exclude_libgcc2),y) 67*e4b17023SJohn Marino# This list is taken from mklibgcc.in and doesn't presently allow for 68*e4b17023SJohn Marino# 64-bit targets where si should become di and di should become ti. 69*e4b17023SJohn Marinosoftfp_func_list := $(filter-out floatdidf floatdisf fixunsdfsi fixunssfsi \ 70*e4b17023SJohn Marino fixunsdfdi fixdfdi fixunssfdi fixsfdi fixxfdi fixunsxfdi \ 71*e4b17023SJohn Marino floatdixf fixunsxfsi fixtfdi fixunstfdi floatditf \ 72*e4b17023SJohn Marino floatundidf floatundisf floatundixf floatunditf,$(softfp_func_list)) 73*e4b17023SJohn Marinoendif 74*e4b17023SJohn Marino 75*e4b17023SJohn Marinoifeq ($(softfp_wrap_start),) 76*e4b17023SJohn Marinosoftfp_file_list := \ 77*e4b17023SJohn Marino $(addsuffix .c,$(addprefix $(srcdir)/soft-fp/,$(softfp_func_list))) 78*e4b17023SJohn Marinoelse 79*e4b17023SJohn Marinosoftfp_file_list := $(addsuffix .c,$(softfp_func_list)) 80*e4b17023SJohn Marino 81*e4b17023SJohn Marino$(softfp_file_list): 82*e4b17023SJohn Marino echo $(softfp_wrap_start) > $@ 83*e4b17023SJohn Marino echo '#include "soft-fp/$@"' >> $@ 84*e4b17023SJohn Marino echo $(softfp_wrap_end) >> $@ 85*e4b17023SJohn Marinoendif 86*e4b17023SJohn Marino 87*e4b17023SJohn Marino# Disable missing prototype and type limit warnings. The prototypes 88*e4b17023SJohn Marino# for the functions in the soft-fp files have not been brought across 89*e4b17023SJohn Marino# from glibc. 90*e4b17023SJohn Marino 91*e4b17023SJohn Marinosoft-fp-objects = $(addsuffix $(objext), $(softfp_file_list)) \ 92*e4b17023SJohn Marino $(addsuffix _s$(objext), $(softfp_file_list)) 93*e4b17023SJohn Marino 94*e4b17023SJohn Marino$(soft-fp-objects) : INTERNAL_CFLAGS += -Wno-missing-prototypes -Wno-type-limits 95*e4b17023SJohn Marino 96*e4b17023SJohn MarinoLIB2ADD += $(softfp_file_list) 97*e4b17023SJohn Marino 98*e4b17023SJohn Marinoifneq ($(softfp_exclude_libgcc2),y) 99*e4b17023SJohn Marino# Functions in libgcc2.c are excluded for each soft-float mode (a 100*e4b17023SJohn Marino# target may have both soft-float and hard-float modes), for the fixed 101*e4b17023SJohn Marino# list of integer modes (si and di) for which libgcc2.c defines any 102*e4b17023SJohn Marino# such functions. Depending on the target, the si and di symbols may 103*e4b17023SJohn Marino# in fact define di and ti functions. 104*e4b17023SJohn Marino 105*e4b17023SJohn MarinoLIB2FUNCS_EXCLUDE += \ 106*e4b17023SJohn Marino $(addprefix _,$(foreach m,$(softfp_float_modes), \ 107*e4b17023SJohn Marino $(foreach i,si di, \ 108*e4b17023SJohn Marino $(softfp_floatint_funcs)))) 109*e4b17023SJohn Marinoendif 110