1 LIB1ASMSRC = avr/lib1funcs.S
17 _divmodpsi4 _udivmodpsi4 \
31 _xload_1 _xload_2 _xload_3 _xload_4 \
54 _ashldi3 _ashrdi3 _lshrdi3 _rotldi3 \
55 _adddi3 _adddi3_s8 _subdi3 \
59 # Fixed point routines in avr/lib1funcs-fixed.S
61 _fractqqsf _fractuqqsf \
62 _fracthqsf _fractuhqsf _fracthasf _fractuhasf \
63 _fractsasf _fractusasf _fractsqsf _fractusqsf \
65 _fractsfqq _fractsfuqq \
66 _fractsfhq _fractsfuhq _fractsfha _fractsfuha \
67 _fractsfsq _fractsfusq _fractsfsa _fractsfusa \
70 _mulha3 _muluha3 _muluha3_round \
72 _divqq3 _udivuqq3 _divqq_helper \
77 _ssneg_2 _ssneg_4 _ssneg_8 \
78 _ssabs_1 _ssabs_2 _ssabs_4 _ssabs_8 \
82 _roundqq3 _rounduqq3 \
83 _round_s2 _round_u2 _round_2_const _addmask_2 \
84 _round_s4 _round_u4 _round_4_const _addmask_4 \
86 _rounddq3 _roundudq3 \
87 _roundda3 _rounduda3 \
88 _roundta3 _rounduta3 \
97 # We do not have the DF type.
98 # Most of the C functions in libgcc2 use almost all registers,
99 # so use -mcall-prologues for smaller code size.
100 HOST_LIBGCC2_CFLAGS += -DDF=SF -Dinhibit_libc -mcall-prologues -Os
102 # Extra 16-bit integer functions.
103 intfuncs16 = _absvXX2 _addvXX3 _subvXX3 _mulvXX3 _negvXX2 _clrsbXX2
105 hiintfuncs16 = $(subst XX,hi,$(intfuncs16))
106 siintfuncs16 = $(subst XX,si,$(intfuncs16))
108 iter-items := $(hiintfuncs16)
109 iter-labels := $(siintfuncs16)
110 iter-sizes := $(patsubst %,2,$(siintfuncs16)) $(patsubst %,2,$(hiintfuncs16))
113 include $(srcdir)/empty.mk $(patsubst %,$(srcdir)/siditi-object.mk,$(iter-items))
114 libgcc-objects += $(patsubst %,%$(objext),$(hiintfuncs16))
116 ifeq ($(enable_shared),yes)
117 libgcc-s-objects += $(patsubst %,%_s$(objext),$(hiintfuncs16))
122 conv_XY=$(conv)$(mode1)$(mode2)
123 func_X=$(func)$(mode)
125 # Compile C functions from lib2funcs.c and add them to libgcc.a.
127 # Some functions which are not performance.critical are more convenient
128 # to implement in C than in assembler. Most of them serve as implementation
129 # for AVR-specific builtins in the case where the address of a builtin
130 # function is taken or if there is no insn that implements the builtin.
132 # We don't use LIB2ADD because we want to iterate over the source for
133 # different modes, fixed-point suffixes, etc. See iter-labels and L_LABEL.
134 # iter-label will get one more underscore in order to avoid too short
135 # labels like -DLk and we use -DL_k instead.
137 # Build roundFX functions from lib2funcs.c
139 round_suffix := hr r lr uhr ur ulr \
141 round_funcs := $(foreach func,_round,\
142 $(foreach mode,$(round_suffix),$(func_X)))
144 iter-items := $(round_funcs)
145 iter-labels := $(round_suffix)
146 iter-flags := $(patsubst %,-DL_round,$(iter-items))
148 include $(srcdir)/empty.mk $(patsubst %,$(srcdir)/config/avr/lib2-object.mk,$(iter-items))
150 libgcc-objects += $(patsubst %,%$(objext),$(round_funcs))
152 # Build clrsbXX functions from lib2funcs.c
155 clrsb_funcs := $(foreach func,_clrsb,\
156 $(foreach mode,$(clrsb_modes),$(func_X)))
158 iter-items := $(clrsb_funcs)
159 iter-labels := $(clrsb_funcs)
160 iter-flags := $(patsubst %,-DL_clrsb,$(iter-items))
162 include $(srcdir)/empty.mk $(patsubst %,$(srcdir)/config/avr/lib2-object.mk,$(iter-items))
164 libgcc-objects += $(patsubst %,%$(objext),$(clrsb_funcs))
166 # Build signed countlsFX functions from lib2funcs.c
168 countls_modes := qi hi si di
169 countls_funcs := $(foreach func,_countls,\
170 $(foreach mode,$(countls_modes),$(func_X)))
172 iter-items := $(countls_funcs)
173 iter-labels := $(countls_modes)
174 iter-flags := $(patsubst %,-DL_countls,$(iter-items))
176 include $(srcdir)/empty.mk $(patsubst %,$(srcdir)/config/avr/lib2-object.mk,$(iter-items))
178 libgcc-objects += $(patsubst %,%$(objext),$(countls_funcs))
180 # Build unsigned countlsFX functions from lib2funcs.c
182 countlsu_modes := qi hi si di
183 countlsu_funcs := $(foreach func,_countlsu,\
184 $(foreach mode,$(countlsu_modes),$(func_X)))
186 iter-items := $(countlsu_funcs)
187 iter-labels := $(countlsu_modes)
188 iter-flags := $(patsubst %,-DL_countlsu,$(iter-items))
190 include $(srcdir)/empty.mk $(patsubst %,$(srcdir)/config/avr/lib2-object.mk,$(iter-items))
192 libgcc-objects += $(patsubst %,%$(objext),$(countlsu_funcs))
195 # Filter out supported conversions from fixed-bit.c
196 # Also filter out TQ and UTQ.
198 # Conversions supported by the compiler
200 convf_modes = QI UQI QQ UQQ \
201 HI UHI HQ UHQ HA UHA \
202 SI USI SQ USQ SA USA \
203 DI UDI DQ UDQ DA UDA \
206 LIB2FUNCS_EXCLUDE += \
207 $(foreach conv,_fract _fractuns,\
208 $(foreach mode1,$(convf_modes),\
209 $(foreach mode2,$(convf_modes),$(conv_XY))))
211 # Conversions supported by lib1funcs-fixed.S
213 conv_to_sf_modes = QQ UQQ HQ UHQ HA UHA SQ USQ SA USA
214 conv_from_sf_modes = QQ UQQ HQ UHQ HA UHA SA USA
216 LIB2FUNCS_EXCLUDE += \
217 $(foreach conv,_fract, \
218 $(foreach mode1,$(conv_to_sf_modes), \
219 $(foreach mode2,SF,$(conv_XY))))
221 LIB2FUNCS_EXCLUDE += \
222 $(foreach conv,_fract,\
224 $(foreach mode2,$(conv_from_sf_modes),$(conv_XY))))
226 # Arithmetik supported by the compiler
228 allfix_modes = QQ UQQ HQ UHQ HA UHA SQ USQ SA USA DA UDA DQ UDQ TQ UTQ TA UTA
230 LIB2FUNCS_EXCLUDE += \
231 $(foreach func,_add _sub,\
232 $(foreach mode,$(allfix_modes),$(func_X)))
234 LIB2FUNCS_EXCLUDE += \
235 $(foreach func,_lshr _ashl _ashr _cmp,\
236 $(foreach mode,$(allfix_modes),$(func_X)))
239 usat_modes = UQQ UHQ UHA USQ USA UDQ UDA UTQ UTA
240 ssat_modes = QQ HQ HA SQ SA DQ DA TQ TA
242 LIB2FUNCS_EXCLUDE += \
243 $(foreach func,_ssadd _sssub _ssneg _ssabs,\
244 $(foreach mode,$(ssat_modes),$(func_X)))
246 LIB2FUNCS_EXCLUDE += \
247 $(foreach func,_usadd _ussub _usneg,\
248 $(foreach mode,$(usat_modes),$(func_X)))
251 smul_modes = QQ HQ HA SA
252 umul_modes = UQQ UHQ UHA USA
253 sdiv_modes = QQ HQ HA SA
254 udiv_modes = UQQ UHQ UHA USA
256 LIB2FUNCS_EXCLUDE += \
257 $(foreach func,_mul,\
258 $(foreach mode,$(smul_modes) $(umul_modes),$(func_X)))
260 LIB2FUNCS_EXCLUDE += \
261 $(foreach func,_div,\
262 $(foreach mode,$(sdiv_modes) $(udiv_modes),$(func_X)))