qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Johan Bengtsson <teofrastius@gmail.com>
To: qemu-devel@nongnu.org
Cc: Johan Bengtsson <teofrastius@gmail.com>
Subject: [Qemu-devel] [PATCH] Fix bug in translation of REVSH
Date: Mon, 18 Oct 2010 14:49:36 +0200	[thread overview]
Message-ID: <1287406176-13554-1-git-send-email-teofrastius@gmail.com> (raw)

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 <teofrastius@gmail.com>
---
 target-arm/translate.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

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

             reply	other threads:[~2010-10-18 12:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-18 12:49 Johan Bengtsson [this message]
2010-12-27 18:57 ` [Qemu-devel] [PATCH] Fix bug in translation of REVSH Aurelien Jarno

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1287406176-13554-1-git-send-email-teofrastius@gmail.com \
    --to=teofrastius@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).