From patchwork Fri May 5 21:24:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 679323 Delivered-To: patch@linaro.org Received: by 2002:a5d:4a41:0:0:0:0:0 with SMTP id v1csp579136wrs; Fri, 5 May 2023 14:26:30 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4qelYh1xrbx0+3peXTkM/Pn/gjD6hEPn4acw8LzoG6Jnc1oqq8A8vffE4/8VdX8fFY5Ixc X-Received: by 2002:a05:622a:209:b0:3b9:a4c8:d57a with SMTP id b9-20020a05622a020900b003b9a4c8d57amr4817116qtx.32.1683321990654; Fri, 05 May 2023 14:26:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683321990; cv=none; d=google.com; s=arc-20160816; b=sCqhckqoS3GNfOA+Xqvsv4fUT56wY4i1KGLnBTXtI/SM5Nyw56pAUJb94panClJKsu 8yxSdxCQqDx+/twdrP1Q0vLKkmxpRDO5lnlzBphKpxjeZCFSEGx7MxxWcUBk02gYmN+K TAaW6mSGwEq0CiqJD2lEU1qYdeEkDCYTOyov/3wVoJuaxN+jMNo2zEdf8kfsp3GiHMWW BmxuMUmCUklzOq2cX/C9SuoWtpqf3BNtcTtrw/A1XT/7o9aZSkCTC+ga0oR2Psc8XUfO S5TRZxPICjrm7azrw8v+qRZUR5m/31BuhXsB7iHMflDAukXtRL+ECSayA09T8n85l5e0 Y2kA== 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; bh=JJxFOupgqcim/2LBci4akZwRhrdPcb3HeKNOODAh8Zc=; b=uCkYdykDWvLCsqZblMmeTSkscnxyO4rD3Q/SYevs01uoQL9u7cHu2qNsS0RVorBCa8 bVHE28HEMup3ExLsLmGGHQO+mSsXytoOfZR647FYjWalofBcGo0+mKUckp7LgcAqWZlG er9JzUMmKHgX99DTobkgdJlswm/a7JDra0lQJNUulnBmvGmtgbxiLVCObICSO+AQdsEP BsVw6uUHKpxydZsmklab+9E6bn6/7bXFbSK8iHOcLu42U5A2p2Y1KQXZkeNlhDbSujeF lHLRX+k4s3fOggtJKXAD8IGc9OXJ9EsU1OlkJgBFSvYj4vizGqVkCp73sjeuxGtV/ysG +JsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Y4hyb2jT; 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=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 z6-20020a05622a060600b003f21f632b11si898154qta.422.2023.05.05.14.26.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 May 2023 14:26:30 -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=pass header.i=@linaro.org header.s=google header.b=Y4hyb2jT; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pv2vX-0000q2-Do; Fri, 05 May 2023 17:25:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pv2vU-0000o2-U9 for qemu-devel@nongnu.org; Fri, 05 May 2023 17:25:16 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pv2vN-0004fB-9k for qemu-devel@nongnu.org; Fri, 05 May 2023 17:25:16 -0400 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-3f415a9015bso3039355e9.2 for ; Fri, 05 May 2023 14:25:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1683321908; x=1685913908; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JJxFOupgqcim/2LBci4akZwRhrdPcb3HeKNOODAh8Zc=; b=Y4hyb2jTAechR5AjeQC8iE8o5K2DTu7jdbaZpRb74ZdIVk9RdF53GP2o4PdawrUt8r 1EcLKBpxg1Lw+6JYAHilQ701Wl0D2wqpn9/A4sNcngWi6wwRSVRfl5OgH9PoZ25gVvyU aIAeZ4Dte5V2E63bbXqBXpDBxeDYHntlyDNEg3QHC8INcX0TZNKo5rsVjrKdIhSqBJO4 BI7XFapPHEA/lqEV8WRh1TtVm5O7bcJm6uCNCCsFSyUIKHO+Qm/pJHTIypTdDp+o2WOW rnaVMpEn5G4+O1aPLmliN9Ct+d1GBvV4lrv9TC6sWgWmbtVSla/Z+YeggB5fX/zBMXjm Urcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683321908; x=1685913908; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JJxFOupgqcim/2LBci4akZwRhrdPcb3HeKNOODAh8Zc=; b=NvQYhZhAV9HXZg1OFeCvU3aud5wXKtCEmT4H6DaC5VdAQgB/YgE77iAJgbmvlDQpOf /7fKYxHKxobNX+/iUVjrJN7aRuoSONRTZ9/hca2ENMVTcQwIMPQr/LHiTQ3yIFmYt5ac kaXCJ5zPFkRlf2vcNM/eyxgzKdmXoU0BrlsY+5cCQQEn8v2giPuZJb5ujhDyXPZoGTWS ov/GYJ2MqZcZWZvF2FjzjBFpGipy5rWF8skYCaBuU++gkHo7SUkGns4SzJm3nKvvbMl9 9lFdW7KOZs/jqVSCQOMOw0H8S+ib8CxA56wXN6Q/MxqN2S6HadRw6IZARNaNcehaN8WP yyUg== X-Gm-Message-State: AC+VfDxK4oZRSqiD5eVdaqOsIFRcIiY0KCgx4txDKcaPFpVx5DCSss4I S8u7biXdiKocfAGP1/DYLaelmWwe9X3nR4epkWMjvA== X-Received: by 2002:a7b:c5c3:0:b0:3f3:2ba9:94e1 with SMTP id n3-20020a7bc5c3000000b003f32ba994e1mr2118353wmk.25.1683321907965; Fri, 05 May 2023 14:25:07 -0700 (PDT) Received: from stoup.. ([212.241.182.8]) by smtp.gmail.com with ESMTPSA id t14-20020a5d460e000000b003047ae72b14sm3426709wrq.82.2023.05.05.14.25.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 May 2023 14:25:07 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Daniel Henrique Barboza Subject: [PULL 34/42] tcg/riscv: Rationalize args to tcg_out_qemu_{ld,st} Date: Fri, 5 May 2023 22:24:39 +0100 Message-Id: <20230505212447.374546-35-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230505212447.374546-1-richard.henderson@linaro.org> References: <20230505212447.374546-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32d.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+patch=linaro.org@nongnu.org Interpret the variable argument placement in the caller. Pass data_type instead of is64 -- there are several places where we already convert back from bool to type. Clean things up by using type throughout. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Daniel Henrique Barboza Signed-off-by: Richard Henderson --- tcg/riscv/tcg-target.c.inc | 66 ++++++++++++++------------------------ 1 file changed, 24 insertions(+), 42 deletions(-) diff --git a/tcg/riscv/tcg-target.c.inc b/tcg/riscv/tcg-target.c.inc index 7a674ff5ce..a4cf60ca75 100644 --- a/tcg/riscv/tcg-target.c.inc +++ b/tcg/riscv/tcg-target.c.inc @@ -1087,7 +1087,7 @@ static bool tcg_out_qemu_st_slow_path(TCGContext *s, TCGLabelQemuLdst *l) #endif /* CONFIG_SOFTMMU */ static void tcg_out_qemu_ld_direct(TCGContext *s, TCGReg val, - TCGReg base, MemOp opc, bool is_64) + TCGReg base, MemOp opc, TCGType type) { /* Byte swapping is left to middle-end expansion. */ tcg_debug_assert((opc & MO_BSWAP) == 0); @@ -1106,7 +1106,7 @@ static void tcg_out_qemu_ld_direct(TCGContext *s, TCGReg val, tcg_out_opc_imm(s, OPC_LH, val, base, 0); break; case MO_UL: - if (is_64) { + if (type == TCG_TYPE_I64) { tcg_out_opc_imm(s, OPC_LWU, val, base, 0); break; } @@ -1122,30 +1122,21 @@ static void tcg_out_qemu_ld_direct(TCGContext *s, TCGReg val, } } -static void tcg_out_qemu_ld(TCGContext *s, const TCGArg *args, bool is_64) +static void tcg_out_qemu_ld(TCGContext *s, TCGReg data_reg, TCGReg addr_reg, + MemOpIdx oi, TCGType data_type) { - TCGReg addr_reg, data_reg; - MemOpIdx oi; - MemOp opc; -#if defined(CONFIG_SOFTMMU) - tcg_insn_unit *label_ptr[1]; -#else - unsigned a_bits; -#endif + MemOp opc = get_memop(oi); TCGReg base; - data_reg = *args++; - addr_reg = *args++; - oi = *args++; - opc = get_memop(oi); - #if defined(CONFIG_SOFTMMU) + tcg_insn_unit *label_ptr[1]; + base = tcg_out_tlb_load(s, addr_reg, oi, label_ptr, 1); - tcg_out_qemu_ld_direct(s, data_reg, base, opc, is_64); - add_qemu_ldst_label(s, 1, oi, (is_64 ? TCG_TYPE_I64 : TCG_TYPE_I32), - data_reg, addr_reg, s->code_ptr, label_ptr); + tcg_out_qemu_ld_direct(s, data_reg, base, opc, data_type); + add_qemu_ldst_label(s, true, oi, data_type, data_reg, addr_reg, + s->code_ptr, label_ptr); #else - a_bits = get_alignment_bits(opc); + unsigned a_bits = get_alignment_bits(opc); if (a_bits) { tcg_out_test_alignment(s, true, addr_reg, a_bits); } @@ -1158,7 +1149,7 @@ static void tcg_out_qemu_ld(TCGContext *s, const TCGArg *args, bool is_64) tcg_out_opc_reg(s, OPC_ADD, TCG_REG_TMP0, TCG_GUEST_BASE_REG, base); base = TCG_REG_TMP0; } - tcg_out_qemu_ld_direct(s, data_reg, base, opc, is_64); + tcg_out_qemu_ld_direct(s, data_reg, base, opc, data_type); #endif } @@ -1186,30 +1177,21 @@ static void tcg_out_qemu_st_direct(TCGContext *s, TCGReg val, } } -static void tcg_out_qemu_st(TCGContext *s, const TCGArg *args, bool is_64) +static void tcg_out_qemu_st(TCGContext *s, TCGReg data_reg, TCGReg addr_reg, + MemOpIdx oi, TCGType data_type) { - TCGReg addr_reg, data_reg; - MemOpIdx oi; - MemOp opc; -#if defined(CONFIG_SOFTMMU) - tcg_insn_unit *label_ptr[1]; -#else - unsigned a_bits; -#endif + MemOp opc = get_memop(oi); TCGReg base; - data_reg = *args++; - addr_reg = *args++; - oi = *args++; - opc = get_memop(oi); - #if defined(CONFIG_SOFTMMU) + tcg_insn_unit *label_ptr[1]; + base = tcg_out_tlb_load(s, addr_reg, oi, label_ptr, 0); tcg_out_qemu_st_direct(s, data_reg, base, opc); - add_qemu_ldst_label(s, 0, oi, (is_64 ? TCG_TYPE_I64 : TCG_TYPE_I32), - data_reg, addr_reg, s->code_ptr, label_ptr); + add_qemu_ldst_label(s, false, oi, data_type, data_reg, addr_reg, + s->code_ptr, label_ptr); #else - a_bits = get_alignment_bits(opc); + unsigned a_bits = get_alignment_bits(opc); if (a_bits) { tcg_out_test_alignment(s, false, addr_reg, a_bits); } @@ -1508,16 +1490,16 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, break; case INDEX_op_qemu_ld_i32: - tcg_out_qemu_ld(s, args, false); + tcg_out_qemu_ld(s, a0, a1, a2, TCG_TYPE_I32); break; case INDEX_op_qemu_ld_i64: - tcg_out_qemu_ld(s, args, true); + tcg_out_qemu_ld(s, a0, a1, a2, TCG_TYPE_I64); break; case INDEX_op_qemu_st_i32: - tcg_out_qemu_st(s, args, false); + tcg_out_qemu_st(s, a0, a1, a2, TCG_TYPE_I32); break; case INDEX_op_qemu_st_i64: - tcg_out_qemu_st(s, args, true); + tcg_out_qemu_st(s, a0, a1, a2, TCG_TYPE_I64); break; case INDEX_op_extrh_i64_i32: