From patchwork Thu Aug 19 09:04:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 499716 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp330735jab; Thu, 19 Aug 2021 02:11:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxci0zAmWMx/31FC1XA5LJdy8twzFf5xe8UjEP2UXq7lQ2daLjpxqJDKyIoabot37NGkJz X-Received: by 2002:a05:6e02:160f:: with SMTP id t15mr9585208ilu.60.1629364270602; Thu, 19 Aug 2021 02:11:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629364270; cv=none; d=google.com; s=arc-20160816; b=nNESLT43xBH4sXzJNC9COKh5Pnqysd4rIBQwBI8YG+H3Vk3QIVukZbusHOQdkGnAQB g85gvPhAKjpmbPJt4II0VkPUqElCig9SATpHQMT9O3DR32fIA+GTa1zDLcC/aTU9iknu npFbox6G903s2hSB5qiG0WItLQeS2HHHsI2gZYTA3+xcWu6aRJOrV3ikyJLYrbwYgir/ zF8YPoRaIjmxmUeD62MEnd4bQR2LNabJLJ6tr02MF0cYWe0vRNjOSyGZQ2pecjeCyAWC dxRR2bfXKTZribCKGhTKh0/++UiwRK8WLSe/aGHPmNQFINd9WLrER1B4V77IK3Q0+5li ksFQ== 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=L1Ca37LIpmgaqyZMi4/RcqkPLdV3DVwanjjFT5Igphs=; b=HBBOHFqvH0M3yuGMdAz80F9Hqk0Rmu4P+QTxVj5k/7JW46sGMkz2HA8tGsPRxiQxnH i+e4b13suB+SjsYeFw8EiRuQGitumF2DXuzFGGftw9DCVUCfVdQlF2lSaDPZsx4hypeM xvpeNj0d42HHfQXqgg3eJ5iu01Hz2dTKPMVuQs3J17om/+tiPMlUvipRXttugt6sm8ST cbtlj67RsGm8ZM5MZHib2h/C2nC+H5KWZd20prsrH3rlFRdZ2JX33EB7Q8jgk7jApP9h 8zal4AfKiE0jnMy83A+nvRUogQy4J0DeS6S5bbBtYMZQFSW2+egzituWyOICd/wIGnXG 37JQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=JWLOZrwT; 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 z26si2564696ioc.55.2021.08.19.02.11.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Aug 2021 02:11:10 -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=JWLOZrwT; 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]:39368 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mGe4r-0001fS-VL for patch@linaro.org; Thu, 19 Aug 2021 05:11:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43296) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mGdzP-0006VO-OV for qemu-devel@nongnu.org; Thu, 19 Aug 2021 05:05:31 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]:43840) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mGdzN-0000Jf-MR for qemu-devel@nongnu.org; Thu, 19 Aug 2021 05:05:31 -0400 Received: by mail-pl1-x634.google.com with SMTP id x1so972940plg.10 for ; Thu, 19 Aug 2021 02:05: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=L1Ca37LIpmgaqyZMi4/RcqkPLdV3DVwanjjFT5Igphs=; b=JWLOZrwTYbAU8Y9hLog5LDUip/t6W3JnY+ZoocOEvXmTQ6ItK/yVdkxUrAjUG7RH8z Q14Tw7a5Bq3fUBWGV8c+aNluJExi1v5cMTWXKhnXERJO8XhTW/4wL8NaWfnBqKFQY9hB TKjXiqilbx5PleY5O0WWfA7ZxG6ahbUxcYxmWL98FDkk3MLNSwYUukn9wpXwsTQiFBO9 4Q5jmMqPw08ho0sU+TSkfvXLLi+svq3M2Y4ijne/hO0XD0MliMpLcGM12BrGTD0itEAk vVG4vmYPa5wL3D8NOO3T13SgqdCoGvO6vQB+oWYmn2zIvxBQAkqcEgpQ4WxR/ADMrEOm Pq8A== 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=L1Ca37LIpmgaqyZMi4/RcqkPLdV3DVwanjjFT5Igphs=; b=bHleB2fE0mloF4MLh+vUwdtunKzk9dJwykXoBa2WbRhdBcU0HMW4BWIAOzxL8BZfm1 F0YCwFa5Nuf3KL6UeZq+/+0KQ9zWUn0hTdkLDV6sIHenV/md9vppH9CjVFa+RSOfUfEq ppczjdgecAJPXqTZgci7iDqgiAEecoL+4NjHWCIk5PWMJtDcBe8U9pHZyTvmYzbJELb4 EaivUpA1d5e8Kuqp3LooIFupzH0UxAsW+thij52iyk+661pA403HqoV19OngSn8ipS0N 1Wb3XyLYjyMSVLSqmVY4VMxyayv1NO7p4AGYDKs9bPl+OIrDyrYQJdxDF+uK5/2jlEbt lGGg== X-Gm-Message-State: AOAM533GGBonyqTHIVHgRkWucuk0RSXcAPAihSr5+dTX1b/2jIiQb2AH EcY4q33ihUb7sSX24JxUVPK+S0YRMvV4Xg== X-Received: by 2002:a17:90a:eb17:: with SMTP id j23mr13984091pjz.229.1629363928236; Thu, 19 Aug 2021 02:05:28 -0700 (PDT) Received: from localhost.localdomain ([173.197.107.15]) by smtp.gmail.com with ESMTPSA id j13sm2944707pgp.29.2021.08.19.02.05.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Aug 2021 02:05:28 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 14/21] target/riscv: Use {get, dest}_gpr for integer load/store Date: Wed, 18 Aug 2021 23:04:55 -1000 Message-Id: <20210819090502.428068-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210819090502.428068-1-richard.henderson@linaro.org> References: <20210819090502.428068-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x634.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=unavailable 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 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 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);