From patchwork Tue Sep 22 20:24:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 521430 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 75E2E1401AD for ; Wed, 23 Sep 2015 06:36:56 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=avt9D3gN; dkim-atps=neutral Received: from localhost ([::1]:42753 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZeUJ4-0007yD-Ee for incoming@patchwork.ozlabs.org; Tue, 22 Sep 2015 16:36:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41741) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZeUGA-0002cO-1K for qemu-devel@nongnu.org; Tue, 22 Sep 2015 16:33:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZeUG5-0006gz-6L for qemu-devel@nongnu.org; Tue, 22 Sep 2015 16:33:53 -0400 Received: from mail-io0-x230.google.com ([2607:f8b0:4001:c06::230]:35737) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZeUG5-0006gv-2Z for qemu-devel@nongnu.org; Tue, 22 Sep 2015 16:33:49 -0400 Received: by ioiz6 with SMTP id z6so26283007ioi.2 for ; Tue, 22 Sep 2015 13:33:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=l4bbryJ24aJoOlcByCskltYXy8MCJRyQ3TzRJZVZMyM=; b=avt9D3gNcoC62mE+rDBN+xTNE2qBWBqYbQyNDol+jOWt1JqQigeYyhMCgRRI3sfOG+ EG7V1WfWVCKStvWIGvfVSO2YaKRZPDST1esszg7zssX5GtMVxfcK6WjHF1oTSKRr+aDO ppb5tB7eeZ0EHFp3/EsA+90L6LI/OYKmAcapX9PoicduRZF1rTr0t0+7GZFYt+mcdw6M IpvG5C42bu1nEjdooqTzi5WBBVr4bxlcEM+jWb29e4Bfb8V9cHb+7/SI50kNV5ZRK412 gs9hRj/pi8TQMkV4Yt0iBjh5XFIdWgDHLB4/g5MmoF06Ix2iyndNXTYcz4srPrUWFudI AU0g== X-Received: by 10.107.34.18 with SMTP id i18mr34724681ioi.149.1442953556649; Tue, 22 Sep 2015 13:25:56 -0700 (PDT) Received: from bigtime.com (50-194-63-110-static.hfc.comcastbusiness.net. [50.194.63.110]) by smtp.gmail.com with ESMTPSA id 20sm1948550ioj.25.2015.09.22.13.25.55 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Sep 2015 13:25:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 22 Sep 2015 13:24:56 -0700 Message-Id: <1442953507-4074-15-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1442953507-4074-1-git-send-email-rth@twiddle.net> References: <1442953507-4074-1-git-send-email-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4001:c06::230 Cc: peter.maydell@linaro.org, alex.bennee@linaro.org, aurelien@aurel32.net Subject: [Qemu-devel] [PATCH v3 14/25] target-sparc: Remove gen_opc_jump_pc 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 Since jump_pc[1] is always npc + 4, we can infer after incrementing that jump_pc[1] == pc + 4. Because of that, we can encode the branch destination into a single word, and store that in npc. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Reviewed-by: Aurelien Jarno --- target-sparc/translate.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/target-sparc/translate.c b/target-sparc/translate.c index c6a8d86..25b5bc0 100644 --- a/target-sparc/translate.c +++ b/target-sparc/translate.c @@ -65,7 +65,6 @@ static TCGv cpu_wim; static TCGv_i64 cpu_fpr[TARGET_DPREGS]; static target_ulong gen_opc_npc[OPC_BUF_SIZE]; -static target_ulong gen_opc_jump_pc[2]; #include "exec/gen-icount.h" @@ -5250,6 +5249,10 @@ static inline void gen_intermediate_code_internal(SPARCCPU *cpu, tcg_ctx.gen_opc_instr_start[lj++] = 0; tcg_ctx.gen_opc_pc[lj] = dc->pc; gen_opc_npc[lj] = dc->npc; + if (dc->npc & JUMP_PC) { + assert(dc->jump_pc[1] == dc->pc + 4); + gen_opc_npc[lj] = dc->jump_pc[0] | JUMP_PC; + } tcg_ctx.gen_opc_instr_start[lj] = 1; tcg_ctx.gen_opc_icount[lj] = num_insns; } @@ -5321,8 +5324,6 @@ static inline void gen_intermediate_code_internal(SPARCCPU *cpu, #if 0 log_page_dump(); #endif - gen_opc_jump_pc[0] = dc->jump_pc[0]; - gen_opc_jump_pc[1] = dc->jump_pc[1]; } else { tb->size = last_pc + 4 - pc_start; tb->icount = num_insns; @@ -5450,17 +5451,17 @@ void gen_intermediate_code_init(CPUSPARCState *env) void restore_state_to_opc(CPUSPARCState *env, TranslationBlock *tb, int pc_pos) { - target_ulong npc; - env->pc = tcg_ctx.gen_opc_pc[pc_pos]; + target_ulong pc, npc; + env->pc = pc = tcg_ctx.gen_opc_pc[pc_pos]; npc = gen_opc_npc[pc_pos]; - if (npc == 1) { + if (npc == DYNAMIC_PC) { /* dynamic NPC: already stored */ - } else if (npc == 2) { + } else if (npc & JUMP_PC) { /* jump PC: use 'cond' and the jump targets of the translation */ if (env->cond) { - env->npc = gen_opc_jump_pc[0]; + env->npc = npc & ~3; } else { - env->npc = gen_opc_jump_pc[1]; + env->npc = pc + 4; } } else { env->npc = npc;