1 /* Copyright (C
) 2012-2013 Free Software Foundation
, Inc.
3 This file is part of GCC.
5 GCC is free software
; you can redistribute it and
/or modify it under
6 the terms of the GNU General Public License as published by the Free
7 Software Foundation
; either version
3, or (at your option
) any later
10 GCC is distributed in the hope that it will be useful
, but WITHOUT ANY
11 WARRANTY
; without even the implied warranty of MERCHANTABILITY or
12 FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 You should have received a copy of the GNU General Public License
16 along with GCC
; see the file COPYING3. If not see
17 <http
://www.gnu.org
/licenses
/>.
*/
19 /* This file contains the definitions and documentation for the
20 builtins defined in the AVR part of the GNU compiler.
21 Befor including this file
, define a macro
23 DEF_BUILTIN(NAME
, N_ARGS
, TYPE, ICODE
, LIBNAME
)
25 NAME
: `__builtin_avr_name
' will be the user-level name of the builtin.
26 `AVR_BUILTIN_NAME' will be the internal builtin
's id.
27 N_ARGS: Number of input arguments. If special treatment is needed,
28 set to -1 and handle it by hand, see avr.c:avr_expand_builtin().
29 TYPE: A tree node describing the prototype of the built-in.
30 ICODE: Name of attached insn or expander. If special treatment in avr.c
31 is needed to expand the built-in, use `nothing'.
32 LIBNAME
: Name of the attached implementation in libgcc which is used if
33 the builtin cannot be folded away and there is no insn.
*/
35 /* Mapped to respective instruction.
*/
37 DEF_BUILTIN (NOP
, -1, void_ftype_void
, nothing
, NULL
)
38 DEF_BUILTIN (SEI
, 0, void_ftype_void
, enable_interrupt
, NULL
)
39 DEF_BUILTIN (CLI
, 0, void_ftype_void
, disable_interrupt
, NULL
)
40 DEF_BUILTIN (WDR
, 0, void_ftype_void
, wdr
, NULL
)
41 DEF_BUILTIN (SLEEP
, 0, void_ftype_void
, sleep
, NULL
)
43 /* Mapped to respective instruction but might also be folded away
44 or emit as libgcc call if ISA does not provide the instruction.
*/
46 DEF_BUILTIN (SWAP
, 1, uchar_ftype_uchar
, rotlqi3_4
, NULL
)
47 DEF_BUILTIN (FMUL
, 2, uint_ftype_uchar_uchar
, fmul
, NULL
)
48 DEF_BUILTIN (FMULS
, 2, int_ftype_char_char
, fmuls
, NULL
)
49 DEF_BUILTIN (FMULSU
, 2, int_ftype_char_uchar
, fmulsu
, NULL
)
51 /* More complex stuff that cannot be mapped
1:1 to an instruction.
*/
53 DEF_BUILTIN (DELAY_CYCLES
, -1, void_ftype_ulong
, nothing
, NULL
)
54 DEF_BUILTIN (INSERT_BITS
, 3, uchar_ftype_ulong_uchar_uchar
, insert_bits
, NULL
)
55 DEF_BUILTIN (FLASH_SEGMENT
, 1, char_ftype_const_memx_ptr
, flash_segment
, NULL
)
57 /* ISO
/IEC TR
18037 "Embedded C"
58 The following builtins are undocumented and used by stdfix.h.
*/
60 /* 7.18a
.6 The fixed
-point intrinsic functions.
*/
62 /* 7.18a
.6.2 The fixed
-point absolute value functions.
*/
64 DEF_BUILTIN (ABSHR
, 1, hr_ftype_hr
, ssabsqq2
, NULL
)
65 DEF_BUILTIN (ABSR
, 1, r_ftype_r
, ssabshq2
, NULL
)
66 DEF_BUILTIN (ABSLR
, 1, lr_ftype_lr
, ssabssq2
, NULL
)
67 DEF_BUILTIN (ABSLLR
, 1, llr_ftype_llr
, nothing
, "__ssabsdq2") // GCC extension
69 DEF_BUILTIN (ABSHK
, 1, hk_ftype_hk
, ssabsha2
, NULL
)
70 DEF_BUILTIN (ABSK
, 1, k_ftype_k
, ssabssa2
, NULL
)
71 DEF_BUILTIN (ABSLK
, -1, lk_ftype_lk
, nothing
, "__ssabsda2")
72 DEF_BUILTIN (ABSLLK
, -1, llk_ftype_llk
, nothing
, "__ssabsta2") // GCC extension