From patchwork Wed Sep 1 02:09:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 504988 Delivered-To: patch@linaro.org Received: by 2002:a02:8629:0:0:0:0:0 with SMTP id e38csp3337542jai; Tue, 31 Aug 2021 19:27:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwLPLExAymCj4cuteH0pLK1YEgnDnuvF64dPypTG9x+vuxJk8MQ/efOY11VZRuV6taL1q2K X-Received: by 2002:a5e:d60e:: with SMTP id w14mr25423486iom.135.1630463275984; Tue, 31 Aug 2021 19:27:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630463275; cv=none; d=google.com; s=arc-20160816; b=xnOoSgwOtugM2eEakNkQz9qrMTlo+tbbyper1q0MBd4B3bF/YZqXaoidn/TCSLQv5T G7LM0eIB4LQEAAs6mtm2rKroyEQxQrVoV6VhKFH+In+htkgk9vgdb0ihY0KlqV2Zo01E tHiHzWBVHbUZE0CeHZA3lEvHO5ARvTaTZXOc2KLXsVoIzZi6Ba+nNOwxiRWXhyFfL1kA UcKoBiuYgkX7CkYyzPf2XjJKuHIGNHSvyXikSvr8DRruORXGyBwHViQ2SiLVDuW93MZb YaBGmJacQu5Fz/YFWRinVrcye2oM3j0Zh3UTGDKKwcfiUcG5IgJsnB9OdKq5STNSXXQu UnyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature:wdcironportexception:ironport-sdr:ironport-sdr :dkim-signature; bh=t3LuI7Bcg2zQvf0bf3Ps5IF+kpLPSsFRPrkB8wclFD8=; b=0NN7hUz8IXumHEhLCj8vCAtaFH1hyjsa980VvYUnPlMpaCL1nN+k2L2QKr6TYALADf IzJ8Cwe2yI04EeE083hPQLX+Z4XPXWXkTwTmn+KknulwL3KJVly2LoMDsCrTDLtVxnmD 60B7+32tIz39ah8cjybcgNNtjXN5PeKqp6IQ1T2cC5zs2wWalBp2DzsbWxnZriUMfoUA UvTEGoXCkvJXpoZHpTuC0r3UgiLqDIXodiOATARppmxjPWSrwH5N7YG6OVMY96Uo1kYw KEbXOZ0vrhDIndDGTwt62kvZZCRDLeDngigox9LYwwQ7HDdpqI1Z51rbAESSE6akC/q9 G74g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=bBH32zqG; dkim=pass header.i=@opensource.wdc.com header.s=dkim header.b=qwiMhJP3; 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=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=opensource.wdc.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 70si15617291jaj.18.2021.08.31.19.27.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 31 Aug 2021 19:27:55 -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=@wdc.com header.s=dkim.wdc.com header.b=bBH32zqG; dkim=pass header.i=@opensource.wdc.com header.s=dkim header.b=qwiMhJP3; 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=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=opensource.wdc.com Received: from localhost ([::1]:33936 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mLFyl-000063-CR for patch@linaro.org; Tue, 31 Aug 2021 22:27:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47264) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mLFkO-0007ul-Ic for qemu-devel@nongnu.org; Tue, 31 Aug 2021 22:13:09 -0400 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:10447) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mLFkE-0000pL-Dn for qemu-devel@nongnu.org; Tue, 31 Aug 2021 22:13:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1630462374; x=1661998374; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=sWmBwJwLtxFRNIwO20RvmCwHJuEQv09yP0QcAYcSYqE=; b=bBH32zqG/lMdJsDCHW4WSdpERyX7IXZuBVUTKsk6DoSGb6Z/ZFqPZCZ/ vRd5PrYKGLXirH+S3aKf9c2U8mEsXfZptxw/ABVF3Gn5mlEVEEqHwpAwF UrxKfraw1iULSBrngZ+4Raez7oZA+FgnkI/N6MIciNR1+LtUVh2ii5WRh P4iIneGbfLW/oozrdEksQxmuI61vj0hGhElxZEn0E6LJozuqLgpFdIi6w IDE5NYlQVgPnn7YSzju6GDVxEpt4hNfafJ75wTw3xkQvm+a0EDrxLrloi ftdb0Chq0YIlzJ9WL37CTBiYhbm+l1SB5uUX6umpgO/NDvvL84DOtU5QC g==; X-IronPort-AV: E=Sophos;i="5.84,368,1620662400"; d="scan'208";a="178011787" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 01 Sep 2021 10:12:53 +0800 IronPort-SDR: dWpt+OK7JDknIjStekfjXR7SuycKnYl2Emea1x1x2asciNXtqepCAweXAxGirh8XDX0yAkQ2+M mYHqzm6eDC7jHlepkLyokYvTd83Rvra4LNlq3Kr5q/5XPsthmA1LpdXRT6WG9QlPbOoc4Mgz9P MaoabBuwBv38/0xtjP0CiH5zghw8KNxaxt8MucT5ry/EedyyyRVu0fdX3EgyUI2utbC//y8G+r BVORL06OCzVoUPTehy1MVQ5I4L5VrEYIN+Va1PhiHb4hxBhk47aLdlG3q2mK/xkN9C3nLz05M0 qUmNnmb2h93U/XjFUE1PhihM Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Aug 2021 18:49:41 -0700 IronPort-SDR: bUWAYH/72Dv4SpFXk/brxjrVX7OHpGKus8VBMhlmR5d3r9fH8AbtDAaztWi/cA1rFsxZWoOm8B ySo3nnJy9sbGudZlLE6mmKfw1DojUA1WoyFYP5n00guTPSRAvMgphfJxZmak5n5D5j0Wt3y9RN u+0hUQ9GSraEewSc/trBSzUf0D06rgm53yDll/egYidUEmn/EW6u2Cg8BE5EcOcekZ2CHxtlDS ZoRmT86fadi/N4vrltPYEWbZebVDcnTbsbruKvBjYwYfWszPIDqjtB/RVoygt5tuhZIyNbqxKe k60= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Aug 2021 19:12:53 -0700 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4Gzndd2ltBz1RvmL for ; Tue, 31 Aug 2021 19:12:53 -0700 (PDT) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:subject:to :from; s=dkim; t=1630462368; x=1633054369; bh=sWmBwJwLtxFRNIwO20 RvmCwHJuEQv09yP0QcAYcSYqE=; b=qwiMhJP3OgWhUTOuPw8L3Y97W0gj3xnQqU Xh4PT6tAVlkUTQoIBdr1NDRoN3LIxh0jlZcCOMCQ4LwRvKfrrBQ/NRR7YFxXc2kR vEk3ZrEVNs092EUOwVta99DaXVfE5IJfB36TyhP7X1i7etVdpkI5Kq3qUaFmHVq6 QR0Kx5KvrKlAjW2rC2TBAaOANKt7mUtwSC8hoyOwQnDfZMs05+prF5VY5YUiJGcM d1ldset9+q5CSR58klOCw+sfHA4JjQwz9VtqW136GQ+gfef15RUW3sGSo04eLmNy 6xoBtiFdsK+p/6DMjOS4z3clvag5Z9o9mhKXV6TmGnVMVYeVtrPg== X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id HzQMbHkvK2Dz for ; Tue, 31 Aug 2021 19:12:48 -0700 (PDT) Received: from toolbox.alistair23.me (unknown [10.225.165.16]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4GzndS21wbz1RvlZ; Tue, 31 Aug 2021 19:12:43 -0700 (PDT) From: Alistair Francis To: qemu-devel@nongnu.org, peter.maydell@linaro.org Cc: alistair23@gmail.com, Richard Henderson , Bin Meng , Alistair Francis Subject: [PULL 28/33] target/riscv: Use {get,dest}_gpr for RVA Date: Wed, 1 Sep 2021 12:09:53 +1000 Message-Id: <20210901020958.458454-29-alistair.francis@opensource.wdc.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210901020958.458454-1-alistair.francis@opensource.wdc.com> References: <20210901020958.458454-1-alistair.francis@opensource.wdc.com> MIME-Version: 1.0 Received-SPF: pass client-ip=216.71.154.42; envelope-from=prvs=871df42ed=alistair.francis@opensource.wdc.com; helo=esa4.hgst.iphmx.com X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_PASS=-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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Reviewed-by: Bin Meng Signed-off-by: Richard Henderson Reviewed-by: Alistair Francis Message-id: 20210823195529.560295-20-richard.henderson@linaro.org Signed-off-by: Alistair Francis --- target/riscv/insn_trans/trans_rva.c.inc | 47 ++++++++++--------------- 1 file changed, 19 insertions(+), 28 deletions(-) -- 2.31.1 diff --git a/target/riscv/insn_trans/trans_rva.c.inc b/target/riscv/insn_trans/trans_rva.c.inc index 3cc3c3b073..6ea07d89b0 100644 --- a/target/riscv/insn_trans/trans_rva.c.inc +++ b/target/riscv/insn_trans/trans_rva.c.inc @@ -18,11 +18,10 @@ * this program. If not, see . */ -static inline bool gen_lr(DisasContext *ctx, arg_atomic *a, MemOp mop) +static bool gen_lr(DisasContext *ctx, arg_atomic *a, MemOp mop) { - TCGv src1 = tcg_temp_new(); - /* Put addr in load_res, data in load_val. */ - gen_get_gpr(ctx, src1, a->rs1); + TCGv src1 = get_gpr(ctx, a->rs1, EXT_ZERO); + if (a->rl) { tcg_gen_mb(TCG_MO_ALL | TCG_BAR_STRL); } @@ -30,33 +29,33 @@ static inline bool gen_lr(DisasContext *ctx, arg_atomic *a, MemOp mop) if (a->aq) { tcg_gen_mb(TCG_MO_ALL | TCG_BAR_LDAQ); } + + /* Put addr in load_res, data in load_val. */ tcg_gen_mov_tl(load_res, src1); gen_set_gpr(ctx, a->rd, load_val); - tcg_temp_free(src1); return true; } -static inline bool gen_sc(DisasContext *ctx, arg_atomic *a, MemOp mop) +static bool gen_sc(DisasContext *ctx, arg_atomic *a, MemOp mop) { - TCGv src1 = tcg_temp_new(); - TCGv src2 = tcg_temp_new(); - TCGv dat = tcg_temp_new(); + TCGv dest, src1, src2; TCGLabel *l1 = gen_new_label(); TCGLabel *l2 = gen_new_label(); - gen_get_gpr(ctx, src1, a->rs1); + src1 = get_gpr(ctx, a->rs1, EXT_ZERO); tcg_gen_brcond_tl(TCG_COND_NE, load_res, src1, l1); - gen_get_gpr(ctx, src2, a->rs2); /* * Note that the TCG atomic primitives are SC, * so we can ignore AQ/RL along this path. */ - tcg_gen_atomic_cmpxchg_tl(src1, load_res, load_val, src2, + dest = dest_gpr(ctx, a->rd); + src2 = get_gpr(ctx, a->rs2, EXT_NONE); + tcg_gen_atomic_cmpxchg_tl(dest, load_res, load_val, src2, ctx->mem_idx, mop); - tcg_gen_setcond_tl(TCG_COND_NE, dat, src1, load_val); - gen_set_gpr(ctx, a->rd, dat); + tcg_gen_setcond_tl(TCG_COND_NE, dest, dest, load_val); + gen_set_gpr(ctx, a->rd, dest); tcg_gen_br(l2); gen_set_label(l1); @@ -65,8 +64,7 @@ static inline bool gen_sc(DisasContext *ctx, arg_atomic *a, MemOp mop) * provide the memory barrier implied by AQ/RL. */ tcg_gen_mb(TCG_MO_ALL + a->aq * TCG_BAR_LDAQ + a->rl * TCG_BAR_STRL); - tcg_gen_movi_tl(dat, 1); - gen_set_gpr(ctx, a->rd, dat); + gen_set_gpr(ctx, a->rd, tcg_constant_tl(1)); gen_set_label(l2); /* @@ -75,9 +73,6 @@ static inline bool gen_sc(DisasContext *ctx, arg_atomic *a, MemOp mop) */ tcg_gen_movi_tl(load_res, -1); - tcg_temp_free(dat); - tcg_temp_free(src1); - tcg_temp_free(src2); return true; } @@ -85,17 +80,13 @@ static bool gen_amo(DisasContext *ctx, arg_atomic *a, void(*func)(TCGv, TCGv, TCGv, TCGArg, MemOp), MemOp mop) { - TCGv src1 = tcg_temp_new(); - TCGv src2 = tcg_temp_new(); - - gen_get_gpr(ctx, src1, a->rs1); - gen_get_gpr(ctx, src2, a->rs2); + TCGv dest = dest_gpr(ctx, a->rd); + TCGv src1 = get_gpr(ctx, a->rs1, EXT_NONE); + TCGv src2 = get_gpr(ctx, a->rs2, EXT_NONE); - (*func)(src2, src1, src2, ctx->mem_idx, mop); + func(dest, src1, src2, ctx->mem_idx, mop); - gen_set_gpr(ctx, a->rd, src2); - tcg_temp_free(src1); - tcg_temp_free(src2); + gen_set_gpr(ctx, a->rd, dest); return true; }