1 LIB1ASMSRC = avr/lib1funcs.S
12 _divmodpsi4 _udivmodpsi4 \
38 # The below functions either use registers that are not present
39 # in tiny core, or use a different register conventions (don't save
40 # callee saved regs, for example)
41 # _mulhisi3 and variations - clobber R18, R19
42 # All *di funcs - use regs < R16 or expect args in regs < R20
43 # _prologue and _epilogue save registers < R16
44 # _load ad _xload variations - expect lpm and elpm support
45 # _movmemx - expects elpm/lpm
47 ifneq ($(MULTIFLAGS),-mmcu=avrtiny)
56 _mulsidi3 _umulsidi3 \
63 _xload_1 _xload_2 _xload_3 _xload_4 \
69 _ashldi3 _ashrdi3 _lshrdi3 _rotldi3 \
70 _adddi3 _adddi3_s8 _subdi3 \
74 # Fixed point routines in avr/lib1funcs-fixed.S
75 ifneq ($(MULTIFLAGS),-mmcu=avrtiny)
77 _fractqqsf _fractuqqsf \
78 _fracthqsf _fractuhqsf _fracthasf _fractuhasf \
79 _fractsasf _fractusasf _fractsqsf _fractusqsf \
81 _fractsfqq _fractsfuqq \
82 _fractsfhq _fractsfuhq _fractsfha _fractsfuha \
83 _fractsfsq _fractsfusq _fractsfsa _fractsfusa \
86 _mulha3 _muluha3 _muluha3_round \
88 _usmuluha3 _ssmulha3 \
89 _usmulusa3 _ssmulsa3 \
90 _divqq3 _udivuqq3 _divqq_helper \
95 _ssneg_2 _ssneg_4 _ssneg_8 \
96 _ssabs_1 _ssabs_2 _ssabs_4 _ssabs_8 \
100 _roundqq3 _rounduqq3 \
101 _round_s2 _round_u2 _round_2_const _addmask_2 \
102 _round_s4 _round_u4 _round_4_const _addmask_4 \
104 _rounddq3 _roundudq3 \
105 _roundda3 _rounduda3 \
109 LIB2FUNCS_EXCLUDE = \
115 ifeq ($(long_double_type_size),32)
116 # We do not have the DFtype.
117 HOST_LIBGCC2_CFLAGS += -DDF=SF
120 # Most of the C functions in libgcc2 use almost all registers,
121 # so use -mcall-prologues for smaller code size.
122 HOST_LIBGCC2_CFLAGS += -Dinhibit_libc -mcall-prologues -Os
124 # Extra 16-bit integer functions.
125 intfuncs16 = _absvXX2 _addvXX3 _subvXX3 _mulvXX3 _negvXX2 _clrsbXX2
127 hiintfuncs16 = $(subst XX,hi,$(intfuncs16))
128 siintfuncs16 = $(subst XX,si,$(intfuncs16))
130 iter-items := $(hiintfuncs16)
131 iter-labels := $(siintfuncs16)
132 iter-sizes := $(patsubst %,2,$(siintfuncs16)) $(patsubst %,2,$(hiintfuncs16))
135 -include $(patsubst %,$(srcdir)/siditi-object.mk,$(iter-items))
136 libgcc-objects += $(patsubst %,%$(objext),$(hiintfuncs16))
138 ifeq ($(enable_shared),yes)
139 libgcc-s-objects += $(patsubst %,%_s$(objext),$(hiintfuncs16))
144 conv_XY=$(conv)$(mode1)$(mode2)
145 func_X=$(func)$(mode)
147 # Compile C functions from lib2funcs.c and add them to libgcc.a.
149 # Some functions which are not performance.critical are more convenient
150 # to implement in C than in assembler. Most of them serve as implementation
151 # for AVR-specific builtins in the case where the address of a builtin
152 # function is taken or if there is no insn that implements the builtin.
154 # We don't use LIB2ADD because we want to iterate over the source for
155 # different modes, fixed-point suffixes, etc. See iter-labels and L_LABEL.
156 # iter-label will get one more underscore in order to avoid too short
157 # labels like -DLk and we use -DL_k instead.
159 # Build roundFX functions from lib2funcs.c
161 round_suffix := hr r lr uhr ur ulr \
163 round_funcs := $(foreach func,_round,\
164 $(foreach mode,$(round_suffix),$(func_X)))
166 iter-items := $(round_funcs)
167 iter-labels := $(round_suffix)
168 iter-flags := $(patsubst %,-DL_round,$(iter-items))
170 -include $(patsubst %,$(srcdir)/config/avr/lib2-object.mk,$(iter-items))
172 libgcc-objects += $(patsubst %,%$(objext),$(round_funcs))
174 # Build clrsbXX functions from lib2funcs.c
177 clrsb_funcs := $(foreach func,_clrsb,\
178 $(foreach mode,$(clrsb_modes),$(func_X)))
180 iter-items := $(clrsb_funcs)
181 iter-labels := $(clrsb_funcs)
182 iter-flags := $(patsubst %,-DL_clrsb,$(iter-items))
184 -include $(patsubst %,$(srcdir)/config/avr/lib2-object.mk,$(iter-items))
186 libgcc-objects += $(patsubst %,%$(objext),$(clrsb_funcs))
188 # Build signed countlsFX functions from lib2funcs.c
190 countls_modes := qi hi si di
191 countls_funcs := $(foreach func,_countls,\
192 $(foreach mode,$(countls_modes),$(func_X)))
194 iter-items := $(countls_funcs)
195 iter-labels := $(countls_modes)
196 iter-flags := $(patsubst %,-DL_countls,$(iter-items))
198 -include $(patsubst %,$(srcdir)/config/avr/lib2-object.mk,$(iter-items))
200 libgcc-objects += $(patsubst %,%$(objext),$(countls_funcs))
202 # Build unsigned countlsFX functions from lib2funcs.c
204 countlsu_modes := qi hi si di
205 countlsu_funcs := $(foreach func,_countlsu,\
206 $(foreach mode,$(countlsu_modes),$(func_X)))
208 iter-items := $(countlsu_funcs)
209 iter-labels := $(countlsu_modes)
210 iter-flags := $(patsubst %,-DL_countlsu,$(iter-items))
212 -include $(patsubst %,$(srcdir)/config/avr/lib2-object.mk,$(iter-items))
214 libgcc-objects += $(patsubst %,%$(objext),$(countlsu_funcs))
217 # Filter out supported conversions from fixed-bit.c
218 # Also filter out TQ and UTQ.
220 # Conversions supported by the compiler
222 convf_modes = QI UQI QQ UQQ \
223 HI UHI HQ UHQ HA UHA \
224 SI USI SQ USQ SA USA \
225 DI UDI DQ UDQ DA UDA \
228 LIB2FUNCS_EXCLUDE += \
229 $(foreach conv,_fract _fractuns,\
230 $(foreach mode1,$(convf_modes),\
231 $(foreach mode2,$(convf_modes),$(conv_XY))))
233 # Conversions supported by lib1funcs-fixed.S
235 conv_to_sf_modes = QQ UQQ HQ UHQ HA UHA SQ USQ SA USA
236 conv_from_sf_modes = QQ UQQ HQ UHQ HA UHA SA USA
238 LIB2FUNCS_EXCLUDE += \
239 $(foreach conv,_fract, \
240 $(foreach mode1,$(conv_to_sf_modes), \
241 $(foreach mode2,SF,$(conv_XY))))
243 LIB2FUNCS_EXCLUDE += \
244 $(foreach conv,_fract,\
246 $(foreach mode2,$(conv_from_sf_modes),$(conv_XY))))
248 # Arithmetik supported by the compiler
250 allfix_modes = QQ UQQ HQ UHQ HA UHA SQ USQ SA USA DA UDA DQ UDQ TQ UTQ TA UTA
252 LIB2FUNCS_EXCLUDE += \
253 $(foreach func,_add _sub,\
254 $(foreach mode,$(allfix_modes),$(func_X)))
256 LIB2FUNCS_EXCLUDE += \
257 $(foreach func,_lshr _ashl _ashr _cmp,\
258 $(foreach mode,$(allfix_modes),$(func_X)))
261 usat_modes = UQQ UHQ UHA USQ USA UDQ UDA UTQ UTA
262 ssat_modes = QQ HQ HA SQ SA DQ DA TQ TA
264 LIB2FUNCS_EXCLUDE += \
265 $(foreach func,_ssadd _sssub _ssneg _ssabs,\
266 $(foreach mode,$(ssat_modes),$(func_X)))
268 LIB2FUNCS_EXCLUDE += \
269 $(foreach func,_usadd _ussub _usneg,\
270 $(foreach mode,$(usat_modes),$(func_X)))
273 smul_modes = QQ HQ HA SA
274 umul_modes = UQQ UHQ UHA USA
275 sdiv_modes = QQ HQ HA SA
276 udiv_modes = UQQ UHQ UHA USA
278 LIB2FUNCS_EXCLUDE += \
279 $(foreach func,_mul,\
280 $(foreach mode,$(smul_modes) $(umul_modes),$(func_X)))
282 LIB2FUNCS_EXCLUDE += \
283 $(foreach func,_div,\
284 $(foreach mode,$(sdiv_modes) $(udiv_modes),$(func_X)))
288 usmul_modes = UHA USA
290 LIB2FUNCS_EXCLUDE += \
291 $(foreach func,_usmul,\
292 $(foreach mode,$(usmul_modes),$(func_X)))
294 LIB2FUNCS_EXCLUDE += \
295 $(foreach func,_ssmul,\
296 $(foreach mode,$(ssmul_modes),$(func_X)))