c1dd979024
gcc: 2014-10-21 Joern Rennecke <joern.rennecke@embecosm.com> Vidya Praveen <vidya.praveen@atmel.com> Praveen Kumar Kaushik <Praveen_Kumar.Kaushik@atmel.com> Senthil Kumar Selvaraj <Senthil_Kumar.Selvaraj@atmel.com> Pitchumani Sivanupandi <Pitchumani.S@atmel.com> * config/avr/avr-c.c (avr_cpu_cpp_builtins): Don't define __MEMX for avrtiny. * config/avr/avr.c (avr_insert_attributes): Reject __memx for avrtiny. (avr_nonconst_pointer_addrspace): Likewise. * config/avr/avr.h (AVR_HAVE_LPM): Define. Added AVRTINY architecture to avr target. * config/avr/avr-arch.h (avr_arch): Added AVRTINY architecture. (base_arch_s): member added for AVRTINY architecture. * config/avr/avr.c: Added TINY_ADIW, TINY_SBIW macros as AVRTINY alternate for adiw/sbiw instructions. Added AVR_TMP_REGNO and AVR_ZERO_REGNO macros for tmp and zero registers. Replaced TMP_REGNO and ZERO_REGNO occurrences by AVR_TMP_REGNO and AVR_ZERO_REGNO respectively. LAST_CALLEE_SAVED_REG macro added for the last register in callee saved register list. (avr_option_override): CCP address updated for AVRTINY. (avr_init_expanders): tmp and zero rtx initialized as per arch. Reset avr_have_dimode if AVRTINY. (sequent_regs_live): Use LAST_CALLEE_SAVED_REG instead magic number. (emit_push_sfr): Use AVR_TMP_REGNO for tmp register number. (avr_prologue_setup_frame): Don't minimize prologue if AVRTINY. Use LAST_CALLEE_SAVED_REG to refer last callee saved register. (expand_epilogue): Likewise. (avr_print_operand): Print CCP address in case of AVRTINY also. <TBD>bad address (function_arg_regno_p): Check different register list for arguments if AVRTINY. (init_cumulative_args): Check for AVRTINY to update number of argument registers. (tiny_valid_direct_memory_access_range): New function. Return false if direct memory access range is not in accepted range for AVRTINY. (avr_out_movqi_r_mr_reg_disp_tiny): New function to handle register indirect load (with displacement) for AVRTINY. (out_movqi_r_mr): Updated instruction length for AVRTINY. Call avr_out_movqi_r_mr_reg_disp_tiny for load from reg+displacement. (avr_out_movhi_r_mr_reg_no_disp_tiny): New function to handle register indirect load (no displacement) for AVRTINY. (avr_out_movhi_r_mr_reg_disp_tiny): New function to handle register indirect load (with displacement) for AVRTINY. (avr_out_movhi_r_mr_pre_dec_tiny): New function to handle register indirect load for pre-decrement address. (out_movhi_r_mr): In case of AVRTINY, call tiny register indirect load functions. Update instruction length for AVRTINY. (avr_out_movsi_r_mr_reg_no_disp_tiny): New function. Likewise, for SImode. (avr_out_movsi_r_mr_reg_disp_tiny): New function. Likewise, for SImode. (out_movsi_r_mr): Likewise, for SImode. (avr_out_movsi_mr_r_reg_no_disp_tiny): New function to handle register indirect store (no displacement) for AVRTINY. (avr_out_movsi_mr_r_reg_disp_tiny): New function to handle register indirect store (with displacement) for AVRTINY. (out_movsi_mr_r): Emit out insn for IO address store. Update store instruction's size for AVRTINY. For AVRTINY, call tiny SImode indirect store functions. (avr_out_load_psi_reg_no_disp_tiny): New function to handle register indirect load (no displacement) for PSImode in AVRTINY. (avr_out_load_psi_reg_disp_tiny): New function to handle register indirect load (with displacement) for PSImode in AVRTINY. (avr_out_load_psi): Call PSImode register indirect load functions for AVRTINY. Update instruction length for AVRTINY. (avr_out_store_psi_reg_no_disp_tiny): New function to handle register indirect store (no displacement) for PSImode in AVRTINY. (avr_out_store_psi_reg_disp_tiny): New function to handle register indirect store (with displacement) for PSImode in AVRTINY. (avr_out_store_psi): Update instruction length for AVRTINY. Call tiny register indirect store functions for AVRTINY. (avr_out_movqi_mr_r_reg_disp_tiny): New function to handle QImode register indirect store (with displacement) for AVRTINY. (out_movqi_mr_r): Update instruction length for AVRTINY. Call tiny register indirect store function for QImode in AVRTINY. (avr_out_movhi_mr_r_xmega): Update instruction length for AVRTINY. (avr_out_movhi_mr_r_reg_no_disp_tiny): New function to handle register indirect store (no displacement) for HImode in AVRTINY. (avr_out_movhi_mr_r_reg_disp_tiny): New function to handle register indirect store (with displacement) for HImode in AVRTINY. (avr_out_movhi_mr_r_post_inc_tiny): New function to handle register indirect store for post-increment address in HImode. (out_movhi_mr_r): Update instruction length for AVRTINY. Call tiny register indirect store function for HImode in AVRTINY. (avr_out_compare): Use TINY_SBIW/ TINY_ADIW in place of sbiw/adiw in case of AVRTINY. (order_regs_for_local_alloc): Updated register allocation order for AVRTINY. (avr_conditional_register_usage): New function. It is a target hook (TARGET_CONDITIONAL_REGISTER_USAGE) function which updates fixed, call used registers list and register allocation order for AVRTINY. (avr_return_in_memory): Update return value size for AVRTINY. * config/avr/avr-c.c (avr_cpu_cpp_builtins): Added builtin macros for AVRTINY arch and tiny program memory base address. * config/avr/avr-devices.c (avr_arch_types): Added AVRTINY arch. (avr_texinfo): Added description for AVRTINY arch. * config/avr/avr.h: Added macro to identify AVRTINY arch. Updated STATIC_CHAIN_REGNUM for AVRTINY. * config/avr/avr-mcus.def: Added AVRTINY arch devices. * config/avr/avr.md: Added constants for tmp/ zero registers in AVRTINY. Attributes for AVRTINY added. (mov<mode>): Move src/ dest address to register if it is not in AVRTINY memory access range. (mov<mode>_insn): Avoid QImode direct load for AVRTINY if address not in AVRTINY memory access range. (*mov<mode>): Likewise for HImode and SImode. (*movsf): Likewise for SFmode. (delay_cycles_2): Updated instructions to be emitted as AVRTINY does not have sbiw. * config/avr/avr-protos.h: Added function prototype for tiny_valid_direct_memory_access_range. * config/avr/avr-tables.opt: Regenerate. * gcc/config/avr/t-multilib: Regenerate. * doc/avr-mmcu.texi: Regenerate. gcc/testsuite: 2014-10-21 Joern Rennecke <joern.rennecke@embecosm.com> * gcc.target/avr/tiny-memx.c: New test. * gcc.target/avr/tiny-caller-save.c: New test. libgcc: 2014-10-21 Joern Rennecke <joern.rennecke@embecosm.com> Vidya Praveen <vidya.praveen@atmel.com> Praveen Kumar Kaushik <Praveen_Kumar.Kaushik@atmel.com> Senthil Kumar Selvaraj <Senthil_Kumar.Selvaraj@atmel.com> Pitchumani Sivanupandi <Pitchumani.S@atmel.com> * config/avr/lib1funcs.S (__do_global_dtors): Go back to descending order. Updated library functions for AVRTINY arch. * config/avr/lib1funcs.S: Updated zero/tmp regs for AVRTINY. Replaced occurrences of r0/r1 with tmp/zero reg macros. Added wsubi/ wadi macros that expands conditionally as sbiw/ adiw or AVRTINY equivalent. Replaced occurrences of sbiw/adiw with wsubi/wadi macors. (__mulsi3_helper): Update stack, preserve callee saved regs and argument from stack. Restore callee save registers. (__mulpsi3): Likewise. (__muldi3, __udivmodsi4, __divmodsi4, __negsi2, __umoddi3, __udivmod64, __moddi3, __adddi3, __adddi3_s8, __subdi3, __cmpdi2, __cmpdi2_s8, __negdi2, __prologue_saves__, __epilogue_restores__): Excluded for AVRTINY. (__tablejump2__): Added lpm equivalent instructions for AVRTINY. (__do_copy_data): Added new definition for AVRTINY. (__do_clear_bss): Replace r17 by r18 to preserve zero reg for AVRTINY. (__load_3, __load_4, __xload_1, __xload_2, __xload_3, __xload_4, __movmemx_qi, __movmemx_hi): Excluded for AVRTINY. * config/avr/lib1funcs-fixed.S: Replaced occurrences of r0/r1 with tmp/zero reg macros. Replaced occurrences of sbiw/adiw with wsubi/wadi macors. * config/avr/t-avr (LIB1ASMFUNCS): Remove unsupported functions for AVRTINY. Fix broken long multiplication on tiny arch. Co-Authored-By: Pitchumani Sivanupandi <pitchumani.s@atmel.com> Co-Authored-By: Praveen Kumar Kaushik <Praveen_Kumar.Kaushik@atmel.com> Co-Authored-By: Senthil Kumar Selvaraj <Senthil_Kumar.Selvaraj@atmel.com> Co-Authored-By: Vidya Praveen <vidya.praveen@atmel.com> From-SVN: r216525
293 lines
7.5 KiB
Plaintext
293 lines
7.5 KiB
Plaintext
LIB1ASMSRC = avr/lib1funcs.S
|
|
LIB1ASMFUNCS = \
|
|
_mulqi3 \
|
|
_mulhi3 \
|
|
_mulqihi3 _umulqihi3 \
|
|
_mulpsi3 \
|
|
_mulsi3 \
|
|
_udivmodqi4 \
|
|
_divmodqi4 \
|
|
_udivmodhi4 \
|
|
_divmodhi4 \
|
|
_divmodpsi4 _udivmodpsi4 \
|
|
_udivmodsi4 \
|
|
_divmodsi4 \
|
|
_negsi2 \
|
|
_exit \
|
|
_cleanup \
|
|
_tablejump2 \
|
|
_copy_data \
|
|
_clear_bss \
|
|
_ctors \
|
|
_dtors \
|
|
_ffssi2 \
|
|
_ffshi2 \
|
|
_loop_ffsqi2 \
|
|
_ctzsi2 \
|
|
_ctzhi2 \
|
|
_clzsi2 \
|
|
_clzhi2 \
|
|
_paritysi2 \
|
|
_parityhi2 \
|
|
_popcounthi2 \
|
|
_popcountsi2 \
|
|
_popcountqi2 \
|
|
_bswapsi2 \
|
|
_fmul _fmuls _fmulsu
|
|
|
|
# The below functions either use registers that are not present
|
|
# in tiny core, or use a different register conventions (don't save
|
|
# callee saved regs, for example)
|
|
# _mulhisi3 and variations - clobber R18, R19
|
|
# All *di funcs - use regs < R16 or expect args in regs < R20
|
|
# _prologue and _epilogue save registers < R16
|
|
# _load ad _xload variations - expect lpm and elpm support
|
|
# _movmemx - expects elpm/lpm
|
|
|
|
ifneq ($(MULTIFLAGS),-mmcu=avrtiny)
|
|
LIB1ASMFUNCS += \
|
|
_mulsqipsi3 \
|
|
_mulhisi3 \
|
|
_umulhisi3 \
|
|
_usmulhisi3 \
|
|
_muluhisi3 \
|
|
_mulshisi3 \
|
|
_muldi3 _muldi3_6 \
|
|
_mulsidi3 _umulsidi3 \
|
|
_divdi3 _udivdi3 \
|
|
_udivmod64 \
|
|
_negdi2 \
|
|
_prologue \
|
|
_epilogue \
|
|
_load_3 _load_4 \
|
|
_xload_1 _xload_2 _xload_3 _xload_4 \
|
|
_movmemx \
|
|
_clzdi2 \
|
|
_paritydi2 \
|
|
_popcountdi2 \
|
|
_bswapdi2 \
|
|
_ashldi3 _ashrdi3 _lshrdi3 _rotldi3 \
|
|
_adddi3 _adddi3_s8 _subdi3 \
|
|
_cmpdi2 _cmpdi2_s8
|
|
endif
|
|
|
|
# Fixed point routines in avr/lib1funcs-fixed.S
|
|
ifneq ($(MULTIFLAGS),-mmcu=avrtiny)
|
|
LIB1ASMFUNCS += \
|
|
_fractqqsf _fractuqqsf \
|
|
_fracthqsf _fractuhqsf _fracthasf _fractuhasf \
|
|
_fractsasf _fractusasf _fractsqsf _fractusqsf \
|
|
\
|
|
_fractsfqq _fractsfuqq \
|
|
_fractsfhq _fractsfuhq _fractsfha _fractsfuha \
|
|
_fractsfsq _fractsfusq _fractsfsa _fractsfusa \
|
|
_mulqq3 \
|
|
_mulhq3 _muluhq3 \
|
|
_mulha3 _muluha3 _muluha3_round \
|
|
_mulsa3 _mulusa3 \
|
|
_usmuluha3 _ssmulha3 \
|
|
_usmulusa3 _ssmulsa3 \
|
|
_divqq3 _udivuqq3 _divqq_helper \
|
|
_divhq3 _udivuhq3 \
|
|
_divha3 _udivuha3 \
|
|
_divsa3 _udivusa3 \
|
|
_clr_8 \
|
|
_ssneg_2 _ssneg_4 _ssneg_8 \
|
|
_ssabs_1 _ssabs_2 _ssabs_4 _ssabs_8 \
|
|
_ssadd_8 _sssub_8 \
|
|
_usadd_8 _ussub_8 \
|
|
_mask1 _ret \
|
|
_roundqq3 _rounduqq3 \
|
|
_round_s2 _round_u2 _round_2_const _addmask_2 \
|
|
_round_s4 _round_u4 _round_4_const _addmask_4 \
|
|
_round_x8 \
|
|
_rounddq3 _roundudq3 \
|
|
_roundda3 _rounduda3 \
|
|
_roundta3 _rounduta3
|
|
endif
|
|
|
|
LIB2FUNCS_EXCLUDE = \
|
|
_moddi3 _umoddi3 \
|
|
_clz \
|
|
_clrsbdi2 \
|
|
|
|
|
|
# We do not have the DF type.
|
|
# Most of the C functions in libgcc2 use almost all registers,
|
|
# so use -mcall-prologues for smaller code size.
|
|
HOST_LIBGCC2_CFLAGS += -DDF=SF -Dinhibit_libc -mcall-prologues -Os
|
|
|
|
# Extra 16-bit integer functions.
|
|
intfuncs16 = _absvXX2 _addvXX3 _subvXX3 _mulvXX3 _negvXX2 _clrsbXX2
|
|
|
|
hiintfuncs16 = $(subst XX,hi,$(intfuncs16))
|
|
siintfuncs16 = $(subst XX,si,$(intfuncs16))
|
|
|
|
iter-items := $(hiintfuncs16)
|
|
iter-labels := $(siintfuncs16)
|
|
iter-sizes := $(patsubst %,2,$(siintfuncs16)) $(patsubst %,2,$(hiintfuncs16))
|
|
|
|
|
|
include $(srcdir)/empty.mk $(patsubst %,$(srcdir)/siditi-object.mk,$(iter-items))
|
|
libgcc-objects += $(patsubst %,%$(objext),$(hiintfuncs16))
|
|
|
|
ifeq ($(enable_shared),yes)
|
|
libgcc-s-objects += $(patsubst %,%_s$(objext),$(hiintfuncs16))
|
|
endif
|
|
|
|
###
|
|
|
|
conv_XY=$(conv)$(mode1)$(mode2)
|
|
func_X=$(func)$(mode)
|
|
|
|
# Compile C functions from lib2funcs.c and add them to libgcc.a.
|
|
#
|
|
# Some functions which are not performance.critical are more convenient
|
|
# to implement in C than in assembler. Most of them serve as implementation
|
|
# for AVR-specific builtins in the case where the address of a builtin
|
|
# function is taken or if there is no insn that implements the builtin.
|
|
#
|
|
# We don't use LIB2ADD because we want to iterate over the source for
|
|
# different modes, fixed-point suffixes, etc. See iter-labels and L_LABEL.
|
|
# iter-label will get one more underscore in order to avoid too short
|
|
# labels like -DLk and we use -DL_k instead.
|
|
|
|
# Build roundFX functions from lib2funcs.c
|
|
|
|
round_suffix := hr r lr uhr ur ulr \
|
|
hk k uhk uk
|
|
round_funcs := $(foreach func,_round,\
|
|
$(foreach mode,$(round_suffix),$(func_X)))
|
|
|
|
iter-items := $(round_funcs)
|
|
iter-labels := $(round_suffix)
|
|
iter-flags := $(patsubst %,-DL_round,$(iter-items))
|
|
|
|
include $(srcdir)/empty.mk $(patsubst %,$(srcdir)/config/avr/lib2-object.mk,$(iter-items))
|
|
|
|
libgcc-objects += $(patsubst %,%$(objext),$(round_funcs))
|
|
|
|
# Build clrsbXX functions from lib2funcs.c
|
|
|
|
clrsb_modes := qi di
|
|
clrsb_funcs := $(foreach func,_clrsb,\
|
|
$(foreach mode,$(clrsb_modes),$(func_X)))
|
|
|
|
iter-items := $(clrsb_funcs)
|
|
iter-labels := $(clrsb_funcs)
|
|
iter-flags := $(patsubst %,-DL_clrsb,$(iter-items))
|
|
|
|
include $(srcdir)/empty.mk $(patsubst %,$(srcdir)/config/avr/lib2-object.mk,$(iter-items))
|
|
|
|
libgcc-objects += $(patsubst %,%$(objext),$(clrsb_funcs))
|
|
|
|
# Build signed countlsFX functions from lib2funcs.c
|
|
|
|
countls_modes := qi hi si di
|
|
countls_funcs := $(foreach func,_countls,\
|
|
$(foreach mode,$(countls_modes),$(func_X)))
|
|
|
|
iter-items := $(countls_funcs)
|
|
iter-labels := $(countls_modes)
|
|
iter-flags := $(patsubst %,-DL_countls,$(iter-items))
|
|
|
|
include $(srcdir)/empty.mk $(patsubst %,$(srcdir)/config/avr/lib2-object.mk,$(iter-items))
|
|
|
|
libgcc-objects += $(patsubst %,%$(objext),$(countls_funcs))
|
|
|
|
# Build unsigned countlsFX functions from lib2funcs.c
|
|
|
|
countlsu_modes := qi hi si di
|
|
countlsu_funcs := $(foreach func,_countlsu,\
|
|
$(foreach mode,$(countlsu_modes),$(func_X)))
|
|
|
|
iter-items := $(countlsu_funcs)
|
|
iter-labels := $(countlsu_modes)
|
|
iter-flags := $(patsubst %,-DL_countlsu,$(iter-items))
|
|
|
|
include $(srcdir)/empty.mk $(patsubst %,$(srcdir)/config/avr/lib2-object.mk,$(iter-items))
|
|
|
|
libgcc-objects += $(patsubst %,%$(objext),$(countlsu_funcs))
|
|
|
|
|
|
# Filter out supported conversions from fixed-bit.c
|
|
# Also filter out TQ and UTQ.
|
|
|
|
# Conversions supported by the compiler
|
|
|
|
convf_modes = QI UQI QQ UQQ \
|
|
HI UHI HQ UHQ HA UHA \
|
|
SI USI SQ USQ SA USA \
|
|
DI UDI DQ UDQ DA UDA \
|
|
TI UTI TQ UTQ TA UTA
|
|
|
|
LIB2FUNCS_EXCLUDE += \
|
|
$(foreach conv,_fract _fractuns,\
|
|
$(foreach mode1,$(convf_modes),\
|
|
$(foreach mode2,$(convf_modes),$(conv_XY))))
|
|
|
|
# Conversions supported by lib1funcs-fixed.S
|
|
|
|
conv_to_sf_modes = QQ UQQ HQ UHQ HA UHA SQ USQ SA USA
|
|
conv_from_sf_modes = QQ UQQ HQ UHQ HA UHA SA USA
|
|
|
|
LIB2FUNCS_EXCLUDE += \
|
|
$(foreach conv,_fract, \
|
|
$(foreach mode1,$(conv_to_sf_modes), \
|
|
$(foreach mode2,SF,$(conv_XY))))
|
|
|
|
LIB2FUNCS_EXCLUDE += \
|
|
$(foreach conv,_fract,\
|
|
$(foreach mode1,SF,\
|
|
$(foreach mode2,$(conv_from_sf_modes),$(conv_XY))))
|
|
|
|
# Arithmetik supported by the compiler
|
|
|
|
allfix_modes = QQ UQQ HQ UHQ HA UHA SQ USQ SA USA DA UDA DQ UDQ TQ UTQ TA UTA
|
|
|
|
LIB2FUNCS_EXCLUDE += \
|
|
$(foreach func,_add _sub,\
|
|
$(foreach mode,$(allfix_modes),$(func_X)))
|
|
|
|
LIB2FUNCS_EXCLUDE += \
|
|
$(foreach func,_lshr _ashl _ashr _cmp,\
|
|
$(foreach mode,$(allfix_modes),$(func_X)))
|
|
|
|
|
|
usat_modes = UQQ UHQ UHA USQ USA UDQ UDA UTQ UTA
|
|
ssat_modes = QQ HQ HA SQ SA DQ DA TQ TA
|
|
|
|
LIB2FUNCS_EXCLUDE += \
|
|
$(foreach func,_ssadd _sssub _ssneg _ssabs,\
|
|
$(foreach mode,$(ssat_modes),$(func_X)))
|
|
|
|
LIB2FUNCS_EXCLUDE += \
|
|
$(foreach func,_usadd _ussub _usneg,\
|
|
$(foreach mode,$(usat_modes),$(func_X)))
|
|
|
|
|
|
smul_modes = QQ HQ HA SA
|
|
umul_modes = UQQ UHQ UHA USA
|
|
sdiv_modes = QQ HQ HA SA
|
|
udiv_modes = UQQ UHQ UHA USA
|
|
|
|
LIB2FUNCS_EXCLUDE += \
|
|
$(foreach func,_mul,\
|
|
$(foreach mode,$(smul_modes) $(umul_modes),$(func_X)))
|
|
|
|
LIB2FUNCS_EXCLUDE += \
|
|
$(foreach func,_div,\
|
|
$(foreach mode,$(sdiv_modes) $(udiv_modes),$(func_X)))
|
|
|
|
|
|
ssmul_modes = HA SA
|
|
usmul_modes = UHA USA
|
|
|
|
LIB2FUNCS_EXCLUDE += \
|
|
$(foreach func,_usmul,\
|
|
$(foreach mode,$(usmul_modes),$(func_X)))
|
|
|
|
LIB2FUNCS_EXCLUDE += \
|
|
$(foreach func,_ssmul,\
|
|
$(foreach mode,$(ssmul_modes),$(func_X)))
|