From patchwork Mon Aug 23 19:55:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 501557 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp2494537jab; Mon, 23 Aug 2021 13:02:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+bvwgzF4X6z/EZUIrUTq5N/Ck4AlCmk4sl2HKJ1IrA8f+E90kUHC32vv3x6afp+ukH0hq X-Received: by 2002:a17:906:4fd6:: with SMTP id i22mr37816123ejw.92.1629748942327; Mon, 23 Aug 2021 13:02:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629748942; cv=none; d=google.com; s=arc-20160816; b=Wb2Y6p2uw3DUNkVXSb3LlweTR05PTfm3yCnGDRffy5EBs5NvQlBKlvxEiGqdfd38Gj x5dDAG2QgyO4w+SYLfWF+78g5dL8x1iAInNJU0xWE0oQsdOIrjKfivbBPmkZw3UIrn84 RrCjJyrGhqRt1HaDVtfc+aQ3PkX8HYMC1RpdrNJZg7OYBfuj4ZSoqMxdPYIFG2knCZxp bQsqDYvJ+XUXUZ5CaIaGr1pp2zmrigJFD2VHIjxVq82cGyEhHBp56Va7ZZRrt4SSB2Zb 75dBJ7ImZ5uLcMh+pYupzNovD8CR0nGeoeiez1qwG5lDY3qfwwxwNxWStwVQbSHkl0Of AnbA== 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=3svrSKGyK2gNLdmgDufB06u2LSjvvw9Nja4N3/DHvjo=; b=dyc75n1M4IyiwJL1camPDn0cPyDDj4XDIGL8kktHNlHoTrnnF/JLAqAmHJThN/zGI4 VmaWVSKdLRuwDAw9UAQgIzJ0DSctXUlE0IRPc7wS043CykYOzBXy8cDgRf+XMHMMIRFY izT2X5uWi/Fzak5J6Mg5eMIZsOOQGMwJyjWRdeFPXCnFWeMMRr+CEbacgbaLCa0KkIXA y1auvYYvmUjIXqij8WB+dkj9TusCzatNDw6LCanu+K6YBsHgnk0nS3JkndAn2Mb1JZw6 EcMwwvEicV3Qj5q3C+rrOgMD4JGfE0vc6NJ/TqY+CXfD2lvLLdgolsM40YrpwBOpBAeK 79sQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=IYklu0hY; 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 j10si3294051edq.258.2021.08.23.13.02.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Aug 2021 13:02:22 -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=IYklu0hY; 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]:34490 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mIG9F-0002QH-Av for patch@linaro.org; Mon, 23 Aug 2021 16:02:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59576) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mIG2y-0006Sq-Bp for qemu-devel@nongnu.org; Mon, 23 Aug 2021 15:55:52 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]:37576) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mIG2p-0003A6-9w for qemu-devel@nongnu.org; Mon, 23 Aug 2021 15:55:52 -0400 Received: by mail-pf1-x42c.google.com with SMTP id j187so16295678pfg.4 for ; Mon, 23 Aug 2021 12:55:42 -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=3svrSKGyK2gNLdmgDufB06u2LSjvvw9Nja4N3/DHvjo=; b=IYklu0hY2DkuIvJjWuViiTKS2WLDUveaxGSz23O+ujEoSztmHcqo5Dk24/tOkEfFEr 0uMs/evghT0CW5Jkq3vub5Xc18Pwo9gPoob47Z1mM/HXHcZZe6AbJXCuVXNpGA1+kX3+ gP/wCB+0Un9gGqOwV/bg65VC/FhhK6UuB/+MoZtqFucIOczTBeO/JU7JaisZF8xg/a8f spWdR9DgWIME0MqkXByH1EaE3qdDUhVpaP76f2OF9S1CBnAtk/AQLEWkZdFLC3le5lJ9 VaoxnvVNT0cHA+piZuIWitMRKtdF1q6B/Oci+va72610s6+oqHT0WSREivlBwh6hElhY AZiQ== 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=3svrSKGyK2gNLdmgDufB06u2LSjvvw9Nja4N3/DHvjo=; b=rEJPgwkE0E3pSKmNmIVtlWWRUaUWjlJYC49BDCl+QQI1Br1OASQ1VLsSi6oentO8Nr pm+hSqNGjLDj9xd9WzNL6lRG+GjBJUHf04e7SVc71PMvpn98K+sIimRmP1IwQPwXdLSE PhcZorOZzPjZBS4tRvZN/LG9/o1tKYQ4+Dqk9SSPSo3AGvUBmbXcGCdF5YjL2fEz4sqP 48WcIOFItaxwcuga8j0iPHsgxyXoUQFNSz1FSS5LxAoS/msLx7B6s+bUXjJI9uulnQGf MlgXsZBjXKbnxPPsPxHWTxBJ6mWROQh3rejS6slrrR2qGxIK7JOY9Z7yI8dfGCiXILtA h7Qw== X-Gm-Message-State: AOAM5317DIAJT0kR0QP4FN8VAu/bz53RmX8UeT878iYRPCAKq7PSmm/5 jEUSSvJDSIPfx+GQ0tn825yuCqqEa26Hng== X-Received: by 2002:aa7:880f:0:b029:3e0:6f99:1f88 with SMTP id c15-20020aa7880f0000b02903e06f991f88mr35489825pfo.38.1629748541919; Mon, 23 Aug 2021 12:55:41 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id v15sm16685078pff.105.2021.08.23.12.55.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Aug 2021 12:55:41 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 15/24] target/riscv: Use {get, dest}_gpr for integer load/store Date: Mon, 23 Aug 2021 12:55:20 -0700 Message-Id: <20210823195529.560295-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210823195529.560295-1-richard.henderson@linaro.org> References: <20210823195529.560295-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42c; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42c.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, Bin Meng Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Bin Meng Reviewed-by: Alistair Francis Signed-off-by: Richard Henderson --- target/riscv/insn_trans/trans_rvi.c.inc | 36 +++++++++++++------------ 1 file changed, 19 insertions(+), 17 deletions(-) -- 2.25.1 diff --git a/target/riscv/insn_trans/trans_rvi.c.inc b/target/riscv/insn_trans/trans_rvi.c.inc index a5249e71c2..76454fb7e2 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);