From patchwork Tue Dec 11 14:28:29 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongxue Zhang X-Patchwork-Id: 205247 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C323D2C0087 for ; Wed, 12 Dec 2012 01:29:15 +1100 (EST) Received: from localhost ([::1]:48449 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TiQpd-0001Cq-VG for incoming@patchwork.ozlabs.org; Tue, 11 Dec 2012 09:29:13 -0500 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :content-type; bh=zRo8YDw9L/8tXx8SRpii/ptEzo9g8IqchjCY9qAy8Bw=; b=DLm3i1Q9kFNRBgECfQLIjIGIdfRZ47KsQZXoyzK2RleYRnZHzxFZDsP7GEE+u+FA7S SYQ9B+swrdhmiOUl+qSmw6SylBo5CvLcoRn9cO7tYhaNi+tF7hkZDLwUnCB9TpXRo/4H W1w/oa5rOgnRfzla5kzOK9tVguLzUy/CojTf5oTrGEhTLZ4I4koRCPUhGwvrEXrBIYbJ U9uZMSx8MX6+TQVexmIz+PBkyva/C6kmDQFeM+UQwgZM9ciwuunnowpI0P2IV9UDCng6 v190A2jXekyXFsF3k4TgdEk2hu4jQ3wY6tBF6SllASKlMiDh2w0UAuT5ziDybbAL00dw e17w== Received: by 10.68.241.73 with SMTP id wg9mr48855442pbc.3.1355236131729; Tue, 11 Dec 2012 06:28:51 -0800 (PST) Received: from localhost ([122.70.210.161]) by mx.google.com with ESMTPS id o11sm13853273pby.8.2012.12.11.06.28.49 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 11 Dec 2012 06:28:51 -0800 (PST) From: Dongxue Zhang To: qemu-devel@nongnu.org Date: Tue, 11 Dec 2012 22:28:29 +0800 Message-Id: <1355236110-4159-2-git-send-email-elta.era@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1355236110-4159-1-git-send-email-elta.era@gmail.com> References: <1355236110-4159-1-git-send-email-elta.era@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.160.45 Cc: Dongxue Zhang , 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 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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: