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