summaryrefslogtreecommitdiff
path: root/libgcc/config/t-softfp
blob: 6d0c38bcc5e6b7cbf44c8f6e6b969906c3475fba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# Copyright (C) 2006-2013 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/>.

# Targets using soft-fp should define the following variables:
#
# softfp_float_modes: a list of soft-float floating-point modes,
#                     e.g. sf df
# softfp_int_modes: a list of integer modes for which to define conversions,
#                   e.g. si di
# softfp_extensions: a list of extensions between floating-point modes,
#                    e.g. sfdf
# softfp_truncations: a list of truncations between floating-point modes,
#                     e.g. dfsf
#
# Extensions and truncations should include those where only one mode
# is a soft-float mode; for example, sftf where sf is hard-float and
# tf is soft-float.
#
# If the libgcc2.c functions should not be replaced, also define:
#
# softfp_exclude_libgcc2 := y
#
# Avoiding replacing the libgcc2.c functions is a temporary measure
# for targets with both hard-float and soft-float multilibs, since
# these variables apply for all multilibs.  With toplevel libgcc,
# soft-fp can be used conditionally on the multilib instead.
#
# If the code should not be compiled at all for some multilibs, define:
#
# softfp_wrap_start: text to put at the start of wrapper source files,
#                    output with echo
#                    e.g. '#ifndef __powerpc64__'
# softfp_wrap_end: text to put at the end of wrapper source files,
#                  e.g. '#endif'
#
# This is another temporary measure.

softfp_float_funcs = add$(m)3 div$(m)3 eq$(m)2 ge$(m)2 le$(m)2 mul$(m)3 \
  neg$(m)2 sub$(m)3 unord$(m)2
softfp_floatint_funcs = fix$(m)$(i) fixuns$(m)$(i) \
  float$(i)$(m) floatun$(i)$(m)

softfp_func_list := \
  $(foreach m,$(softfp_float_modes), \
              $(softfp_float_funcs) \
              $(foreach i,$(softfp_int_modes), \
                          $(softfp_floatint_funcs))) \
  $(foreach e,$(softfp_extensions),extend$(e)2) \
  $(foreach t,$(softfp_truncations),trunc$(t)2)

ifeq ($(softfp_exclude_libgcc2),y)
# This list is taken from mklibgcc.in and doesn't presently allow for
# 64-bit targets where si should become di and di should become ti.
softfp_func_list := $(filter-out floatdidf floatdisf fixunsdfsi fixunssfsi \
  fixunsdfdi fixdfdi fixunssfdi fixsfdi fixxfdi fixunsxfdi \
  floatdixf fixunsxfsi fixtfdi fixunstfdi floatditf \
  floatundidf floatundisf floatundixf floatunditf,$(softfp_func_list))
endif

ifeq ($(softfp_wrap_start),)
softfp_file_list := \
  $(addsuffix .c,$(addprefix $(srcdir)/soft-fp/,$(softfp_func_list)))
else
softfp_file_list := $(addsuffix .c,$(softfp_func_list))

$(softfp_file_list):
	echo $(softfp_wrap_start) > $@
	echo '#include "soft-fp/$@"' >> $@
	echo $(softfp_wrap_end) >> $@
endif

# Disable missing prototype and type limit warnings.  The prototypes
# for the functions in the soft-fp files have not been brought across
# from glibc.

soft-fp-objects = $(addsuffix $(objext), $(softfp_file_list)) \
  $(addsuffix _s$(objext), $(softfp_file_list))

$(soft-fp-objects) : INTERNAL_CFLAGS += -Wno-missing-prototypes -Wno-type-limits

LIB2ADD += $(softfp_file_list)

ifneq ($(softfp_exclude_libgcc2),y)
# Functions in libgcc2.c are excluded for each soft-float mode (a
# target may have both soft-float and hard-float modes), for the fixed
# list of integer modes (si and di) for which libgcc2.c defines any
# such functions.  Depending on the target, the si and di symbols may
# in fact define di and ti functions.

LIB2FUNCS_EXCLUDE += \
  $(addprefix _,$(foreach m,$(softfp_float_modes), \
                            $(foreach i,si di, \
                                        $(softfp_floatint_funcs))))
endif