From patchwork Wed Apr 6 15:16:13 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georg-Johann Lay X-Patchwork-Id: 90029 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 81F29B6F06 for ; Thu, 7 Apr 2011 01:16:29 +1000 (EST) Received: (qmail 24569 invoked by alias); 6 Apr 2011 15:16:27 -0000 Received: (qmail 24561 invoked by uid 22791); 6 Apr 2011 15:16:26 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mo-p00-ob.rzone.de (HELO mo-p00-ob.rzone.de) (81.169.146.161) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 06 Apr 2011 15:16:22 +0000 X-RZG-AUTH: :LXoWVUeid/7A29J/hMvvT2k715jHQaJercGObUOFkj18odoYNahU4Q== X-RZG-CLASS-ID: mo00 Received: from [192.168.0.22] (business-188-111-022-002.static.arcor-ip.net [188.111.22.2]) by post.strato.de (mrclete mo8) (RZmta 25.11) with ESMTPA id f02df1n36FAP29 ; Wed, 6 Apr 2011 17:16:13 +0200 (MEST) Message-ID: <4D9C83BD.4090002@gjlay.de> Date: Wed, 06 Apr 2011 17:16:13 +0200 From: Georg-Johann Lay User-Agent: Thunderbird 2.0.0.24 (X11/20100302) MIME-Version: 1.0 To: gcc-patches@gcc.gnu.org CC: Denis Chertykov , Eric Weddington , Anatoly Sokolov Subject: Re: [Patch][AVR]: Initial builtins support References: <4D9C747B.1020303@gjlay.de> In-Reply-To: <4D9C747B.1020303@gjlay.de> X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Patch for user documentation. 2011-04-06 Georg-Johann Lay * doc/extend.texi (Target Builtins): Add documentation of AVR built-in functions. (AVR Built-in Functions): New node 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