1 LIB1ASMSRC = avr/lib1funcs.S
17 _divmodpsi4 _udivmodpsi4 \
22 _mulsidi3 _umulsidi3 \
32 _xload_1 _xload_2 _xload_3 _xload_4 \
55 _ashldi3 _ashrdi3 _lshrdi3 _rotldi3 \
56 _adddi3 _adddi3_s8 _subdi3 \
60 # Fixed point routines in avr/lib1funcs-fixed.S
62 _fractqqsf _fractuqqsf \
63 _fracthqsf _fractuhqsf _fracthasf _fractuhasf \
64 _fractsasf _fractusasf _fractsqsf _fractusqsf \
66 _fractsfqq _fractsfuqq \
67 _fractsfhq _fractsfuhq _fractsfha _fractsfuha \
68 _fractsfsq _fractsfusq _fractsfsa _fractsfusa \
71 _mulha3 _muluha3 _muluha3_round \
73 _usmuluha3 _ssmulha3 \
74 _usmulusa3 _ssmulsa3 \
75 _divqq3 _udivuqq3 _divqq_helper \
80 _ssneg_2 _ssneg_4 _ssneg_8 \
81 _ssabs_1 _ssabs_2 _ssabs_4 _ssabs_8 \
85 _roundqq3 _rounduqq3 \
86 _round_s2 _round_u2 _round_2_const _addmask_2 \
87 _round_s4 _round_u4 _round_4_const _addmask_4 \
89 _rounddq3 _roundudq3 \
90 _roundda3 _rounduda3 \
91 _roundta3 _rounduta3 \
100 # We do not have the DF type.
101 # Most of the C functions in libgcc2 use almost all registers,
102 # so use -mcall-prologues for smaller code size.
103 HOST_LIBGCC2_CFLAGS += -DDF=SF -Dinhibit_libc -mcall-prologues -Os
105 # Extra 16-bit integer functions.
106 intfuncs16 = _absvXX2 _addvXX3 _subvXX3 _mulvXX3 _negvXX2 _clrsbXX2
108 hiintfuncs16 = $(subst XX,hi,$(intfuncs16))
109 siintfuncs16 = $(subst XX,si,$(intfuncs16))
111 iter-items := $(hiintfuncs16)
112 iter-labels := $(siintfuncs16)
113 iter-sizes := $(patsubst %,2,$(siintfuncs16)) $(patsubst %,2,$(hiintfuncs16))
116 include $(srcdir)/empty.mk $(patsubst %,$(srcdir)/siditi-object.mk,$(iter-items))
117 libgcc-objects += $(patsubst %,%$(objext),$(hiintfuncs16))
119 ifeq ($(enable_shared),yes)
120 libgcc-s-objects += $(patsubst %,%_s$(objext),$(hiintfuncs16))
125 conv_XY=$(conv)$(mode1)$(mode2)
126 func_X=$(func)$(mode)
128 # Compile C functions from lib2funcs.c and add them to libgcc.a.
130 # Some functions which are not performance.critical are more convenient
131 # to implement in C than in assembler. Most of them serve as implementation
132 # for AVR-specific builtins in the case where the address of a builtin
133 # function is taken or if there is no insn that implements the builtin.
135 # We don't use LIB2ADD because we want to iterate over the source for
136 # different modes, fixed-point suffixes, etc. See iter-labels and L_LABEL.
137 # iter-label will get one more underscore in order to avoid too short
138 # labels like -DLk and we use -DL_k instead.
140 # Build roundFX functions from lib2funcs.c
142 round_suffix := hr r lr uhr ur ulr \
144 round_funcs := $(foreach func,_round,\
145 $(foreach mode,$(round_suffix),$(func_X)))
147 iter-items := $(round_funcs)
148 iter-labels := $(round_suffix)
149 iter-flags := $(patsubst %,-DL_round,$(iter-items))
151 include $(srcdir)/empty.mk $(patsubst %,$(srcdir)/config/avr/lib2-object.mk,$(iter-items))
153 libgcc-objects += $(patsubst %,%$(objext),$(round_funcs))
155 # Build clrsbXX functions from lib2funcs.c
158 clrsb_funcs := $(foreach func,_clrsb,\
159 $(foreach mode,$(clrsb_modes),$(func_X)))
161 iter-items := $(clrsb_funcs)
162 iter-labels := $(clrsb_funcs)
163 iter-flags := $(patsubst %,-DL_clrsb,$(iter-items))
165 include $(srcdir)/empty.mk $(patsubst %,$(srcdir)/config/avr/lib2-object.mk,$(iter-items))
167 libgcc-objects += $(patsubst %,%$(objext),$(clrsb_funcs))
169 # Build signed countlsFX functions from lib2funcs.c
171 countls_modes := qi hi si di
172 countls_funcs := $(foreach func,_countls,\
173 $(foreach mode,$(countls_modes),$(func_X)))
175 iter-items := $(countls_funcs)
176 iter-labels := $(countls_modes)
177 iter-flags := $(patsubst %,-DL_countls,$(iter-items))
179 include $(srcdir)/empty.mk $(patsubst %,$(srcdir)/config/avr/lib2-object.mk,$(iter-items))
181 libgcc-objects += $(patsubst %,%$(objext),$(countls_funcs))
183 # Build unsigned countlsFX functions from lib2funcs.c
185 countlsu_modes := qi hi si di
186 countlsu_funcs := $(foreach func,_countlsu,\
187 $(foreach mode,$(countlsu_modes),$(func_X)))
189 iter-items := $(countlsu_funcs)
190 iter-labels := $(countlsu_modes)
191 iter-flags := $(patsubst %,-DL_countlsu,$(iter-items))
193 include $(srcdir)/empty.mk $(patsubst %,$(srcdir)/config/avr/lib2-object.mk,$(iter-items))
195 libgcc-objects += $(patsubst %,%$(objext),$(countlsu_funcs))
198 # Filter out supported conversions from fixed-bit.c
199 # Also filter out TQ and UTQ.
201 # Conversions supported by the compiler
203 convf_modes = QI UQI QQ UQQ \
204 HI UHI HQ UHQ HA UHA \
205 SI USI SQ USQ SA USA \
206 DI UDI DQ UDQ DA UDA \
209 LIB2FUNCS_EXCLUDE += \
210 $(foreach conv,_fract _fractuns,\
211 $(foreach mode1,$(convf_modes),\
212 $(foreach mode2,$(convf_modes),$(conv_XY))))
214 # Conversions supported by lib1funcs-fixed.S
216 conv_to_sf_modes = QQ UQQ HQ UHQ HA UHA SQ USQ SA USA
217 conv_from_sf_modes = QQ UQQ HQ UHQ HA UHA SA USA
219 LIB2FUNCS_EXCLUDE += \
220 $(foreach conv,_fract, \
221 $(foreach mode1,$(conv_to_sf_modes), \
222 $(foreach mode2,SF,$(conv_XY))))
224 LIB2FUNCS_EXCLUDE += \
225 $(foreach conv,_fract,\
227 $(foreach mode2,$(conv_from_sf_modes),$(conv_XY))))
229 # Arithmetik supported by the compiler
231 allfix_modes = QQ UQQ HQ UHQ HA UHA SQ USQ SA USA DA UDA DQ UDQ TQ UTQ TA UTA
233 LIB2FUNCS_EXCLUDE += \
234 $(foreach func,_add _sub,\
235 $(foreach mode,$(allfix_modes),$(func_X)))
237 LIB2FUNCS_EXCLUDE += \
238 $(foreach func,_lshr _ashl _ashr _cmp,\
239 $(foreach mode,$(allfix_modes),$(func_X)))
242 usat_modes = UQQ UHQ UHA USQ USA UDQ UDA UTQ UTA
243 ssat_modes = QQ HQ HA SQ SA DQ DA TQ TA
245 LIB2FUNCS_EXCLUDE += \
246 $(foreach func,_ssadd _sssub _ssneg _ssabs,\
247 $(foreach mode,$(ssat_modes),$(func_X)))
249 LIB2FUNCS_EXCLUDE += \
250 $(foreach func,_usadd _ussub _usneg,\
251 $(foreach mode,$(usat_modes),$(func_X)))
254 smul_modes = QQ HQ HA SA
255 umul_modes = UQQ UHQ UHA USA
256 sdiv_modes = QQ HQ HA SA
257 udiv_modes = UQQ UHQ UHA USA
259 LIB2FUNCS_EXCLUDE += \
260 $(foreach func,_mul,\
261 $(foreach mode,$(smul_modes) $(umul_modes),$(func_X)))
263 LIB2FUNCS_EXCLUDE += \
264 $(foreach func,_div,\
265 $(foreach mode,$(sdiv_modes) $(udiv_modes),$(func_X)))
269 usmul_modes = UHA USA
271 LIB2FUNCS_EXCLUDE += \
272 $(foreach func,_usmul,\
273 $(foreach mode,$(usmul_modes),$(func_X)))
275 LIB2FUNCS_EXCLUDE += \
276 $(foreach func,_ssmul,\
277 $(foreach mode,$(ssmul_modes),$(func_X)))