From patchwork Tue Jun 29 18:54:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 468333 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5252094jao; Tue, 29 Jun 2021 12:28:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxqABYuZSvHqE6NNsfs4ELK5JcBzjn1g1U+qck7YnpczIz1UCO5hV/WB19rFfJuo/FKI479 X-Received: by 2002:a67:7d4f:: with SMTP id y76mr106329vsc.33.1624994881995; Tue, 29 Jun 2021 12:28:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624994881; cv=none; d=google.com; s=arc-20160816; b=iKMlKx9X65S7DT2KqwRbqLlQq4PNq/aYA05vNgc2BaaaCL4lNhd3CCpRBz4nK2DIy9 /KBOV8adOlvyrIo7dGItLDemyWbVnQH9EPLmQ7WIgNepk60t4U3jL0g9K6LyVdamr9Yl X1QT8NTftz3B+zF5aeFEeKxkbDGdyT0jJSVeaQ3B8b5eOjFY8HJfrNBliHHdZx4BhUcJ /uNeaQv1o35cJ3REYBwu1ZyvcEK03ZTO7fzDI5yLtYPO0WYTFO8uvlfs4ntb9tBefdBj /mXsG9FX4Ibvt2mNorhRTh+zIhu+/vjyNapLxwGd/jfQObGq4zrSh8BxXOHM7rSTrpiJ 81cA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=FrwBhDQCYCaJpwhSjdhf5fz+by0Enz353wq4Nv/2fq8=; b=ZAZ6lI+Qa9ZcxW7o2voUjN3rRU7MXV29OZXvhrTCZxtlVsWyPcC/YPqTxwZGVoUeBP 0hKYsbuBdIeuMwkL3C59RgTFTyOyngdjz+8ht/zQ9V8Dck67dpbrwaVaib7mN3wzrLc/ 5MVxCToorwf2BycWdEQXi5ywQI21IxK0If8DQjlhrMxIC2hEr1Ua5dmBbLHfPwXqaTBD JhUq6nFyE2fYAFUUDA34atm/R5P7e0GvAmE20KSEcHAIxqXSE579ZttWlVbammqfyCLT Y3rsTii+973GhkARCdfIJ7m9Ynp2adPYX+UITzHV9JKGHbA5Ul3V1ntmm0TsWdV+PQPM sdKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xR2fVcSd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id j10si13549607vso.13.2021.06.29.12.28.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jun 2021 12:28:01 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xR2fVcSd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:44446 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyJOr-0005JP-1T for patch@linaro.org; Tue, 29 Jun 2021 15:28:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38448) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyItB-00082s-Pb for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:17 -0400 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]:39680) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyIt0-0000sN-8f for qemu-devel@nongnu.org; Tue, 29 Jun 2021 14:55:17 -0400 Received: by mail-pj1-x1033.google.com with SMTP id in17-20020a17090b4391b0290170ba0ec7fcso2259761pjb.4 for ; Tue, 29 Jun 2021 11:55:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FrwBhDQCYCaJpwhSjdhf5fz+by0Enz353wq4Nv/2fq8=; b=xR2fVcSdD4e5r70xErdBfEGnpO63HV70xfraA6+n/GTVW7wdxdigqe3TEo6vCJkUFc H8vpcWRgOnFkecA92lUlVRN3G86du/xi31XMi6pexQQZnlDFgu4pQjNkDU2bAemrRNd9 CXseCEGS4HjAn19/9icakwRV06t1exqp69zZfHaM1oqOUXLPi7sNFRZt/cmNYhNsLX71 ctoFPygXxwc29tqqAVwjB90MaUiy//tVTyMLPm5xc3LLS1PpK4Iereg6YxwngNW6DtrK xRv4qhxlprj+W49Hb5gWa2J6dt6+0RX8kbYdZD2Qsy5ot/iLslOO9crqNqfcMSDh39YV 6++Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FrwBhDQCYCaJpwhSjdhf5fz+by0Enz353wq4Nv/2fq8=; b=cLsJJjWyXQ6lMOgZowMXcbxvcgipixkN52hii0Z8OVJI+7Cuio/ZOj9o67dA3HbSLP eoBQ7GbKvCR5DYHaNPe66237t7jyoHgx9gHt06lgaifRlzjcMDsz22MqrdFDHegT9HH0 DEKlGR24ZOu/HA/HWEjAsn5ihESmudRa3enFqxG0+EnIb5XZbPsfp0H1lR2pkvET/NKJ q74yXk8MQJ5eFRi14zZo2CcyMOrr7fDRTQKBbDonT5EgMKNKmndyjxBwmPx/XbDP3lmt H24OM4l4QuLU6pGZ4uB2P18GIuETJ1FE9FeiavONDLYa/f1ck8LfCXesclqxUhvcTeyN xzkA== X-Gm-Message-State: AOAM530smYrrfcFHbqKRgNEVOAyc6kWUP8nSFxywO8w0rM9G4uS2po5G CzrUl8Wucmxmwsi/9mNy+wg1XpFQT66X7w== X-Received: by 2002:a17:90a:5202:: with SMTP id v2mr29064848pjh.169.1624992901224; Tue, 29 Jun 2021 11:55:01 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j2sm18811253pfb.53.2021.06.29.11.55.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 11:55:01 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 09/63] target/nios2: Use pc_next for pc + 4 Date: Tue, 29 Jun 2021 11:54:01 -0700 Message-Id: <20210629185455.3131172-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210629185455.3131172-1-richard.henderson@linaro.org> References: <20210629185455.3131172-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1033.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We have pre-computed the next instruction address into dc->base.pc_next, so we might as well use it. Reviewed-by: Peter Maydell Suggested-by: Peter Maydell Signed-off-by: Richard Henderson --- target/nios2/translate.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) -- 2.25.1 diff --git a/target/nios2/translate.c b/target/nios2/translate.c index abc7e5f96a..930f3d3395 100644 --- a/target/nios2/translate.c +++ b/target/nios2/translate.c @@ -211,7 +211,7 @@ static void jmpi(DisasContext *dc, uint32_t code, uint32_t flags) static void call(DisasContext *dc, uint32_t code, uint32_t flags) { - tcg_gen_movi_tl(cpu_R[R_RA], dc->pc + 4); + tcg_gen_movi_tl(cpu_R[R_RA], dc->base.pc_next); jmpi(dc, code, flags); } @@ -265,7 +265,7 @@ static void br(DisasContext *dc, uint32_t code, uint32_t flags) { I_TYPE(instr, code); - gen_goto_tb(dc, 0, dc->pc + 4 + (instr.imm16.s & -4)); + gen_goto_tb(dc, 0, dc->base.pc_next + (instr.imm16.s & -4)); dc->base.is_jmp = DISAS_NORETURN; } @@ -275,9 +275,9 @@ static void gen_bxx(DisasContext *dc, uint32_t code, uint32_t flags) TCGLabel *l1 = gen_new_label(); tcg_gen_brcond_tl(flags, cpu_R[instr.a], cpu_R[instr.b], l1); - gen_goto_tb(dc, 0, dc->pc + 4); + gen_goto_tb(dc, 0, dc->base.pc_next); gen_set_label(l1); - gen_goto_tb(dc, 1, dc->pc + 4 + (instr.imm16.s & -4)); + gen_goto_tb(dc, 1, dc->base.pc_next + (instr.imm16.s & -4)); dc->base.is_jmp = DISAS_NORETURN; } @@ -435,7 +435,7 @@ static void nextpc(DisasContext *dc, uint32_t code, uint32_t flags) R_TYPE(instr, code); if (likely(instr.c != R_ZERO)) { - tcg_gen_movi_tl(cpu_R[instr.c], dc->pc + 4); + tcg_gen_movi_tl(cpu_R[instr.c], dc->base.pc_next); } } @@ -448,7 +448,7 @@ static void callr(DisasContext *dc, uint32_t code, uint32_t flags) R_TYPE(instr, code); tcg_gen_mov_tl(cpu_R[R_PC], load_gpr(dc, instr.a)); - tcg_gen_movi_tl(cpu_R[R_RA], dc->pc + 4); + tcg_gen_movi_tl(cpu_R[R_RA], dc->base.pc_next); dc->base.is_jmp = DISAS_JUMP; }