From patchwork Tue Aug 17 21:17:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 498141 Delivered-To: patch@linaro.org Received: by 2002:a17:907:2648:0:0:0:0 with SMTP id ar8csp3533399ejc; Tue, 17 Aug 2021 14:30:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxK2wTfCgx2X852QjM3UCP53MNRefjU7731C26bLxyDw3ocoLbUjwuHHpPhk5Lb/krDtz6H X-Received: by 2002:a5e:c302:: with SMTP id a2mr4603068iok.83.1629235801175; Tue, 17 Aug 2021 14:30:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629235801; cv=none; d=google.com; s=arc-20160816; b=s5GYVNvC7Hz0fFeacan1XwjwQVHP/XMYpd7JitHGt4acKZbT5FmgyFVdx7iOeMpsWs s7sHgkddbFtwlRuxcIM2b61ykvUsFXWsaUkfIaoCvWLZjROkm32oRvUFYDM2MQ4zsw6N egrt+annpb3jjIPZGrF49pbEACiNRJ6VlJGD2Q+zIgPHNApdYqhWXAHo/483tDS1LJfy R3qscqNV8IqR9wOm4eNV8ydqd7Mp6S/O/yfagmnBBOU4KxfeeeiMh+iXCzC12ILoyMKW 7tGyKpwVNXwY/STC7hHOemT+3b6kcwBj01jLzXK0bEnm/O1ddx0b5haaSg7HBNqyl3yF HQew== 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=xy5SxA3eCt2ZryplWXTtOU5Re5HMsxcyIto5021c8Uk=; b=jlbtOvAaT/4bOMWsN0nENTsu9YBIOpISZV5+eaYqUUR5seNWpFMy4G1cqMC6wEZSA8 PGbIPlD0og02/xhdItxLFc3aw6ujCLLYG9VpraiyDCkDXgglo0Dx9TPLIYsk2pso/bDN Qnt1Xhy3kvwpxxMRiIM8/j9fXwbQEenncIpfH434QxB379GyPTUq2aFDpScRbCebi9I4 m1wrMxi7i32L5P33E3eYgaqAok0Gzor/3AcDGDduey51+4l/Pl1FozGy9INhf4dJxlje P8PFds9cE2JEnWQ+fxO/N6WP+q/jisMIcGyG2GhKO7u4d0mNG9E51Ov+nZUMZ+NIfrz/ Yzng== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=uQ+lW1NH; 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 w14si3547520ill.17.2021.08.17.14.30.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 17 Aug 2021 14:30: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=fail header.i=@linaro.org header.s=google header.b=uQ+lW1NH; 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]:52336 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mG6em-0002xt-HM for patch@linaro.org; Tue, 17 Aug 2021 17:30:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43706) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mG6Tg-0001gz-DQ for qemu-devel@nongnu.org; Tue, 17 Aug 2021 17:18:32 -0400 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]:37474) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mG6Td-0001EY-L1 for qemu-devel@nongnu.org; Tue, 17 Aug 2021 17:18:32 -0400 Received: by mail-pf1-x42d.google.com with SMTP id j187so6203pfg.4 for ; Tue, 17 Aug 2021 14:18:29 -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=xy5SxA3eCt2ZryplWXTtOU5Re5HMsxcyIto5021c8Uk=; b=uQ+lW1NHaEPZmNkWd/wGYFufGMSrLVR6oHbegb79cg91ln1JHMLjQ7X5zx7r2RC945 w+kbMt8go39VYFmIjEFpD00f2AQI1neE+7x3LNus0YDxvMpO2W3B/qE7RXTOhDFku0ZS H7ojhnnwfm9H8Nr1CYWF/kFA9+Nh2cRbcaSMfGHG4EnnUTZlDyC6RcUwx33Ahxp/3ovC W0Yx6pOVSSPgmhuYrrLzULW2MCdCIOnCLTW2zucK2tICyE9CLuBQLZ7Q0OWaMThgKd34 mug8kEVLPM62t6nJu1Ya37KcPJ7WiqTrX7Tlb2p+xl5JGfMIL81W6Hfjw1oyif1pFZCo aTQA== 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=xy5SxA3eCt2ZryplWXTtOU5Re5HMsxcyIto5021c8Uk=; b=OWH/rATCFUiSm1sTd56lJ45HNOG1IoBvlRPwXCgEkBthpfja7v3UsYrm3VbzphjH75 1ewcdqFlOUQBOPj50yjKaMAoufSzT8TxteZrQMErjDaEe7cHpL8qTez/OvHpw+d4AHy1 pn8Olv62ARKND0s5PuoK48BZhmmM4Fpsei6soHBYJOFbKVzvaOO6HL1DA5BJhcz3z3+v hih118BTCWfNuZDWKdznnPU0nx1nEduXcLArxnjIcgoDhhl0p6iQCGSGF2JYl9YbAa+1 M01GkNOOGKki0bJzuLw5rNnNGS+17sVsy8etaoPHs0TXag2cb6KlNYr8wZrDvNHngTyj YQUQ== X-Gm-Message-State: AOAM531H6bAuzLclo7YnLk5oKJduyrkHT8Pwx7xOworoQ7gZ7wYdL11s Rn8ySubhg+s7oj2HNlm0MkFNDdWQBAFi8A== X-Received: by 2002:a65:6805:: with SMTP id l5mr5454651pgt.0.1629235108295; Tue, 17 Aug 2021 14:18:28 -0700 (PDT) Received: from localhost.localdomain ([173.197.107.15]) by smtp.gmail.com with ESMTPSA id q1sm2978637pjl.44.2021.08.17.14.18.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Aug 2021 14:18:28 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 14/21] target/riscv: Use {get, dest}_gpr for integer load/store Date: Tue, 17 Aug 2021 11:17:56 -1000 Message-Id: <20210817211803.283639-15-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 Received-SPF: pass client-ip=2607:f8b0:4864:20::42d; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42d.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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- target/riscv/insn_trans/trans_rvi.c.inc | 36 +++++++++++++------------ 1 file changed, 19 insertions(+), 17 deletions(-) -- 2.25.1 Reviewed-by: Bin Meng diff --git a/target/riscv/insn_trans/trans_rvi.c.inc b/target/riscv/insn_trans/trans_rvi.c.inc index af3e0bc0e6..f616a26c82 100644 --- a/target/riscv/insn_trans/trans_rvi.c.inc +++ b/target/riscv/insn_trans/trans_rvi.c.inc @@ -138,15 +138,17 @@ 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(ctx, t0, a->rs1); - tcg_gen_addi_tl(t0, t0, a->imm); + TCGv dest = dest_gpr(ctx, a->rd); + TCGv addr = get_gpr(ctx, a->rs1, EXT_NONE); - tcg_gen_qemu_ld_tl(t1, t0, ctx->mem_idx, memop); - gen_set_gpr(ctx, a->rd, t1); - tcg_temp_free(t0); - tcg_temp_free(t1); + if (a->imm) { + TCGv temp = temp_new(ctx); + tcg_gen_addi_tl(temp, addr, a->imm); + addr = temp; + } + + tcg_gen_qemu_ld_tl(dest, addr, ctx->mem_idx, memop); + gen_set_gpr(ctx, a->rd, dest); return true; } @@ -177,19 +179,19 @@ 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(ctx, t0, a->rs1); - tcg_gen_addi_tl(t0, t0, a->imm); - gen_get_gpr(ctx, dat, a->rs2); + TCGv addr = get_gpr(ctx, a->rs1, EXT_NONE); + TCGv data = get_gpr(ctx, a->rs2, EXT_NONE); - tcg_gen_qemu_st_tl(dat, t0, ctx->mem_idx, memop); - tcg_temp_free(t0); - tcg_temp_free(dat); + if (a->imm) { + TCGv temp = temp_new(ctx); + tcg_gen_addi_tl(temp, addr, a->imm); + addr = temp; + } + + tcg_gen_qemu_st_tl(data, addr, ctx->mem_idx, memop); return true; } - static bool trans_sb(DisasContext *ctx, arg_sb *a) { return gen_store(ctx, a, MO_SB);