From patchwork Fri Jul 9 04:25:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 471773 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp945223jao; Thu, 8 Jul 2021 21:32:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyByPDkHWDoTEE/np2mHYr2WI+eR+HlB2Gua8QZwJoYmWOLT3MRlytT6suboksq/Xdp9Xou X-Received: by 2002:a37:d8d:: with SMTP id 135mr24165049qkn.398.1625805179520; Thu, 08 Jul 2021 21:32:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625805179; cv=none; d=google.com; s=arc-20160816; b=EHSPObD66r60tmvmppzf6tzraccPkiVnf8UHUPhy6VflPm5dyF4Oh1ZYJcG6MU6Zy1 j8fDRMvO1bM/+ebIykbh7nqwzYU5gJ5EPu20mNa87LaLV94Hgo5+H7PdKSriCWOLO2DB CSUzV2WIEH8u1g/vWgL/rEWuQT/MeSjGHmWFRloIHzJ2T7V/IwShAbPBwbKdG0wQzaAi x5PqyAAQLfriXfYyeFdcMHtTHur6bOGyKYVWGUR9MqW4rFlBuuI9QdLgmLALXiVVIi2L 6vnmjyRFDKrrNQMMk6Q0Dt2y1XPXaeNyPnykcBh00plFpwRpObBv/yQzG84KxVY0o7BI rzfw== 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=szhSmb+IJx7ewakRoFrjDYHYotl3MpERiZt5zOnrFx0=; b=SqQU+HrXlE6ORRZjrjdC9U3FtG0PR1xj5xDjS269cNu+wfoRc9pHVlhS0lMoLX62e6 r5fd5QNKGXFjH2DYjVOLrbX7ulD1wpA7r0lgnFvSG/bTwaI3v75ei6hC7FVhPu1Zpa2e If2XCGlLpcBGuEB/m0XDN2JpZYcUM2vD3mUIZgBG4amrFhRQyTtIU6lgkYI5jGwhF9dr Z/o62++bHzE+SoSg+T5KiRECnIHqmX5crh8FoJCKe1iEs0Y8f52xMbIh/ZVdXKBe6ZhX 1nrozd2uA+gE+FIqDi124WhrftMcfIrpJLiigXXSNiVMazwzfBHzBW3TetdQkTY1LZlI 3OHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=q7uMINch; 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=fail (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 p5si4162191qkj.204.2021.07.08.21.32.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Jul 2021 21:32:59 -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=fail header.i=@linaro.org header.s=google header.b=q7uMINch; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:37612 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m1iCA-0006or-Tp for patch@linaro.org; Fri, 09 Jul 2021 00:32:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53800) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m1i5s-0006EM-1e for qemu-devel@nongnu.org; Fri, 09 Jul 2021 00:26:28 -0400 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]:38613) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m1i5f-0001Uv-H8 for qemu-devel@nongnu.org; Fri, 09 Jul 2021 00:26:27 -0400 Received: by mail-pg1-x536.google.com with SMTP id h4so8694135pgp.5 for ; Thu, 08 Jul 2021 21:26:14 -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=szhSmb+IJx7ewakRoFrjDYHYotl3MpERiZt5zOnrFx0=; b=q7uMINchCES1mQq+pX+G8iVgE775IJn5ShMM9umTHDf3gf//6wdJ/f2A2FhH2l5z1k u7GrAC/UF8rqBX3vcd1s13JDghVlPsLNYulg2TBTE+bAFAn0E8gIl4lCnYSQA2ZWOLc6 awBgUQIzKRqjU0Wj9ftICavliqUWYhP3dPLiSZeVSrVXVqZIYRZ7rl+86nb0IUbL6ew1 YCLEZdjBAW5839prdg/q90nzY/WG/FaS9D14r6bCTB0avK+LADa4OtIEXqPrLtA85ZY6 HFe+0NP8RwSss60qGlZVOJBUCAW/ctwyJQlLizccbJa0Np/Qm2h2wQH8h5xEFgWzNuTd S9vA== 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=szhSmb+IJx7ewakRoFrjDYHYotl3MpERiZt5zOnrFx0=; b=cG7LBTOxMYB+vBDE7XTJkz0QfDcI2xwI2767ErZIVDkSy4QlhnIbexWu8rOaLT3Gp8 K0r2vHmjrhFGTBBHUtGx1D27cJxkyozhFGyu61sI54Tmw7yx+wdxKwpMFj8RzQ5X3hnC qFx1KmZoLxzz5pAQ2PB0+bhW2jS/gre6WCy+BZ+71eIy8GYo2SqLAhjsSxLWWeI917mX 088hYp4DrdwttJOkbPY7kQEOB53jRzpaRn9W+ZmpM35CrNShwF9mtFdiQ9u7hdnOseP8 ytu2sy0vxIoT7Mt4piatgaADKcHB6yHI+23+gfE9whzCXi6gw+oTbVTY8LIeNgCkjVOR S7lw== X-Gm-Message-State: AOAM532OeiHnQVGKQGuuwazoK9jgaLzTWiLEV9Hs2ylZG+8FN1KcvBdp f4s2kKioRwqNeCUngzqw+C+vc55cQ5Vlow== X-Received: by 2002:a63:170b:: with SMTP id x11mr8807075pgl.253.1625804773889; Thu, 08 Jul 2021 21:26:13 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id y16sm4406727pfe.70.2021.07.08.21.26.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jul 2021 21:26:13 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 07/17] target/riscv: Use gpr_{src, dst} for integer load/store Date: Thu, 8 Jul 2021 21:25:58 -0700 Message-Id: <20210709042608.883256-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210709042608.883256-1-richard.henderson@linaro.org> References: <20210709042608.883256-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::536; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x536.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, qemu-riscv@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- target/riscv/insn_trans/trans_rvi.c.inc | 45 +++++++++++++++---------- 1 file changed, 28 insertions(+), 17 deletions(-) -- 2.25.1 Reviewed-by: Alistair Francis diff --git a/target/riscv/insn_trans/trans_rvi.c.inc b/target/riscv/insn_trans/trans_rvi.c.inc index a603925637..a422dc9ef4 100644 --- a/target/riscv/insn_trans/trans_rvi.c.inc +++ b/target/riscv/insn_trans/trans_rvi.c.inc @@ -138,15 +138,21 @@ static bool trans_bgeu(DisasContext *ctx, arg_bgeu *a) static bool gen_load(DisasContext *ctx, arg_lb *a, MemOp memop) { - TCGv t0 = tcg_temp_new(); - TCGv t1 = tcg_temp_new(); - gen_get_gpr(t0, a->rs1); - tcg_gen_addi_tl(t0, t0, a->imm); + TCGv dest = gpr_dst(ctx, a->rd); + TCGv addr = gpr_src(ctx, a->rs1); + TCGv temp = NULL; - tcg_gen_qemu_ld_tl(t1, t0, ctx->mem_idx, memop); - gen_set_gpr(a->rd, t1); - tcg_temp_free(t0); - tcg_temp_free(t1); + if (a->imm) { + temp = tcg_temp_new(); + tcg_gen_addi_tl(temp, addr, a->imm); + addr = temp; + } + + tcg_gen_qemu_ld_tl(dest, addr, ctx->mem_idx, memop); + + if (temp) { + tcg_temp_free(temp); + } return true; } @@ -177,19 +183,24 @@ static bool trans_lhu(DisasContext *ctx, arg_lhu *a) static bool gen_store(DisasContext *ctx, arg_sb *a, MemOp memop) { - TCGv t0 = tcg_temp_new(); - TCGv dat = tcg_temp_new(); - gen_get_gpr(t0, a->rs1); - tcg_gen_addi_tl(t0, t0, a->imm); - gen_get_gpr(dat, a->rs2); + TCGv addr = gpr_src(ctx, a->rs1); + TCGv data = gpr_src(ctx, a->rs2); + TCGv temp = NULL; - tcg_gen_qemu_st_tl(dat, t0, ctx->mem_idx, memop); - tcg_temp_free(t0); - tcg_temp_free(dat); + if (a->imm) { + temp = tcg_temp_new(); + tcg_gen_addi_tl(temp, addr, a->imm); + addr = temp; + } + + tcg_gen_qemu_st_tl(data, addr, ctx->mem_idx, memop); + + if (temp) { + tcg_temp_free(temp); + } return true; } - static bool trans_sb(DisasContext *ctx, arg_sb *a) { return gen_store(ctx, a, MO_SB);