| 1 |
LIB1ASMSRC = avr/lib1funcs.S |
| 2 |
LIB1ASMFUNCS = \ |
| 3 |
_mulqi3 \ |
| 4 |
_mulhi3 \ |
| 5 |
_mulqihi3 _umulqihi3 \ |
| 6 |
_mulpsi3 \ |
| 7 |
_mulhisi3 _umulhisi3 \ |
| 8 |
_mulsi3 \ |
| 9 |
_udivmodqi4 \ |
| 10 |
_divmodqi4 \ |
| 11 |
_udivmodhi4 \ |
| 12 |
_divmodhi4 \ |
| 13 |
_divmodpsi4 _udivmodpsi4 \ |
| 14 |
_udivmodsi4 \ |
| 15 |
_divmodsi4 \ |
| 16 |
_negsi2 \ |
| 17 |
_exit \ |
| 18 |
_cleanup \ |
| 19 |
_tablejump2 \ |
| 20 |
_copy_data \ |
| 21 |
_clear_bss \ |
| 22 |
_ctors \ |
| 23 |
_dtors \ |
| 24 |
_ffssi2 \ |
| 25 |
_ffshi2 \ |
| 26 |
_loop_ffsqi2 \ |
| 27 |
_ctzsi2 \ |
| 28 |
_ctzhi2 \ |
| 29 |
_clzsi2 \ |
| 30 |
_clzhi2 \ |
| 31 |
_paritysi2 \ |
| 32 |
_parityhi2 \ |
| 33 |
_popcounthi2 \ |
| 34 |
_popcountsi2 \ |
| 35 |
_popcountqi2 \ |
| 36 |
_bswapsi2 \ |
| 37 |
_fmul _fmuls _fmulsu \ |
| 38 |
_mulqq3 \ |
| 39 |
_mulhq3 _muluhq3 \ |
| 40 |
_mulha3 _muluha3 _muluha3_round \ |
| 41 |
_usmuluha3 _ssmulha3 \ |
| 42 |
_divqq3 _udivuqq3 _divqq_helper \ |
| 43 |
_divhq3 _udivuhq3 \ |
| 44 |
_divha3 _udivuha3 \ |
| 45 |
_ssneg_2 \ |
| 46 |
_ssabs_1 _ssabs_2 \ |
| 47 |
_mask1 _ret \ |
| 48 |
_roundqq3 _rounduqq3 \ |
| 49 |
_round_s2 _round_u2 _round_2_const _addmask_2 \ |
| 50 |
|
| 51 |
# The below functions either use registers that are not present |
| 52 |
# in tiny core, or use a different register convention (don't save |
| 53 |
# callee saved regs, for example) |
| 54 |
# All *di funcs - use regs < R16 or expect args in regs < R20 |
| 55 |
# _prologue and _epilogue save registers < R16 |
| 56 |
# _load, __fload and _xload variations - expect lpm and elpm support |
| 57 |
# _movmemx and _movmemf - expect elpm/lpm |
| 58 |
|
| 59 |
FUNCS_notiny = \ |
| 60 |
_mulsqipsi3 \ |
| 61 |
_usmulhisi3 \ |
| 62 |
_muluhisi3 \ |
| 63 |
_mulshisi3 \ |
| 64 |
_muldi3 _muldi3_6 \ |
| 65 |
_mulsidi3 _umulsidi3 \ |
| 66 |
_divdi3 _udivdi3 \ |
| 67 |
_udivmod64 \ |
| 68 |
_negdi2 \ |
| 69 |
_prologue \ |
| 70 |
_epilogue \ |
| 71 |
_load_3 _load_4 \ |
| 72 |
_xload_1 _xload_2 _xload_3 _xload_4 \ |
| 73 |
_fload_1 _fload_2 _fload_3 _fload_4 \ |
| 74 |
_movmemx _movmemf \ |
| 75 |
_strlen_memx \ |
| 76 |
_clzdi2 \ |
| 77 |
_paritydi2 \ |
| 78 |
_popcountdi2 \ |
| 79 |
_bswapdi2 \ |
| 80 |
_ashldi3 _ashrdi3 _lshrdi3 _rotldi3 \ |
| 81 |
_adddi3 _adddi3_s8 _subdi3 \ |
| 82 |
_cmpdi2 _cmpdi2_s8 \ |
| 83 |
_powif |
| 84 |
|
| 85 |
# Fixed point routines in avr/lib1funcs-fixed.S |
| 86 |
FUNCS_notiny += \ |
| 87 |
_fractqqsf _fractuqqsf \ |
| 88 |
_fracthqsf _fractuhqsf _fracthasf _fractuhasf \ |
| 89 |
_fractsasf _fractusasf _fractsqsf _fractusqsf \ |
| 90 |
\ |
| 91 |
_fractsfqq _fractsfuqq \ |
| 92 |
_fractsfhq _fractsfuhq _fractsfha _fractsfuha \ |
| 93 |
_fractsfsq _fractsfusq _fractsfsa _fractsfusa \ |
| 94 |
_mulsa3 _mulusa3 \ |
| 95 |
_usmulusa3 _ssmulsa3 \ |
| 96 |
_divsa3 _udivusa3 \ |
| 97 |
_clr_8 \ |
| 98 |
_ssneg_4 _ssneg_8 \ |
| 99 |
_ssabs_4 _ssabs_8 \ |
| 100 |
_ssadd_8 _sssub_8 \ |
| 101 |
_usadd_8 _ussub_8 \ |
| 102 |
_round_s4 _round_u4 _round_4_const _addmask_4 \ |
| 103 |
_round_x8 \ |
| 104 |
_rounddq3 _roundudq3 \ |
| 105 |
_roundda3 _rounduda3 \ |
| 106 |
_roundta3 _rounduta3 |
| 107 |
|
| 108 |
ifeq (,$(findstring avrtiny,$(MULTIDIR))) |
| 109 |
LIB1ASMFUNCS += $(FUNCS_notiny) |
| 110 |
endif |
| 111 |
|
| 112 |
LIB2FUNCS_EXCLUDE = \ |
| 113 |
_moddi3 _umoddi3 \ |
| 114 |
_clz \ |
| 115 |
_clrsbdi2 \ |
| 116 |
_powisf2 |
| 117 |
|
| 118 |
ifneq (,$(findstring avrtiny,$(MULTIDIR))) |
| 119 |
LIB2FUNCS_EXCLUDE += $(FUNCS_notiny) |
| 120 |
endif |
| 121 |
|
| 122 |
ifeq ($(long_double_type_size),32) |
| 123 |
# We do not have the DFtype. |
| 124 |
HOST_LIBGCC2_CFLAGS += -DDF=SF |
| 125 |
endif |
| 126 |
|
| 127 |
# Most of the C functions in libgcc2 use almost all registers, |
| 128 |
# so use -mcall-prologues for smaller code size. |
| 129 |
HOST_LIBGCC2_CFLAGS += -Dinhibit_libc -mcall-prologues -Os |
| 130 |
|
| 131 |
# Extra 16-bit integer functions. |
| 132 |
intfuncs16 = _absvXX2 _addvXX3 _subvXX3 _mulvXX3 _negvXX2 _clrsbXX2 |
| 133 |
|
| 134 |
hiintfuncs16 = $(subst XX,hi,$(intfuncs16)) |
| 135 |
siintfuncs16 = $(subst XX,si,$(intfuncs16)) |
| 136 |
|
| 137 |
iter-items := $(hiintfuncs16) |
| 138 |
iter-labels := $(siintfuncs16) |
| 139 |
iter-sizes := $(patsubst %,2,$(siintfuncs16)) $(patsubst %,2,$(hiintfuncs16)) |
| 140 |
|
| 141 |
|
| 142 |
-include $(patsubst %,$(srcdir)/siditi-object.mk,$(iter-items)) |
| 143 |
libgcc-objects += $(patsubst %,%$(objext),$(hiintfuncs16)) |
| 144 |
|
| 145 |
ifeq ($(enable_shared),yes) |
| 146 |
libgcc-s-objects += $(patsubst %,%_s$(objext),$(hiintfuncs16)) |
| 147 |
endif |
| 148 |
|
| 149 |
### |
| 150 |
|
| 151 |
conv_XY=$(conv)$(mode1)$(mode2) |
| 152 |
func_X=$(func)$(mode) |
| 153 |
|
| 154 |
# Compile C functions from lib2funcs.c and add them to libgcc.a. |
| 155 |
# |
| 156 |
# Some functions which are not performance.critical are more convenient |
| 157 |
# to implement in C than in assembler. Most of them serve as implementation |
| 158 |
# for AVR-specific builtins in the case where the address of a builtin |
| 159 |
# function is taken or if there is no insn that implements the builtin. |
| 160 |
# |
| 161 |
# We don't use LIB2ADD because we want to iterate over the source for |
| 162 |
# different modes, fixed-point suffixes, etc. See iter-labels and L_LABEL. |
| 163 |
# iter-label will get one more underscore in order to avoid too short |
| 164 |
# labels like -DLk and we use -DL_k instead. |
| 165 |
|
| 166 |
# Build roundFX functions from lib2funcs.c |
| 167 |
|
| 168 |
round_suffix := hr r lr uhr ur ulr \ |
| 169 |
hk k uhk uk |
| 170 |
round_funcs := $(foreach func,_round,\ |
| 171 |
$(foreach mode,$(round_suffix),$(func_X))) |
| 172 |
|
| 173 |
iter-items := $(round_funcs) |
| 174 |
iter-labels := $(round_suffix) |
| 175 |
iter-flags := $(patsubst %,-DL_round,$(iter-items)) |
| 176 |
|
| 177 |
-include $(patsubst %,$(srcdir)/config/avr/lib2-object.mk,$(iter-items)) |
| 178 |
|
| 179 |
libgcc-objects += $(patsubst %,%$(objext),$(round_funcs)) |
| 180 |
|
| 181 |
# Build clrsbXX functions from lib2funcs.c |
| 182 |
|
| 183 |
clrsb_modes := qi di |
| 184 |
clrsb_funcs := $(foreach func,_clrsb,\ |
| 185 |
$(foreach mode,$(clrsb_modes),$(func_X))) |
| 186 |
|
| 187 |
iter-items := $(clrsb_funcs) |
| 188 |
iter-labels := $(clrsb_funcs) |
| 189 |
iter-flags := $(patsubst %,-DL_clrsb,$(iter-items)) |
| 190 |
|
| 191 |
-include $(patsubst %,$(srcdir)/config/avr/lib2-object.mk,$(iter-items)) |
| 192 |
|
| 193 |
libgcc-objects += $(patsubst %,%$(objext),$(clrsb_funcs)) |
| 194 |
|
| 195 |
# Build signed countlsFX functions from lib2funcs.c |
| 196 |
|
| 197 |
countls_modes := qi hi si di |
| 198 |
countls_funcs := $(foreach func,_countls,\ |
| 199 |
$(foreach mode,$(countls_modes),$(func_X))) |
| 200 |
|
| 201 |
iter-items := $(countls_funcs) |
| 202 |
iter-labels := $(countls_modes) |
| 203 |
iter-flags := $(patsubst %,-DL_countls,$(iter-items)) |
| 204 |
|
| 205 |
-include $(patsubst %,$(srcdir)/config/avr/lib2-object.mk,$(iter-items)) |
| 206 |
|
| 207 |
libgcc-objects += $(patsubst %,%$(objext),$(countls_funcs)) |
| 208 |
|
| 209 |
# Build unsigned countlsFX functions from lib2funcs.c |
| 210 |
|
| 211 |
countlsu_modes := qi hi si di |
| 212 |
countlsu_funcs := $(foreach func,_countlsu,\ |
| 213 |
$(foreach mode,$(countlsu_modes),$(func_X))) |
| 214 |
|
| 215 |
iter-items := $(countlsu_funcs) |
| 216 |
iter-labels := $(countlsu_modes) |
| 217 |
iter-flags := $(patsubst %,-DL_countlsu,$(iter-items)) |
| 218 |
|
| 219 |
-include $(patsubst %,$(srcdir)/config/avr/lib2-object.mk,$(iter-items)) |
| 220 |
|
| 221 |
libgcc-objects += $(patsubst %,%$(objext),$(countlsu_funcs)) |
| 222 |
|
| 223 |
|
| 224 |
# Filter out supported conversions from fixed-bit.c |
| 225 |
# Also filter out TQ and UTQ. |
| 226 |
|
| 227 |
# Conversions supported by the compiler |
| 228 |
|
| 229 |
convf_modes = QI UQI QQ UQQ \ |
| 230 |
HI UHI HQ UHQ HA UHA \ |
| 231 |
SI USI SQ USQ SA USA \ |
| 232 |
DI UDI DQ UDQ DA UDA \ |
| 233 |
TI UTI TQ UTQ TA UTA |
| 234 |
|
| 235 |
LIB2FUNCS_EXCLUDE += \ |
| 236 |
$(foreach conv,_fract _fractuns,\ |
| 237 |
$(foreach mode1,$(convf_modes),\ |
| 238 |
$(foreach mode2,$(convf_modes),$(conv_XY)))) |
| 239 |
|
| 240 |
# Conversions supported by lib1funcs-fixed.S |
| 241 |
|
| 242 |
conv_to_sf_modes = QQ UQQ HQ UHQ HA UHA SQ USQ SA USA |
| 243 |
conv_from_sf_modes = QQ UQQ HQ UHQ HA UHA SA USA |
| 244 |
|
| 245 |
LIB2FUNCS_EXCLUDE += \ |
| 246 |
$(foreach conv,_fract, \ |
| 247 |
$(foreach mode1,$(conv_to_sf_modes), \ |
| 248 |
$(foreach mode2,SF,$(conv_XY)))) |
| 249 |
|
| 250 |
LIB2FUNCS_EXCLUDE += \ |
| 251 |
$(foreach conv,_fract,\ |
| 252 |
$(foreach mode1,SF,\ |
| 253 |
$(foreach mode2,$(conv_from_sf_modes),$(conv_XY)))) |
| 254 |
|
| 255 |
# Arithmetik supported by the compiler |
| 256 |
|
| 257 |
allfix_modes = QQ UQQ HQ UHQ HA UHA SQ USQ SA USA DA UDA DQ UDQ TQ UTQ TA UTA |
| 258 |
|
| 259 |
LIB2FUNCS_EXCLUDE += \ |
| 260 |
$(foreach func,_add _sub,\ |
| 261 |
$(foreach mode,$(allfix_modes),$(func_X))) |
| 262 |
|
| 263 |
LIB2FUNCS_EXCLUDE += \ |
| 264 |
$(foreach func,_lshr _ashl _ashr _cmp,\ |
| 265 |
$(foreach mode,$(allfix_modes),$(func_X))) |
| 266 |
|
| 267 |
|
| 268 |
usat_modes = UQQ UHQ UHA USQ USA UDQ UDA UTQ UTA |
| 269 |
ssat_modes = QQ HQ HA SQ SA DQ DA TQ TA |
| 270 |
|
| 271 |
LIB2FUNCS_EXCLUDE += \ |
| 272 |
$(foreach func,_ssadd _sssub _ssneg _ssabs,\ |
| 273 |
$(foreach mode,$(ssat_modes),$(func_X))) |
| 274 |
|
| 275 |
LIB2FUNCS_EXCLUDE += \ |
| 276 |
$(foreach func,_usadd _ussub _usneg,\ |
| 277 |
$(foreach mode,$(usat_modes),$(func_X))) |
| 278 |
|
| 279 |
|
| 280 |
smul_modes = QQ HQ HA SA |
| 281 |
umul_modes = UQQ UHQ UHA USA |
| 282 |
sdiv_modes = QQ HQ HA SA |
| 283 |
udiv_modes = UQQ UHQ UHA USA |
| 284 |
|
| 285 |
LIB2FUNCS_EXCLUDE += \ |
| 286 |
$(foreach func,_mul,\ |
| 287 |
$(foreach mode,$(smul_modes) $(umul_modes),$(func_X))) |
| 288 |
|
| 289 |
LIB2FUNCS_EXCLUDE += \ |
| 290 |
$(foreach func,_div,\ |
| 291 |
$(foreach mode,$(sdiv_modes) $(udiv_modes),$(func_X))) |
| 292 |
|
| 293 |
|
| 294 |
ssmul_modes = HA SA |
| 295 |
usmul_modes = UHA USA |
| 296 |
|
| 297 |
LIB2FUNCS_EXCLUDE += \ |
| 298 |
$(foreach func,_usmul,\ |
| 299 |
$(foreach mode,$(usmul_modes),$(func_X))) |
| 300 |
|
| 301 |
LIB2FUNCS_EXCLUDE += \ |
| 302 |
$(foreach func,_ssmul,\ |
| 303 |
$(foreach mode,$(ssmul_modes),$(func_X))) |