Received: from [140.186.70.92] (port=39167 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PXKdN-00085m-15 for qemu-devel@nongnu.org; Mon, 27 Dec 2010 16:29:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PXKdL-0005Mq-VM for qemu-devel@nongnu.org; Mon, 27 Dec 2010 16:29:36 -0500 Received: from hall.aurel32.net ([88.191.126.93]:60673) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PXKdL-0005Me-PX for qemu-devel@nongnu.org; Mon, 27 Dec 2010 16:29:35 -0500 Date: Mon, 27 Dec 2010 19:57:49 +0100 From: Aurelien Jarno Subject: Re: [Qemu-devel] [PATCH] Fix bug in translation of REVSH Message-ID: <20101227185749.GA4098@volta.aurel32.net> References: <1287406176-13554-1-git-send-email-teofrastius@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <1287406176-13554-1-git-send-email-teofrastius@gmail.com> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Johan Bengtsson Cc: qemu-devel@nongnu.org On Mon, Oct 18, 2010 at 02:49:36PM +0200, Johan Bengtsson wrote: > The translation of REVSH shifted the low byte 8 steps left before performing > an 8-bit sign extend, causing this part of the expression to alwas be 0. > The fix for this is either to extend before shifting or switch to a 16-bit > extend. I choose the former. > > Signed-off-by: Johan Bengtsson > --- > target-arm/translate.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) Thanks for this patch. While it is correct, I have committed a different fix using tcg_gen_bswap16, so that the generated code can be optimized on some hosts. > diff --git a/target-arm/translate.c b/target-arm/translate.c > index 652cac9..e2fa4df 100644 > --- a/target-arm/translate.c > +++ b/target-arm/translate.c > @@ -253,8 +253,8 @@ static void gen_revsh(TCGv var) > TCGv tmp = new_tmp(); > tcg_gen_shri_i32(tmp, var, 8); > tcg_gen_andi_i32(tmp, tmp, 0x00ff); > - tcg_gen_shli_i32(var, var, 8); > tcg_gen_ext8s_i32(var, var); > + tcg_gen_shli_i32(var, var, 8); > tcg_gen_or_i32(var, var, tmp); > dead_tmp(tmp); > } > -- > 1.7.0.4 > > > -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurelien@aurel32.net http://www.aurel32.net