From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:38940) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TiQpR-0001AG-LX for qemu-devel@nongnu.org; Tue, 11 Dec 2012 09:29:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TiQpJ-00086g-3p for qemu-devel@nongnu.org; Tue, 11 Dec 2012 09:29:01 -0500 Received: from mail-pb0-f45.google.com ([209.85.160.45]:54757) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TiQpI-00086W-BR for qemu-devel@nongnu.org; Tue, 11 Dec 2012 09:28:53 -0500 Received: by mail-pb0-f45.google.com with SMTP id mc8so2570307pbc.4 for ; Tue, 11 Dec 2012 06:28:51 -0800 (PST) From: Dongxue Zhang Date: Tue, 11 Dec 2012 22:28:29 +0800 Message-Id: <1355236110-4159-2-git-send-email-elta.era@gmail.com> In-Reply-To: <1355236110-4159-1-git-send-email-elta.era@gmail.com> References: <1355236110-4159-1-git-send-email-elta.era@gmail.com> Content-Type: text/plain; charset="utf-8" Subject: [Qemu-devel] [PATCH 2/3] Make-repl_ph-to-sign-extended-to-target_long List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Dongxue Zhang , petarj@mips.com, chenwj@iis.sinica.edu.tw, rth@twiddle.net 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 --- 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