re PR target/54222 ([avr] Implement fixed-point support)
authorGeorg-Johann Lay <avr@gjlay.de>
Fri, 8 Feb 2013 10:13:37 +0000 (10:13 +0000)
committerGeorg-Johann Lay <gjl@gcc.gnu.org>
Fri, 8 Feb 2013 10:13:37 +0000 (10:13 +0000)
commit85d768f349087f3766ff84054ec7b3403c52ac7a
treec41ab849c5ffa4c56a753d5d4502a23fdc14617d
parent661bc682bcb87f5faa709f9bcd1679874f6652f6
re PR target/54222 ([avr] Implement fixed-point support)

gcc/
PR target/54222
* config/avr/avr.md (unspec) <UNSPEC_ROUND>: Add.
* config/avr/avr-fixed.md (ALL4QA, ALL124QA): New mode iterators.
(round<mode>3, round<mode>3_const): New expanders for fixed-mode.
(*round<mode>3.libgcc): New insns for fixed-modes.
* config/avr/builtins.def (ABSxx): Use a non-NULL LIBNAME.
(ROUNDxx, COUNTLSxx, BITSxx, xxBITS): New DEF_BUILTINs.
(ROUNDFX, COUNTLSFX, ABSFX): New DEF_BUILTINs.
* config/avr/stdfix.h (absFX, bitsFX, FXbits): Remove inline
implementations.  Define to __builtin_avr_absFX,
__builtin_avr_bitsFX, __builtin_avr_FXbits, respectively.
(roundFX, countlsFX): Define to __builtin_avr_roundFX,
__builtin_avr_countlsFX, respectively.
* config/avr/avr-c.c (target.h): Include it.
(enum avr_builtin_id): New enum.
(avr_resolve_overloaded_builtin): New static function.
(avr_register_target_pragmas): Use it to set
targetm.resolve_overloaded_builtin.
* config/avr/avr.c (avr_init_builtins): Supply myriads of local
tree nodes used by DEF_BUILTIN.
(avr_expand_builtin) <AVR_BUILTIN_ROUNDxx>: Sanity-check them.
(avr_fold_builtin) <AVR_BUILTIN_BITSxx>: Fold to VIEW_COVERT_EXPR.
<AVR_BUILTIN_xxBITS>: Same.

libgcc/
PR target/54222
* config/avr/lib2funcs.c: New C sources for modules for libgcc.a.
* config/avr/lib2-object.mk: New iterator to build objects from it.
* config/avr/t-avr: Iterate lib2-object.mk to build objects from
lib2funcs.c.
(LIB2FUNCS_EXCLUDE): Add _clrsbdi2.
(LIB1ASMFUNCS): Add: _ssabs_1, _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.
* config/avr/lib1funcs-fixed.S: Implement them.

gcc/testsuite/
PR target/54222
* gcc.target/avr/torture/builtins-4-roundfx.c: New test.
* gcc.target/avr/torture/builtins-5-countlsfx.c: New test.

From-SVN: r195878
16 files changed:
gcc/ChangeLog
gcc/config/avr/avr-c.c
gcc/config/avr/avr-fixed.md
gcc/config/avr/avr.c
gcc/config/avr/avr.md
gcc/config/avr/builtins.def
gcc/config/avr/stdfix.h
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/avr/torture/builtins-4-roundfx.c [new file with mode: 0644]
gcc/testsuite/gcc.target/avr/torture/builtins-5-countlsfx.c [new file with mode: 0644]
libgcc/ChangeLog
libgcc/config/avr/lib1funcs-fixed.S
libgcc/config/avr/lib1funcs.S
libgcc/config/avr/lib2-object.mk [new file with mode: 0644]
libgcc/config/avr/lib2funcs.c [new file with mode: 0644]
libgcc/config/avr/t-avr