aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/avr
diff options
context:
space:
mode:
authorGeorg-Johann Lay <avr@gjlay.de>2016-08-01 12:23:17 +0000
committerGeorg-Johann Lay <gjl@gcc.gnu.org>2016-08-01 12:23:17 +0000
commitee52b11b30850324bb13b132e78c18e9d3d65e63 (patch)
tree4b91588e2f3f59ed75a7e09cde118171c919bf8a /gcc/config/avr
parent7481147265a13c906467edec41927b3f106fe558 (diff)
downloadgcc-ee52b11b30850324bb13b132e78c18e9d3d65e63.zip
gcc-ee52b11b30850324bb13b132e78c18e9d3d65e63.tar.gz
gcc-ee52b11b30850324bb13b132e78c18e9d3d65e63.tar.bz2
extend.texi (AVR Built-in Functions): Document __builtin_avr_nops.
* doc/extend.texi (AVR Built-in Functions): Document __builtin_avr_nops. * config/avr/builtins.def (NOPS): New. * config/avr/avr.c (avr_expand_nops): New static function. (avr_expand_builtin): Use it to handle AVR_BUILTIN_NOPS. From-SVN: r238947
Diffstat (limited to 'gcc/config/avr')
-rw-r--r--gcc/config/avr/avr.c25
-rw-r--r--gcc/config/avr/builtins.def1
2 files changed, 26 insertions, 0 deletions
diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c
index a2a0d38..fba62d2 100644
--- a/gcc/config/avr/avr.c
+++ b/gcc/config/avr/avr.c
@@ -12714,6 +12714,18 @@ avr_expand_delay_cycles (rtx operands0)
}
+static void
+avr_expand_nops (rtx operands0)
+{
+ unsigned HOST_WIDE_INT n_nops = UINTVAL (operands0) & GET_MODE_MASK (HImode);
+
+ while (n_nops--)
+ {
+ emit_insn (gen_nopv (const1_rtx));
+ }
+}
+
+
/* Compute the image of x under f, i.e. perform x --> f(x) */
static int
@@ -13388,6 +13400,19 @@ avr_expand_builtin (tree exp, rtx target,
return NULL_RTX;
}
+ case AVR_BUILTIN_NOPS:
+ {
+ arg0 = CALL_EXPR_ARG (exp, 0);
+ op0 = expand_expr (arg0, NULL_RTX, VOIDmode, EXPAND_NORMAL);
+
+ if (!CONST_INT_P (op0))
+ error ("%s expects a compile time integer constant", bname);
+ else
+ avr_expand_nops (op0);
+
+ return NULL_RTX;
+ }
+
case AVR_BUILTIN_INSERT_BITS:
{
arg0 = CALL_EXPR_ARG (exp, 0);
diff --git a/gcc/config/avr/builtins.def b/gcc/config/avr/builtins.def
index a262dc5..4088c0a 100644
--- a/gcc/config/avr/builtins.def
+++ b/gcc/config/avr/builtins.def
@@ -51,6 +51,7 @@ DEF_BUILTIN (FMULSU, 2, int_ftype_char_uchar, fmulsu, NULL)
/* More complex stuff that cannot be mapped 1:1 to an instruction. */
DEF_BUILTIN (DELAY_CYCLES, -1, void_ftype_ulong, nothing, NULL)
+DEF_BUILTIN (NOPS, -1, void_ftype_ulong, nothing, NULL)
DEF_BUILTIN (INSERT_BITS, 3, uchar_ftype_ulong_uchar_uchar, insert_bits, NULL)
DEF_BUILTIN (FLASH_SEGMENT, 1, char_ftype_const_memx_ptr, flash_segment, NULL)