qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Dongxue Zhang <elta.era@gmail.com>
To: qemu-devel@nongnu.org
Cc: Dongxue Zhang <elta.era@gmail.com>,
	petarj@mips.com, chenwj@iis.sinica.edu.tw, rth@twiddle.net
Subject: [Qemu-devel] [PATCH 2/3] Make-repl_ph-to-sign-extended-to-target_long
Date: Tue, 11 Dec 2012 22:28:29 +0800	[thread overview]
Message-ID: <1355236110-4159-2-git-send-email-elta.era@gmail.com> (raw)
In-Reply-To: <1355236110-4159-1-git-send-email-elta.era@gmail.com>

The immediate value is 9bits, should sign-extend to 16bits. The return value to
register should sign-extend to target_long, as Richard says, removing an
unnecessary cast works fun.

Signed-off-by: Dongxue Zhang <elta.era@gmail.com>
---
 target-mips/translate.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/target-mips/translate.c b/target-mips/translate.c
index 65e6725..1701ca3 100644
--- a/target-mips/translate.c
+++ b/target-mips/translate.c
@@ -13769,9 +13769,10 @@ static void gen_mipsdsp_bitinsn(CPUMIPSState *env, DisasContext *ctx,
             check_dsp(ctx);
             {
                 imm = (ctx->opcode >> 16) & 0x03FF;
+                imm = (int16_t)(imm << 6) >> 6;
                 tcg_gen_movi_tl(cpu_gpr[ret], \
                                 (target_long)((int32_t)imm << 16 | \
-                                (uint32_t)(uint16_t)imm));
+                                (uint16_t)imm));
             }
             break;
         case OPC_REPLV_PH:
-- 
1.7.10.4

  reply	other threads:[~2012-12-11 14:29 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-11 14:28 [Qemu-devel] [PATCH 1/3] Fix my email address Dongxue Zhang
2012-12-11 14:28 ` Dongxue Zhang [this message]
2012-12-11 15:06   ` [Qemu-devel] [PATCH 2/3] Make-repl_ph-to-sign-extended-to-target_long Jovanovic, Petar
2013-01-01 10:59     ` aurelien
2012-12-11 15:13   ` Markus Armbruster
2012-12-11 18:39     ` Andreas Färber
2012-12-12  6:43       ` Dongxue Zhang
2012-12-12 23:19         ` Jovanovic, Petar
2012-12-11 14:28 ` [Qemu-devel] [PATCH 3/3] Fix-gen_HILO-to-make-it-adapt-each-arch-which-use-acc Dongxue Zhang
2013-01-01 11:15   ` Aurelien Jarno
2012-12-11 17:25 ` [Qemu-devel] [PATCH 1/3] Fix my email address Stefan Weil
     [not found]   ` <CAEomy4TXVE572yE_cbaDgr5EQ+wo-+9vaC2mNrqAYg2u+02mww@mail.gmail.com>
2012-12-12 22:02     ` Stefan Weil
2012-12-13  7:00       ` 陳韋任 (Wei-Ren Chen)

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=1355236110-4159-2-git-send-email-elta.era@gmail.com \
    --to=elta.era@gmail.com \
    --cc=chenwj@iis.sinica.edu.tw \
    --cc=petarj@mips.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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).