From nobody Tue Feb 10 10:20:38 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1629235692068685.6923219287638; Tue, 17 Aug 2021 14:28:12 -0700 (PDT) Received: from localhost ([::1]:47844 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mG6d1-0008Ky-0t for importer@patchew.org; Tue, 17 Aug 2021 17:28:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43666) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mG6Tf-0001dw-4X for qemu-devel@nongnu.org; Tue, 17 Aug 2021 17:18:31 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]:43544) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mG6Td-0001DL-KP for qemu-devel@nongnu.org; Tue, 17 Aug 2021 17:18:30 -0400 Received: by mail-pf1-x42f.google.com with SMTP id 7so5967pfl.10 for ; Tue, 17 Aug 2021 14:18:27 -0700 (PDT) Received: from localhost.localdomain ([173.197.107.15]) by smtp.gmail.com with ESMTPSA id q1sm2978637pjl.44.2021.08.17.14.18.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Aug 2021 14:18:26 -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=uXz1p1569OZLUX0VzAchBtPsRwQuQavRQcjQZ2ZJXHM=; b=QA4+CpWlaYS6RHsmL5XncSSx+elotGyNr/OyrW6tH3BPdhgueM/t7lODs58xA5+x5Z AdoMwoZZypfwKRSd7+lUQ8KZmTmKh/r0d45MNbOUGTBCifpmfvOrYgR6hZrZ5PCAHlsp Vw+mN9ehV25jXPe7AJkQeATyE51rG4eDmCsL9dUro3yxzGmhATjZguz+tFwcQwtn6ym+ pHqIZmmqQVVO440ZtkQK4Tb0XdKSkq905Fpvhum8m0UByOTqioQJqD/GsLvcRFSy24lq c2SGz7lgp65R9LjEUQY1rUIFxtvUprIUMQRv3Ko/3zYgTSM+WY8FH8WHKi0ESFx8tCpi on3g== 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=uXz1p1569OZLUX0VzAchBtPsRwQuQavRQcjQZ2ZJXHM=; b=pnbs4G/+6Dgx5IUIwz+3+ucXUSa5Fn7Oc4VnsFG6nLET18mE8CUTc938PSrnEwAeFR MNHLcbUbSmzZNNapFzBUNzxYIU1k2sQMcJ2JAVBBEYKtguMir6pzgWay+Q+FHx28jIX2 jrnMK6xDEXUEkRvAA9n1stmidqgtjlZLqBacjJvPb+jR8TnJhvzSkfCbS4Is+EpI1PIo oCtJnMtVjItIWNPonGHekvZva1rAccMfJnda1DZz7mqelAC5AVoujGjCRk7oNIgCekrU dTbohnKciUqcXpTxV0bUg46UizbNJB1L5ijONwrnZiF75p5mnuxZHrNz9vbaOh+mgW3R Wkjw== X-Gm-Message-State: AOAM532IE8QLZjbJlpyJOTX2qYMWKOJAAruhNc8gFI4/XxOVtXKhVucI 3wFNSHgGxzJoix3m2fkamTNpxWvZC3peHA== X-Google-Smtp-Source: ABdhPJwwFLFB0yEKoYaGU9nxyFy3ETFeEdy5LnlhzGhu3/7mmxpf8KxgaWxpqevXkSuQBFaTK/rxkA== X-Received: by 2002:a63:1247:: with SMTP id 7mr5264840pgs.366.1629235106795; Tue, 17 Aug 2021 14:18:26 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 13/21] target/riscv: Use get_gpr in branches Date: Tue, 17 Aug 2021 11:17:55 -1000 Message-Id: <20210817211803.283639-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210817211803.283639-1-richard.henderson@linaro.org> References: <20210817211803.283639-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42f.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: Alistair.Francis@wdc.com, bin.meng@windriver.com, qemu-riscv@nongnu.org, zhiwei_liu@c-sky.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1629235692999100001 Content-Type: text/plain; charset="utf-8" Narrow the scope of t0 in trans_jalr. Signed-off-by: Richard Henderson Reviewed-by: Bin Meng --- target/riscv/insn_trans/trans_rvi.c.inc | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/target/riscv/insn_trans/trans_rvi.c.inc b/target/riscv/insn_tr= ans/trans_rvi.c.inc index e25f64c45a..af3e0bc0e6 100644 --- a/target/riscv/insn_trans/trans_rvi.c.inc +++ b/target/riscv/insn_trans/trans_rvi.c.inc @@ -54,24 +54,25 @@ static bool trans_jal(DisasContext *ctx, arg_jal *a) =20 static bool trans_jalr(DisasContext *ctx, arg_jalr *a) { - /* no chaining with JALR */ TCGLabel *misaligned =3D NULL; - TCGv t0 =3D tcg_temp_new(); =20 - - gen_get_gpr(ctx, cpu_pc, a->rs1); - tcg_gen_addi_tl(cpu_pc, cpu_pc, a->imm); + tcg_gen_addi_tl(cpu_pc, get_gpr(ctx, a->rs1, EXT_NONE), a->imm); tcg_gen_andi_tl(cpu_pc, cpu_pc, (target_ulong)-2); =20 if (!has_ext(ctx, RVC)) { + TCGv t0 =3D tcg_temp_new(); + misaligned =3D gen_new_label(); tcg_gen_andi_tl(t0, cpu_pc, 0x2); tcg_gen_brcondi_tl(TCG_COND_NE, t0, 0x0, misaligned); + tcg_temp_free(t0); } =20 if (a->rd !=3D 0) { tcg_gen_movi_tl(cpu_gpr[a->rd], ctx->pc_succ_insn); } + + /* No chaining with JALR. */ lookup_and_goto_ptr(ctx); =20 if (misaligned) { @@ -80,21 +81,18 @@ static bool trans_jalr(DisasContext *ctx, arg_jalr *a) } ctx->base.is_jmp =3D DISAS_NORETURN; =20 - tcg_temp_free(t0); return true; } =20 static bool gen_branch(DisasContext *ctx, arg_b *a, TCGCond cond) { TCGLabel *l =3D gen_new_label(); - TCGv source1, source2; - source1 =3D tcg_temp_new(); - source2 =3D tcg_temp_new(); - gen_get_gpr(ctx, source1, a->rs1); - gen_get_gpr(ctx, source2, a->rs2); + TCGv src1 =3D get_gpr(ctx, a->rs1, EXT_SIGN); + TCGv src2 =3D get_gpr(ctx, a->rs2, EXT_SIGN); =20 - tcg_gen_brcond_tl(cond, source1, source2, l); + tcg_gen_brcond_tl(cond, src1, src2, l); gen_goto_tb(ctx, 1, ctx->pc_succ_insn); + gen_set_label(l); /* branch taken */ =20 if (!has_ext(ctx, RVC) && ((ctx->base.pc_next + a->imm) & 0x3)) { @@ -105,9 +103,6 @@ static bool gen_branch(DisasContext *ctx, arg_b *a, TCG= Cond cond) } ctx->base.is_jmp =3D DISAS_NORETURN; =20 - tcg_temp_free(source1); - tcg_temp_free(source2); - return true; } =20 --=20 2.25.1