From patchwork Wed May 3 06:56:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 678609 Delivered-To: patch@linaro.org Received: by 2002:a5d:4a41:0:0:0:0:0 with SMTP id v1csp903952wrs; Wed, 3 May 2023 00:10:21 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6wc2gWYA5NTujiqyQopmvaoXjKIbbEYYMpcYJkiDUdTI0qeWFRk1yQzS3z/Imbz6II0cYn X-Received: by 2002:ac8:58d0:0:b0:3ef:68ea:e253 with SMTP id u16-20020ac858d0000000b003ef68eae253mr34146878qta.19.1683097821249; Wed, 03 May 2023 00:10:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683097821; cv=none; d=google.com; s=arc-20160816; b=yrpDkqcx3fQXQZlkysuP2mHdKq/AGeYhQaGhI9dLm0MkH992bOVZcfo/Fmcv7g8W8e I/3An8X4gA8swRYU4M4y43HK07IS7HxepvGLj1PsslsLyWL9LFk/G0dGIVbqtKUx0U4k kGTWfAsG5ny0Igp+tN/TJyMXlh0l02920yBekfbxjZQX+D6nt+WqszzbF15dH+ae1iwe BUouLIDDzfbnytLVQ5mYfD8ZD2pB9NRETeXic+ZG4wOl1EnH6nDB+xKBVD8RHpvjqWhU PY2PrTMyt32YfEbu+B5NrMsmjoIkpE9hhsbVm129rlaoUN00fk1RDHPf3fxtc5O9rqxZ nv5g== 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=fja0wPsN9Xk0mAqOYqTg0uadwoI8tQS6/n30AbiU824gGzu7d37Zq+MOgIz2DCTWQS Q/iBXdmLWw63D1In11PD2TPPOgI0c+9Aeu1nwXwvt4FEUEqzya+YMve18Ied6plg0y9T R8GV5FeONB+p9FFtbeINntEMvooBZfjn0xEVEjsr0OyNxvxBGrpsid4SiV5rgsFHO6ig k3DEakeFn+RkB+jDCQlM9ioUGUFPcyMMJvznhPYWWgeVf7nfWxQImgJzSmLT66fhdWBc pUgolJo6+0mCF8juxCD7O9TMGqgKqolRkAT2D4Gj886EIVnEL7qfNyP1Uyjsg3TMlnE6 L1bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uZ+5NMI9; 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 br14-20020a05620a460e00b0074dedab5fd3si18386958qkb.713.2023.05.03.00.10.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 03 May 2023 00:10:21 -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=uZ+5NMI9; 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 1pu6RQ-0008FE-NX; Wed, 03 May 2023 02:58:20 -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 1pu6RO-0008Cg-Km for qemu-devel@nongnu.org; Wed, 03 May 2023 02:58:18 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pu6Qv-0001oS-Si for qemu-devel@nongnu.org; Wed, 03 May 2023 02:58:18 -0400 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-2f95231618aso2885452f8f.1 for ; Tue, 02 May 2023 23:57:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1683097068; x=1685689068; 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=uZ+5NMI9M7q09ROGk49gTC9fdzFwIVOEU7bPfd+V2G8XMkqfXIDKdfMylt27OWIHOf Y0NXVChBnfKspZ3ZW4Hre66h3KTQOkpIlX0T2Tjb50508Ag+7+aff7amzVGQ9eyy/1+5 801LTplGqwQ7v+vfU2ZUZP1HAmfffFs1IJpApIoPEHpAaQed159O8H+v2LF07qp/neL9 Mo+qBjuOHw0zBwjKBUg+/PH8fJp8Ynx+M/5QI05r5jYDaeQ5xwmejqeO/12RqHxOVmRf 7lqAPpsJ2L+KlnjGUCj9Zb9Cj66tU8G3S3zwpXZOrHnRnXA0eYYssKMhhDPCGeT828Uz W/Hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683097068; x=1685689068; 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=agVChjOKUeKrZfTrrnOdo2tmF9Z+O3BzjTTjM5VPFhtUqRzWZmjKjQYb+v4OLPsStY Nhf1fC9UUbjNH8XBtBa5dufv47Vp2X6gGgyzc10R+VfYWUGEvQi9FdPkWoMXbA1xo9T9 PU3E1cEUrRyAP86Czz2xJyyIblkarYiHujEwe1a1LAsxcBfVbedXfqFigtcvzfj7ark2 x2KVLXgYUDv8gKAZqphisgEEvwT+3tkiZZ0r0NDD1uFztW0iUr57PpidysRgIvmhG6kO 7rOdpu+f57VPI2z7fZp5J7wFcgOK9NcINLruuRb+dTA7x4TkZn80T5om5Hktn+XH/+T5 mmqQ== X-Gm-Message-State: AC+VfDyWMykCHYQs8AXkFGvhepjGu9jIMOVdxyBXAwnMASM73Qqvzhy6 aGHhjLVFYWqguTSpPOtPKVVTO+ClJ3Z6KL5vpMNUBA== X-Received: by 2002:adf:dc8e:0:b0:306:2b31:5935 with SMTP id r14-20020adfdc8e000000b003062b315935mr7237871wrj.55.1683097068297; Tue, 02 May 2023 23:57:48 -0700 (PDT) Received: from stoup.Home ([2a02:c7c:74db:8d00:c01d:9d74:b630:9087]) by smtp.gmail.com with ESMTPSA id f6-20020a5d6646000000b002f6dafef040sm32796617wrw.12.2023.05.02.23.57.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 May 2023 23:57:48 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: git@xen0n.name, philmd@linaro.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, Daniel Henrique Barboza Subject: [PATCH v4 23/54] tcg/riscv: Rationalize args to tcg_out_qemu_{ld,st} Date: Wed, 3 May 2023 07:56:58 +0100 Message-Id: <20230503065729.1745843-24-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230503065729.1745843-1-richard.henderson@linaro.org> References: <20230503065729.1745843-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x434.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: