From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Lhl0d-0007dJ-Fq for qemu-devel@nongnu.org; Thu, 12 Mar 2009 09:31:39 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Lhl0Z-0007ZU-0c for qemu-devel@nongnu.org; Thu, 12 Mar 2009 09:31:37 -0400 Received: from [199.232.76.173] (port=47246 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lhl0Y-0007ZA-Qs for qemu-devel@nongnu.org; Thu, 12 Mar 2009 09:31:34 -0400 Received: from mx20.gnu.org ([199.232.41.8]:28266) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Lhl0Y-0006ne-IC for qemu-devel@nongnu.org; Thu, 12 Mar 2009 09:31:34 -0400 Received: from mail.codesourcery.com ([65.74.133.4]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Lhl0X-0002Zg-K5 for qemu-devel@nongnu.org; Thu, 12 Mar 2009 09:31:33 -0400 From: Paul Brook Subject: Re: [Qemu-devel] [PATCH 0/9] tcg: reorganize bswap* functions Date: Thu, 12 Mar 2009 13:31:30 +0000 References: <20090311170836.GD32521@hall.aurel32.net> <200903121229.47365.paul@codesourcery.com> <20090312125632.GO24377@volta.aurel32.net> In-Reply-To: <20090312125632.GO24377@volta.aurel32.net> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200903121331.31042.paul@codesourcery.com> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Aurelien Jarno > > I think we want to preserve the zero extension of the value, i.e. you > > want something along the lines of: > > > > if (!TCGV_EQUAL_I64(ret, arg)) > > tcg_gen_movi_i32(TCGV_HIGH(ret), 0); > > That's why I have modified the documentation to say the high bytes have > to be zero, similar to the current bswap16_i32 implementation. There are two issues here: - Requiring a zero extended input value. - Providing a zero extended result. Your documentation covers the former requirement. However it does not mention the latter. The existing bswap16_i32 implementation does provide this guarantee (and can be simplified if we do not require this). I expect it is worth preserving the zero extension. > > > +++ b/tcg/i386/tcg-target.c > That's what I did first when using XCHG xH, xL. That's why I used ROLW > instead which is able to work on the 8 registers by accessing 16-bit > registers. Ok. My mistake. > > You need to use tcg_out_opc here to get REX prefixes. You need P_REXB to > > avoid the legacy encoding issues mentioned above, and the high bit of the > > r/m field also goes in the REX byte. > > Same here. I'd managed to convince myself that tcg_out_modrm didn't use tcg_out_opc. Clearly I was wrong. Paul