qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Vince Weaver <vince@csl.cornell.edu>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] Fix extlh instruction on Alpha
Date: Thu, 17 Sep 2009 15:28:52 -0400 (EDT)	[thread overview]
Message-ID: <20090917152502.G54732@stanley.csl.cornell.edu> (raw)


The extlh instruction on Alpha currently doesn't work properly.
It's a combination of a cut/paste bug (16 where it should be 32) as well 
as a "shift by 64" bug.

This improves on an earlier patch that used labels, conditional jumps, 
and local variables.  Thanks go especially to Aurelien Jarno and Andreas 
Schwab who have a much better eye for bit-wise TCG optimization than I do.

Vince

Signed-off-by: Vince Weaver <vince@csl.cornell.edu>

diff --git a/target-alpha/translate.c b/target-alpha/translate.c
index 9d2bc45..9e7e9b2 100644
--- a/target-alpha/translate.c
+++ b/target-alpha/translate.c
@@ -524,14 +524,15 @@ static inline void gen_ext_h(void(*tcg_gen_ext_i64)(TCGv t0, TCGv t1),
             else
                 tcg_gen_mov_i64(cpu_ir[rc], cpu_ir[ra]);
         } else {
-            TCGv tmp1, tmp2;
+            TCGv tmp1;
             tmp1 = tcg_temp_new();
+
             tcg_gen_andi_i64(tmp1, cpu_ir[rb], 7);
             tcg_gen_shli_i64(tmp1, tmp1, 3);
-            tmp2 = tcg_const_i64(64);
-            tcg_gen_sub_i64(tmp1, tmp2, tmp1);
-            tcg_temp_free(tmp2);
+            tcg_gen_neg_i64(tmp1, tmp1);
+            tcg_gen_andi_i64(tmp1, tmp1, 0x3f);
             tcg_gen_shl_i64(cpu_ir[rc], cpu_ir[ra], tmp1);
+
             tcg_temp_free(tmp1);
         }
         if (tcg_gen_ext_i64)
@@ -1316,7 +1317,7 @@ static inline int translate_one(DisasContext *ctx, uint32_t insn)
             break;
         case 0x6A:
             /* EXTLH */
-            gen_ext_h(&tcg_gen_ext16u_i64, ra, rb, rc, islit, lit);
+            gen_ext_h(&tcg_gen_ext32u_i64, ra, rb, rc, islit, lit);
             break;
         case 0x72:
             /* MSKQH */

             reply	other threads:[~2009-09-17 19:29 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-17 19:28 Vince Weaver [this message]
2009-09-18 15:25 ` [Qemu-devel] [PATCH] Fix extlh instruction on Alpha Aurelien Jarno
2009-09-21  2:20 ` Rob Landley
2009-09-21  6:23   ` Laurent Desnogues
2009-09-21 11:37     ` Tristan Gingold
2009-09-21 18:48       ` Rob Landley
2009-09-22  8:04         ` Tristan Gingold
2009-09-21 18:43     ` Rob Landley
2009-09-21 13:31   ` qemu-system-alpha (was: Re: [Qemu-devel] [PATCH] Fix extlh instruction on Alpha) Brian Wheeler
2009-09-21 19:07     ` Rob Landley
  -- strict thread matches above, loose matches on Subject: below --
2009-09-09 16:08 [Qemu-devel] [PATCH] Fix extlh instruction on Alpha Vince Weaver
2009-09-16 19:52 ` Aurelien Jarno
2009-09-16 20:45   ` Vince Weaver
2009-09-16 20:56     ` Aurelien Jarno
2009-09-17 16:07       ` Vince Weaver
2009-09-17 16:25         ` Laurent Desnogues
2009-09-17 17:19         ` Aurelien Jarno
2009-08-05  3:26 [Qemu-devel] [patch] " Vince Weaver
2009-08-05  6:05 ` Filip Navara

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=20090917152502.G54732@stanley.csl.cornell.edu \
    --to=vince@csl.cornell.edu \
    --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).