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 \
75 # Fixed point routines in avr/lib1funcs-fixed.S
76 ifneq ($(MULTIFLAGS),-mmcu=avrtiny)
78 _fractqqsf _fractuqqsf \
79 _fracthqsf _fractuhqsf _fracthasf _fractuhasf \
80 _fractsasf _fractusasf _fractsqsf _fractusqsf \
82 _fractsfqq _fractsfuqq \
83 _fractsfhq _fractsfuhq _fractsfha _fractsfuha \
84 _fractsfsq _fractsfusq _fractsfsa _fractsfusa \
87 _mulha3 _muluha3 _muluha3_round \
89 _usmuluha3 _ssmulha3 \
90 _usmulusa3 _ssmulsa3 \
91 _divqq3 _udivuqq3 _divqq_helper \
96 _ssneg_2 _ssneg_4 _ssneg_8 \
97 _ssabs_1 _ssabs_2 _ssabs_4 _ssabs_8 \
101 _roundqq3 _rounduqq3 \
102 _round_s2 _round_u2 _round_2_const _addmask_2 \
103 _round_s4 _round_u4 _round_4_const _addmask_4 \
105 _rounddq3 _roundudq3 \
106 _roundda3 _rounduda3 \
110 LIB2FUNCS_EXCLUDE = \
117 ifeq ($(long_double_type_size),32)
118 # We do not have the DFtype.
119 HOST_LIBGCC2_CFLAGS += -DDF=SF
122 # Most of the C functions in libgcc2 use almost all registers,
123 # so use -mcall-prologues for smaller code size.
124 HOST_LIBGCC2_CFLAGS += -Dinhibit_libc -mcall-prologues -Os
126 # Extra 16-bit integer functions.
127 intfuncs16 = _absvXX2 _addvXX3 _subvXX3 _mulvXX3 _negvXX2 _clrsbXX2
129 hiintfuncs16 = $(subst XX,hi,$(intfuncs16))
130 siintfuncs16 = $(subst XX,si,$(intfuncs16))
132 iter-items := $(hiintfuncs16)
133 iter-labels := $(siintfuncs16)
134 iter-sizes := $(patsubst %,2,$(siintfuncs16)) $(patsubst %,2,$(hiintfuncs16))
137 -include $(patsubst %,$(srcdir)/siditi-object.mk,$(iter-items))
138 libgcc-objects += $(patsubst %,%$(objext),$(hiintfuncs16))
140 ifeq ($(enable_shared),yes)
141 libgcc-s-objects += $(patsubst %,%_s$(objext),$(hiintfuncs16))
146 conv_XY=$(conv)$(mode1)$(mode2)
147 func_X=$(func)$(mode)
149 # Compile C functions from lib2funcs.c and add them to libgcc.a.
151 # Some functions which are not performance.critical are more convenient
152 # to implement in C than in assembler. Most of them serve as implementation
153 # for AVR-specific builtins in the case where the address of a builtin
154 # function is taken or if there is no insn that implements the builtin.
156 # We don't use LIB2ADD because we want to iterate over the source for
157 # different modes, fixed-point suffixes, etc. See iter-labels and L_LABEL.
158 # iter-label will get one more underscore in order to avoid too short
159 # labels like -DLk and we use -DL_k instead.
161 # Build roundFX functions from lib2funcs.c
163 round_suffix := hr r lr uhr ur ulr \
165 round_funcs := $(foreach func,_round,\
166 $(foreach mode,$(round_suffix),$(func_X)))
168 iter-items := $(round_funcs)
169 iter-labels := $(round_suffix)
170 iter-flags := $(patsubst %,-DL_round,$(iter-items))
172 -include $(patsubst %,$(srcdir)/config/avr/lib2-object.mk,$(iter-items))
174 libgcc-objects += $(patsubst %,%$(objext),$(round_funcs))
176 # Build clrsbXX functions from lib2funcs.c
179 clrsb_funcs := $(foreach func,_clrsb,\
180 $(foreach mode,$(clrsb_modes),$(func_X)))
182 iter-items := $(clrsb_funcs)
183 iter-labels := $(clrsb_funcs)
184 iter-flags := $(patsubst %,-DL_clrsb,$(iter-items))
186 -include $(patsubst %,$(srcdir)/config/avr/lib2-object.mk,$(iter-items))
188 libgcc-objects += $(patsubst %,%$(objext),$(clrsb_funcs))
190 # Build signed countlsFX functions from lib2funcs.c
192 countls_modes := qi hi si di
193 countls_funcs := $(foreach func,_countls,\
194 $(foreach mode,$(countls_modes),$(func_X)))
196 iter-items := $(countls_funcs)
197 iter-labels := $(countls_modes)
198 iter-flags := $(patsubst %,-DL_countls,$(iter-items))
200 -include $(patsubst %,$(srcdir)/config/avr/lib2-object.mk,$(iter-items))
202 libgcc-objects += $(patsubst %,%$(objext),$(countls_funcs))
204 # Build unsigned countlsFX functions from lib2funcs.c
206 countlsu_modes := qi hi si di
207 countlsu_funcs := $(foreach func,_countlsu,\
208 $(foreach mode,$(countlsu_modes),$(func_X)))
210 iter-items := $(countlsu_funcs)
211 iter-labels := $(countlsu_modes)
212 iter-flags := $(patsubst %,-DL_countlsu,$(iter-items))
214 -include $(patsubst %,$(srcdir)/config/avr/lib2-object.mk,$(iter-items))
216 libgcc-objects += $(patsubst %,%$(objext),$(countlsu_funcs))
219 # Filter out supported conversions from fixed-bit.c
220 # Also filter out TQ and UTQ.
222 # Conversions supported by the compiler
224 convf_modes = QI UQI QQ UQQ \
225 HI UHI HQ UHQ HA UHA \
226 SI USI SQ USQ SA USA \
227 DI UDI DQ UDQ DA UDA \
230 LIB2FUNCS_EXCLUDE += \
231 $(foreach conv,_fract _fractuns,\
232 $(foreach mode1,$(convf_modes),\
233 $(foreach mode2,$(convf_modes),$(conv_XY))))
235 # Conversions supported by lib1funcs-fixed.S
237 conv_to_sf_modes = QQ UQQ HQ UHQ HA UHA SQ USQ SA USA
238 conv_from_sf_modes = QQ UQQ HQ UHQ HA UHA SA USA
240 LIB2FUNCS_EXCLUDE += \
241 $(foreach conv,_fract, \
242 $(foreach mode1,$(conv_to_sf_modes), \
243 $(foreach mode2,SF,$(conv_XY))))
245 LIB2FUNCS_EXCLUDE += \
246 $(foreach conv,_fract,\
248 $(foreach mode2,$(conv_from_sf_modes),$(conv_XY))))
250 # Arithmetik supported by the compiler
252 allfix_modes = QQ UQQ HQ UHQ HA UHA SQ USQ SA USA DA UDA DQ UDQ TQ UTQ TA UTA
254 LIB2FUNCS_EXCLUDE += \
255 $(foreach func,_add _sub,\
256 $(foreach mode,$(allfix_modes),$(func_X)))
258 LIB2FUNCS_EXCLUDE += \
259 $(foreach func,_lshr _ashl _ashr _cmp,\
260 $(foreach mode,$(allfix_modes),$(func_X)))
263 usat_modes = UQQ UHQ UHA USQ USA UDQ UDA UTQ UTA
264 ssat_modes = QQ HQ HA SQ SA DQ DA TQ TA
266 LIB2FUNCS_EXCLUDE += \
267 $(foreach func,_ssadd _sssub _ssneg _ssabs,\
268 $(foreach mode,$(ssat_modes),$(func_X)))
270 LIB2FUNCS_EXCLUDE += \
271 $(foreach func,_usadd _ussub _usneg,\
272 $(foreach mode,$(usat_modes),$(func_X)))
275 smul_modes = QQ HQ HA SA
276 umul_modes = UQQ UHQ UHA USA
277 sdiv_modes = QQ HQ HA SA
278 udiv_modes = UQQ UHQ UHA USA
280 LIB2FUNCS_EXCLUDE += \
281 $(foreach func,_mul,\
282 $(foreach mode,$(smul_modes) $(umul_modes),$(func_X)))
284 LIB2FUNCS_EXCLUDE += \
285 $(foreach func,_div,\
286 $(foreach mode,$(sdiv_modes) $(udiv_modes),$(func_X)))
290 usmul_modes = UHA USA
292 LIB2FUNCS_EXCLUDE += \
293 $(foreach func,_usmul,\
294 $(foreach mode,$(usmul_modes),$(func_X)))
296 LIB2FUNCS_EXCLUDE += \
297 $(foreach func,_ssmul,\
298 $(foreach mode,$(ssmul_modes),$(func_X)))