gcc/libgcc/config/avr/avr-lib.h

106 lines
3.6 KiB
C
Raw Normal View History

/* Copyright (C) 2012-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
Makefile.in (FPBIT_FUNCS, [...]): Remove. gcc: * Makefile.in (FPBIT_FUNCS, DPBIT_FUNCS, TPBIT_FUNCS): Remove. (libgcc-support): Remove $(FPBIT), $(DPBIT), $(TPBIT) dependencies. (libgcc.mvars): Remove FPBIT, FPBIT_FUNCS, DPBIT, DPBIT_FUNCS, TPBIT, TPBIT_FUNCS. * config/fp-bit.c, config/fp-bit.h: Move to ../libgcc. * config/arm/t-strongarm-elf (FPBIT, DPBIT, dp-bit.c, fp-bit.c): Remove. * config/arm/t-vxworks: Likewise. * config/arm/t-wince-pe: Likewise. * config/avr/t-avr (fp-bit.c, FPBIT): Remove. * config/bfin/t-bfin (FPBIT, DPBIT, dp-bit.c, fp-bit.c): Remove. * config/bfin/t-bfin-elf: Likewise. * config/bfin/t-bfin-linux: Likewise. * config/bfin/t-bfin-uclinux: Likewise. * config/cris/t-cris (FPBIT, DPBIT, dp-bit.c, tmplibgcc_fp_bit.c): Remove. * config/fr30/t-fr30: Likewise. * config/frv/t-frv: Likewise. * config/h8300/t-h8300 (FPBIT, fp-bit.c): Remove. * config/iq2000/t-iq2000 (FPBIT, DPBIT, dp-bit.c, fp-bit.c): Remove. * config/m32c/t-m32c: Likewise. * config/m32r/t-linux: (LIB2FUNCS_EXTRA, fp-bit.c, dp-bit.c): Remove. * config/m32r/t-m32r (FPBIT, DPBIT, dp-bit.c, fp-bit.c): Remove. * config/mcore/t-mcore: Likewise. * config/mep/t-mep: Likewise. * config/microblaze/t-microblaze: Likewise. * config/mips/t-linux64 (TPBIT, tp-bit.c): Remove. * config/mips/t-mips (FPBIT, DPBIT, dp-bit.c, fp-bit.c): Remove. * config/mips/t-sdemtk (FPBIT, DPBIT): Remove. * config/mips/t-sr71k (FPBIT, DPBIT, dp-bit.c, fp-bit.c): Remove. * config/mn10300/t-linux: Remove. * config/mn10300/t-mn10300 (FPBIT, DPBIT, dp-bit.c, fp-bit.c): Remove. * config/pdp11/t-pdp11: Likewise. * config/picochip/t-picochip (FPBIT, fp-bit.c): Remove. * config/rs6000/ppc64-fp.c: Move to ../libgcc/config/rs6000. * config/rs6000/t-aix43 (FPBIT, DPBIT, dp-bit.c, fp-bit.c): Remove. (LIB2FUNCS_EXTRA): Remove $(srcdir)/config/rs6000/ppc64-fp.c. * config/rs6000/t-aix52: Likewise. * config/rs6000/t-darwin (LIB2FUNCS_EXTRA): Remove $(srcdir)/config/rs6000/ppc64-fp.c. * config/rs6000/t-fprules-fpbit: Remove. * config/rs6000/t-linux64 (LIB2FUNCS_EXTRA): Remove. * config/rs6000/t-lynx (FPBIT, DPBIT, dp-bit.c, fp-bit.c): Remove. * config/sh/t-netbsd (FPBIT, DPBIT): Remove. * config/sh/t-sh (FPBIT, DPBIT, dp-bit.c, fp-bit.c): Remove. * config/sparc/t-elf: Likewise. * config/sparc/t-leon: Likewise. * config/sparc/t-leon3: Likewise. * config/spu/t-spu-elf: Likewise. (DPBIT_FUNCS): Remove. * config/stormy16/t-stormy16 (FPBIT, DPBIT, dp-bit.c, fp-bit.c): Remove. * config/v850/t-v850: Likewise. * config.gcc (avr-*-rtems*): Add avr/avr-lib.h to libgcc_tm_file. (avr-*-*): Likewise. (h8300-*-rtems*): Set libgcc_tm_file. (h8300-*-elf*): Likewise. (powerpc-*-eabisimaltivec*): Remove rs6000/t-fprules-fpbit from tmake_file. (powerpc-*-eabisim*): Likewise. (powerpc-*-elf*): Likewise. (powerpc-*-eabialtivec*): Likewise. (powerpc-xilinx-eabi*): Likewise. (powerpc-*-eabi*): Likewise. (powerpc-*-rtems*): Likewise. (powerpc-wrs-vxworks, powerpc-wrs-vxworksae): Likewise. (powerpcle-*-elf*): Likewise. (powerpcle-*-eabisim*): Likewise. (powerpcle-*-eabi*): Likewise. (rx-*-elf*): Add rx/rx-lib.h to libgcc_tm_file. (am33_2.0-*-linux*): Remove mn10300/t-linux from tmake_file. * doc/fragments.texi (Target Fragment, Floating Point Emulation): Remove. gcc/po: * EXCLUDES (config/fp-bit.c, config/fp-bit.h): Remove. libgcc: * Makefile.in (double_type_size, long_double_type_size): Set. Remove $(fpbit-in-libgcc) support. (FPBIT_FUNCS, DPBIT_FUNCS, TPBIT_FUNCS): New variables. (fpbit-src): New variable. ($(fpbit-o), $(fpbit-s-o)): Use $(fpbit-src) instead of $(FPBIT). Compile with -DFLOAT $(FPBIT_CFLAGS). Use $<. ($(dpbit-o), $(dpbit-s-o)): Use $(fpbit-src) instead of $(DPBIT). Compile with $(FPBIT_CFLAGS). Use $<. ($(tpbit-o), $(tpbit-s-o): Use $(fpbit-src) instead of $(TPBIT). Compile with -DFLOAT $(TPBIT_CFLAGS). Use $<. * configure.ac (double_type_size, long_double_type_size): Determine and substitute. * configure: Regenerate. * fp-bit.c, fp-bit.h: New files. * config/avr/avr-lib.h, config/h8300/h8300-lib.h: New files. * config/mips/t-irix6 (TPBIT, $(gcc_objdir)/tp-bit.c): Remove. * config/mips/t-mips: New file. * config/mips/t-sdemtk: New file. * config/rs6000/ppc64-fp.c: New file. * config/rs6000/t-darwin (LIB2ADD): Add $(srcdir)/config/rs6000/ppc64-fp.c. * config/rs6000/t-ppc64-fp: New file. * config/rx/rx-lib.h: New file. * config/rx/t-rx (FPBIT): Set to true. ($(gcc_objdir)/fp-bit.c): Remove. (DPBIT): Set to true only with -m64bit-doubles. ($(gcc_objdir)/dp-bit.c): Remove. * config/sparc/t-softfp: Remove. * config/spu/t-elf: New file. * config/t-fdpbit, config/t-fpbit: New files. * config.host (m32c*-*-*): Add t-fdpbit to tmake_file. (mips*-*-*): Likewise. (arm-wrs-vxworks): Likewise. (arm*-*-freebsd*): Likewise. (avr-*-rtems*): Add t-fpbit to tmake_file. (avr-*-*): Likewise. (bfin*-elf*): Add t-fdpbit to tmake_file. (bfin*-uclinux*): Likewise. (bfin*-linux-uclibc*): Likewise. (bfin*-rtems*): New case. Add t-fdpbit to tmake_file. (bfin*-*): Add t-fdpbit to tmake_file. (crisv32-*-elf): Likewise. (cris-*-linux*): Likewise. (fr30-*-elf): Likewise. (frv-*-elf, frv-*-*linux*): Likewise. (h8300-*-rtems*, h8300-*-elf*): Add t-fpbit to tmake_file. (iq2000*-*-elf*): Add t-fdpbit to tmake_file. (m32r-*-elf*): Likewise. (m32rle-*-elf*): Likewise. (m32r-*-linux*): Likewise. (m32rle-*-linux*): Likewise. (mcore-*-elf): Add t-fdpbit to tmake_file. (microblaze*-*-*): Likewise. (mips-sgi-irix6.5*): Add t-tpbit to tmake_file. (mips*-*-netbsd*): Add mips/t-mips to tmake_file. (mips64*-*-linux*): Also handle mipsisa64*-*-linux*. Fix typo. Add mips/t-tpbit to tmake-file. (mips*-*-linux*): Fix typo. (mips*-sde-elf*): New case Add mips/t-sdemtk unless using newlib. (mipsisa64sr71k-*-elf*): Add t-fdpbit to tmake_file. (mipsisa64sb1-*-elf*): Add mips/t-mips to tmake_file. (mn10300-*-*): Likewise. (pdp11-*-*): Likewise. (picochip-*-*): Add t-fpbit to tmake_file. (powerpc-*-eabisimaltivec*): Likewise. (powerpc-*-eabisim*): Likewise. (powerpc-*-elf*): Likewise. (powerpc-*-eabialtivec*): Likewise. (powerpc-xilinx-eabi*): New case. Add t-fdpbit to tmake_file. (powerpc-*-eabi*): Add t-fdpbit to tmake_file. (powerpc-*-rtems*): Likewise. (powerpc-*-linux*, powerpc64-*-linux*): Add rs6000/t-ppc64-fp to tmake_file. (powerpc-wrs-vxworks, powerpc-wrs-vxworksae): Add t-fdpbit to tmake_file. (powerpc-*-lynxos*): Likewise. (powerpcle-*-elf*): Likewise. (powerpcle-*-eabisim*): Likewise. (powerpcle-*-eabi*): Likewise. (rs6000-ibm-aix4.[3456789]*, powerpc-ibm-aix4.[3456789]*): Add t-fdpbit, rs6000/t-ppc64-fp to tmake_file. (rs6000-ibm-aix5.1.*, powerpc-ibm-aix5.1.*): Likewise. (rs6000-ibm-aix[56789].*, powerpc-ibm-aix[56789].*): Likewise. (rx-*-elf): Add t-fdpbit to tmake_file. (sh-*-elf*, sh[12346l]*-*-elf*, sh-*-linux*) (sh[2346lbe]*-*-linux*, sh-*-netbsdelf*, shl*-*-netbsdelf*) (sh5-*-netbsd*, sh5l*-*-netbsd*, sh64-*-netbsd*) (sh64l*-*-netbsd*): Add t-fdpbit to tmake_file except on sh*-*-netbsd*. (sh-*-rtems*): Add t-fdpbit to tmake_file. (sh-wrs-vxworks): Likewise. (sparc-*-elf*): Replace sparc/t-softfp by t-fdpbit in tmake_file. (sparc-*-linux*): Add t-fdpbit to tmake_file for *-leon*. (sparc-*-rtems*, sparc64-*-rtems*): Split off ... (sparc64-*-rtems*): ... new case. (sparc-*-rtems*): Add t-fdpbit to tmake_file. (spu-*-elf*): Likewise. Add spu/t-elf to tmake_file. (v850*-*-*): Add t-fdpbit to tmake_file. (xstormy16-*-elf): Likewise. (am33_2.0-*-linux*): Add t-fdpbit to tmake_file. (mep*-*-*): Likewise. From-SVN: r177448
2011-08-05 16:53:09 +02:00
#ifdef FLOAT
#define CMPtype QItype
#define DF SF
#define DI SI
typedef int QItype __attribute__ ((mode (QI)));
#endif
re PR target/54222 ([avr] Implement fixed-point support) libgcc/ PR target/54222 * config/avr/lib1funcs-fixed.S: New file. * config/avr/lib1funcs.S: Include it. Undefine some divmodsi after they are used. (neg2, neg4): New macros. (__mulqihi3,__umulqihi3,__mulhi3): Rewrite non-MUL variants. (__mulhisi3,__umulhisi3,__mulsi3): Rewrite non-MUL variants. (__umulhisi3): Speed up MUL variant if there is enough flash. * config/avr/avr-lib.h (TA, UTA): Adjust according to gcc's avr-modes.def. * config/avr/t-avr (LIB1ASMFUNCS): Add: _fractqqsf, _fractuqqsf, _fracthqsf, _fractuhqsf, _fracthasf, _fractuhasf, _fractsasf, _fractusasf, _fractsfqq, _fractsfuqq, _fractsfhq, _fractsfuhq, _fractsfha, _fractsfsa, _mulqq3, _muluqq3, _mulhq3, _muluhq3, _mulha3, _muluha3, _mulsa3, _mulusa3, _divqq3, _udivuqq3, _divhq3, _udivuhq3, _divha3, _udivuha3, _divsa3, _udivusa3. (LIB2FUNCS_EXCLUDE): Add supported functions. gcc/ PR target/54222 * avr-modes.def (HA, SA, DA, TA, UTA): Adjust modes. * avr/avr-fixed.md: New file. * avr/avr.md: Include it. (cc): Add: minus. (adjust_len): Add: minus, minus64, ufract, sfract. (ALL1, ALL2, ALL4, ORDERED234): New mode iterators. (MOVMODE): Add: QQ, UQQ, HQ, UHQ, HA, UHA, SQ, USQ, SA, USA. (MPUSH): Add: HQ, UHQ, HA, UHA, SQ, USQ, SA, USA. (pushqi1, xload8_A, xload_8, movqi_insn, *reload_inqi, addqi3, subqi3, ashlqi3, *ashlqi3, ashrqi3, lshrqi3, *lshrqi3, *cmpqi, cbranchqi4, *cpse.eq): Generalize to handle all 8-bit modes in ALL1. (*movhi, reload_inhi, addhi3, *addhi3, addhi3_clobber, subhi3, ashlhi3, *ashlhi3_const, ashrhi3, *ashirhi3_const, lshrhi3, *lshrhi3_const, *cmphi, cbranchhi4): Generalize to handle all 16-bit modes in ALL2. (subhi3, casesi, strlenhi): Add clobber when expanding minus:HI. (*movsi, *reload_insi, addsi3, subsi3, ashlsi3, *ashlsi3_const, ashrsi3, *ashrhi3_const, *ashrsi3_const, lshrsi3, *lshrsi3_const, *reversed_tstsi, *cmpsi, cbranchsi4): Generalize to handle all 32-bit modes in ALL4. * avr-dimode.md (ALL8): New mode iterator. (adddi3, adddi3_insn, adddi3_const_insn, subdi3, subdi3_insn, subdi3_const_insn, cbranchdi4, compare_di2, compare_const_di2, ashrdi3, lshrdi3, rotldi3, ashldi3_insn, ashrdi3_insn, lshrdi3_insn, rotldi3_insn): Generalize to handle all 64-bit modes in ALL8. * config/avr/avr-protos.h (avr_to_int_mode): New prototype. (avr_out_fract, avr_out_minus, avr_out_minus64): New prototypes. * config/avr/avr.c (TARGET_FIXED_POINT_SUPPORTED_P): Define to... (avr_fixed_point_supported_p): ...this new static function. (TARGET_BUILD_BUILTIN_VA_LIST): Define to... (avr_build_builtin_va_list): ...this new static function. (avr_adjust_type_node): New static function. (avr_scalar_mode_supported_p): Allow if ALL_FIXED_POINT_MODE_P. (avr_builtin_setjmp_frame_value): Use gen_subhi3 and return new pseudo instead of gen_rtx_MINUS. (avr_print_operand, avr_operand_rtx_cost): Handle: CONST_FIXED. (notice_update_cc): Handle: CC_MINUS. (output_movqi): Generalize to handle respective fixed-point modes. (output_movhi, output_movsisf, avr_2word_insn_p): Ditto. (avr_out_compare, avr_out_plus_1): Also handle fixed-point modes. (avr_assemble_integer): Ditto. (output_reload_in_const, output_reload_insisf): Ditto. (avr_compare_pattern): Skip all modes > 4 bytes. (avr_2word_insn_p): Skip movuqq_insn, movqq_insn. (avr_out_fract, avr_out_minus, avr_out_minus64): New functions. (avr_to_int_mode): New function. (adjust_insn_length): Handle: ADJUST_LEN_SFRACT, ADJUST_LEN_UFRACT, ADJUST_LEN_MINUS, ADJUST_LEN_MINUS64. * config/avr/predicates.md (const0_operand): Allow const_fixed. (const_operand, const_or_immediate_operand): New. (nonmemory_or_const_operand): New. * config/avr/constraints.md (Ynn, Y00, Y01, Y02, Ym1, Ym2, YIJ): New constraints. * config/avr/avr.h (LONG_LONG_ACCUM_TYPE_SIZE): Define. From-SVN: r190644
2012-08-24 14:42:48 +02:00
/* fixed-bit.h does not define functions for TA and UTA because
that part is wrapped in #if MIN_UNITS_PER_WORD > 4.
This would lead to empty functions for TA and UTA.
Thus, supply appropriate defines as if HAVE_[U]TA == 1.
#define HAVE_[U]TA 1 won't work because avr-modes.def
uses ADJUST_BYTESIZE(TA,8) and fixed-bit.h is not generic enough
to arrange for such changes of the mode size. */
typedef unsigned _Fract UTAtype __attribute__ ((mode (UTA)));
#if defined (UTA_MODE)
#define FIXED_SIZE 8 /* in bytes */
#define INT_C_TYPE UDItype
#define UINT_C_TYPE UDItype
#define HINT_C_TYPE USItype
#define HUINT_C_TYPE USItype
#define MODE_NAME UTA
#define MODE_NAME_S uta
#define MODE_UNSIGNED 1
#endif
#if defined (FROM_UTA)
#define FROM_TYPE 4 /* ID for fixed-point */
#define FROM_MODE_NAME UTA
#define FROM_MODE_NAME_S uta
#define FROM_INT_C_TYPE UDItype
#define FROM_SINT_C_TYPE DItype
#define FROM_UINT_C_TYPE UDItype
#define FROM_MODE_UNSIGNED 1
#define FROM_FIXED_SIZE 8 /* in bytes */
#elif defined (TO_UTA)
#define TO_TYPE 4 /* ID for fixed-point */
#define TO_MODE_NAME UTA
#define TO_MODE_NAME_S uta
#define TO_INT_C_TYPE UDItype
#define TO_SINT_C_TYPE DItype
#define TO_UINT_C_TYPE UDItype
#define TO_MODE_UNSIGNED 1
#define TO_FIXED_SIZE 8 /* in bytes */
#endif
/* Same for TAmode */
typedef _Fract TAtype __attribute__ ((mode (TA)));
#if defined (TA_MODE)
#define FIXED_SIZE 8 /* in bytes */
#define INT_C_TYPE DItype
#define UINT_C_TYPE UDItype
#define HINT_C_TYPE SItype
#define HUINT_C_TYPE USItype
#define MODE_NAME TA
#define MODE_NAME_S ta
#define MODE_UNSIGNED 0
#endif
#if defined (FROM_TA)
#define FROM_TYPE 4 /* ID for fixed-point */
#define FROM_MODE_NAME TA
#define FROM_MODE_NAME_S ta
#define FROM_INT_C_TYPE DItype
#define FROM_SINT_C_TYPE DItype
#define FROM_UINT_C_TYPE UDItype
#define FROM_MODE_UNSIGNED 0
#define FROM_FIXED_SIZE 8 /* in bytes */
#elif defined (TO_TA)
#define TO_TYPE 4 /* ID for fixed-point */
#define TO_MODE_NAME TA
#define TO_MODE_NAME_S ta
#define TO_INT_C_TYPE DItype
#define TO_SINT_C_TYPE DItype
#define TO_UINT_C_TYPE UDItype
#define TO_MODE_UNSIGNED 0
#define TO_FIXED_SIZE 8 /* in bytes */
#endif