From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1KGdv7-00070Q-GL for mharc-grub-devel@gnu.org; Wed, 09 Jul 2008 13:57:37 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KGdv5-0006zq-SL for grub-devel@gnu.org; Wed, 09 Jul 2008 13:57:35 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KGdv4-0006yY-6Y for grub-devel@gnu.org; Wed, 09 Jul 2008 13:57:35 -0400 Received: from [199.232.76.173] (port=34968 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KGdv3-0006yO-K9 for grub-devel@gnu.org; Wed, 09 Jul 2008 13:57:33 -0400 Received: from c60.cesmail.net ([216.154.195.49]:22998) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.60) (envelope-from ) id 1KGdv3-0004gS-2e for grub-devel@gnu.org; Wed, 09 Jul 2008 13:57:33 -0400 Received: from unknown (HELO relay.cesmail.net) ([192.168.1.81]) by c60.cesmail.net with ESMTP; 09 Jul 2008 13:57:32 -0400 Received: from [192.168.0.21] (static-72-92-88-10.phlapa.fios.verizon.net [72.92.88.10]) by relay.cesmail.net (Postfix) with ESMTP id E61CB618F22 for ; Wed, 9 Jul 2008 13:57:31 -0400 (EDT) From: Pavel Roskin To: The development of GRUB 2 In-Reply-To: <1KGZ7b-1EcJsG0@fwd32.aul.t-online.de> References: <1215264476.26019.160.camel@localhost> <1215293427.17114.2.camel@dv> <1215298499.26019.192.camel@localhost> <20080706183042.GA22023@thorin> <1215374534.26019.194.camel@localhost> <48726DB3.9000809@t-online.de> <4873AC32.3060004@t-online.de> <1215586047.31230.27.camel@dv> <1KGZ7b-1EcJsG0@fwd32.aul.t-online.de> Content-Type: text/plain; charset=UTF-8 Date: Wed, 09 Jul 2008 13:57:30 -0400 Message-Id: <1215626250.26246.9.camel@dv> Mime-Version: 1.0 X-Mailer: Evolution 2.22.2 (2.22.2-2.fc9) Content-Transfer-Encoding: 8bit X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Subject: Re: Endianness macros capitalization X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Jul 2008 17:57:36 -0000 On Wed, 2008-07-09 at 14:50 +0200, Christian Franke wrote: > Overall size from inline asm would only be smaller if there is any > benefit from additional optimizations. Correct. Function calls use fixed registers for everything, but macros don't have to. > Result with the test script from my last mail: > > Debian gcc 4.1.2-7: > inline (portable)=357, inline (asm)=126, function=104 > > Cygwin gcc 3.4.4: > inline (portable)=340, inline (asm)=124, function=96 > > Function call is still better. The only candidate for inline is probably > grub_swap_bytes16(). But we are getting closer! > > .... And if written properly, it could work with any of > > the registers that allow access to the lower two bytes (%eax, %ebx, > > %ecx and %edx), thus giving more flexibility to the optimizer. > > > > This would require support to access the Rl and Rh parts of eRx for each > R in [a-d]. Something like: > > asm ( > "xchg %0:l,%0:h\n" > "roll $0x10,%0\n" > "xchg %0:l,%0:h\n" > : "=r"(_y) : "0"(_x) \ > ); > > Do gcc or gas provide a syntax to do this? Yes. That's %b0 and %h0. Use "=q" for all registers with "upper halves" (%ah-%dh). Also, please be consistent and use width suffixes everywhere. xchg should be xchgb. -- Regards, Pavel Roskin