qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Fix bug in translation of REVSH
@ 2010-10-18 12:49 Johan Bengtsson
  2010-12-27 18:57 ` Aurelien Jarno
  0 siblings, 1 reply; 2+ messages in thread
From: Johan Bengtsson @ 2010-10-18 12:49 UTC (permalink / raw)
  To: qemu-devel; +Cc: Johan Bengtsson

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-12-27 21:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-18 12:49 [Qemu-devel] [PATCH] Fix bug in translation of REVSH Johan Bengtsson
2010-12-27 18:57 ` Aurelien Jarno

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).