Index: doc/extend.texi =================================================================== --- doc/extend.texi (Revision 172046) +++ doc/extend.texi (Arbeitskopie) @@ -7924,6 +7924,7 @@ instructions, but allow the compiler to * Alpha Built-in Functions:: * ARM iWMMXt Built-in Functions:: * ARM NEON Intrinsics:: +* AVR Built-in Functions:: * Blackfin Built-in Functions:: * FR-V Built-in Functions:: * X86 Built-in Functions:: @@ -8175,6 +8176,44 @@ when the @option{-mfpu=neon} switch is u @include arm-neon-intrinsics.texi +@node AVR Built-in Functions +@subsection AVR Built-in Functions + +For each built-in function for AVR, there is an equally named, +uppercase built-in macro defined. That way users can easily query if +or if not a specific built-in is implemented or not. For example, if +@code{__builtin_avr_nop} is available the macro +@code{__BUILTIN_AVR_NOP} is defined to @code{1} and undefined otherwise. + +The following built-in functions map to the respective machine +instruction, i.e. @code{nop}, @code{sei}, @code{cli}, @code{sleep}, +@code{wdr}, @code{swap}, @code{fmul}, @code{fmuls} +resp. @code{fmulsu}. The latter three are only available if the AVR +device actually supports multiplication. + +@smallexample +void __builtin_avr_nop (void) +void __builtin_avr_sei (void) +void __builtin_avr_cli (void) +void __builtin_avr_sleep (void) +void __builtin_avr_wdr (void) +unsigned char __builtin_avr_swap (unsigned char) +unsigned int __builtin_avr_fmul (unsigned char, unsigned char) +int __builtin_avr_fmuls (char, char) +int __builtin_avr_fmulsu (char, unsigned char) +@end smallexample + +In order to delay execution for a specific number of cycles, GCC +implements +@smallexample +void __builtin_avr_delay_cycles (unsigned long ticks) +@end smallexample + +@code{ticks} is the number of ticks to delay execution. Note that this +built-in does not take into account the effect of interrupts which +might increase delay time. @code{ticks} must be a compile time +integer constant; delays with a variable number of cycles are not supported. + @node Blackfin Built-in Functions @subsection Blackfin Built-in Functions