From patchwork Wed Jun 11 15:19:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leon Alrae X-Patchwork-Id: 358758 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id EAF8D140076 for ; Thu, 12 Jun 2014 01:31:44 +1000 (EST) Received: from localhost ([::1]:47326 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WukV4-0001vG-Kl for incoming@patchwork.ozlabs.org; Wed, 11 Jun 2014 11:31:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55482) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WukKu-0001c2-9R for qemu-devel@nongnu.org; Wed, 11 Jun 2014 11:21:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WukKp-0004A0-73 for qemu-devel@nongnu.org; Wed, 11 Jun 2014 11:21:12 -0400 Received: from mailapp01.imgtec.com ([195.59.15.196]:20898) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WukKp-00049r-2B for qemu-devel@nongnu.org; Wed, 11 Jun 2014 11:21:07 -0400 Received: from KLMAIL01.kl.imgtec.org (unknown [192.168.5.35]) by Websense Email Security Gateway with ESMTPS id A133C3299A577; Wed, 11 Jun 2014 16:21:02 +0100 (IST) Received: from localhost.localdomain (192.168.14.85) by KLMAIL01.kl.imgtec.org (192.168.5.35) with Microsoft SMTP Server (TLS) id 14.3.181.6; Wed, 11 Jun 2014 16:21:04 +0100 From: Leon Alrae To: Date: Wed, 11 Jun 2014 16:19:49 +0100 Message-ID: <1402499992-64851-20-git-send-email-leon.alrae@imgtec.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1402499992-64851-1-git-send-email-leon.alrae@imgtec.com> References: <1402499992-64851-1-git-send-email-leon.alrae@imgtec.com> MIME-Version: 1.0 X-Originating-IP: [192.168.14.85] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 195.59.15.196 Cc: yongbok.kim@imgtec.com, cristian.cuna@imgtec.com, leon.alrae@imgtec.com, aurelien@aurel32.net, rth@twiddle.net Subject: [Qemu-devel] [PATCH v2 19/22] target-mips: remove JR, BLTZAL, BGEZAL and add NAL, BAL instructions 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 From: Yongbok Kim Signed-off-by: Yongbok Kim Signed-off-by: Leon Alrae Reviewed-by: Aurelien Jarno --- disas/mips.c | 2 ++ target-mips/translate.c | 18 ++++++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/disas/mips.c b/disas/mips.c index dd2473e..e3e253f 100644 --- a/disas/mips.c +++ b/disas/mips.c @@ -1313,6 +1313,8 @@ const struct mips_opcode mips_builtin_opcodes[] = {"bgtzalc", "s,t,p", 0x1c000000, 0xffe00000, CBD|RD_s|RD_t, 0, I32R6}, {"bltzalc", "s,t,p", 0x1c000000, 0xfc000000, CBD|RD_s|RD_t, 0, I32R6}, {"bltuc", "s,t,p", 0x1c000000, 0xfc000000, CBD|RD_s|RD_t, 0, I32R6}, +{"nal", "p", 0x04100000, 0xffff0000, WR_31, 0, I32R6}, +{"bal", "p", 0x04110000, 0xffff0000, UBD|WR_31, 0, I32R6}, {"bc1eqz", "T,p", 0x45200000, 0xffe00000, CBD|RD_T|FP_S|FP_D, 0, I32R6}, {"bc1nez", "T,p", 0x45a00000, 0xffe00000, CBD|RD_T|FP_S|FP_D, 0, I32R6}, {"bc2eqz", "E,p", 0x49200000, 0xffe00000, CBD|RD_C2, 0, I32R6}, diff --git a/target-mips/translate.c b/target-mips/translate.c index e635999..de35b77 100644 --- a/target-mips/translate.c +++ b/target-mips/translate.c @@ -15809,6 +15809,9 @@ static void decode_opc_special_legacy(CPUMIPSState *env, DisasContext *ctx) gen_muldiv(ctx, op1, 0, rs, rt); break; #endif + case OPC_JR: + gen_compute_branch(ctx, op1, 4, rs, rd, sa); + break; case OPC_SPIM: #ifdef MIPS_STRICT_STANDARD MIPS_INVAL("SPIM"); @@ -15891,7 +15894,7 @@ static void decode_opc_special(CPUMIPSState *env, DisasContext *ctx) case OPC_XOR: gen_logic(ctx, op1, rd, rs, rt); break; - case OPC_JR ... OPC_JALR: + case OPC_JALR: gen_compute_branch(ctx, op1, 4, rs, rd, sa); break; case OPC_TGE ... OPC_TEQ: /* Traps */ @@ -16860,9 +16863,20 @@ static void decode_opc (CPUMIPSState *env, DisasContext *ctx) check_insn_opc_removed(ctx, ISA_MIPS32R6); case OPC_BLTZ: case OPC_BGEZ: + gen_compute_branch(ctx, op1, 4, rs, -1, imm << 2); + break; case OPC_BLTZAL: case OPC_BGEZAL: - gen_compute_branch(ctx, op1, 4, rs, -1, imm << 2); + if (ctx->insn_flags & ISA_MIPS32R6) { + if (rs == 0) { + /* OPC_NAL, OPC_BAL */ + gen_compute_branch(ctx, op1, 4, 0, -1, imm << 2); + } else { + generate_exception(ctx, EXCP_RI); + } + } else { + gen_compute_branch(ctx, op1, 4, rs, -1, imm << 2); + } break; case OPC_TGEI ... OPC_TEQI: /* REGIMM traps */ case OPC_TNEI: