From patchwork Thu May 11 08:04:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 680858 Delivered-To: patch@linaro.org Received: by 2002:a5d:4a41:0:0:0:0:0 with SMTP id v1csp3265489wrs; Thu, 11 May 2023 01:06:50 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4hJw0HEJqle+XK7NnCyLGsnC8EFRoZ+M2IC7VSudkajTiKxc2XsMP7RnDCWntFerkrc28U X-Received: by 2002:a05:622a:1a29:b0:3f1:f8fa:11c7 with SMTP id f41-20020a05622a1a2900b003f1f8fa11c7mr30373462qtb.34.1683792410681; Thu, 11 May 2023 01:06:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683792410; cv=none; d=google.com; s=arc-20160816; b=ygkdthf250FtZmJdcQPeWsEhWHoWUl8ooKyoQMt5BoVodOK5skhgX9xrJ0uTxPACSi 6mpMg0BlKAGqspAchl/t2UfWGbuyezViJ7JA5dCvEeEPTCFziQhuD1n5MBTkuUSjpL6O M+fxqL+Zx94z8qvN3/un8eGsRMbCuTqd+N1N+SDBPvjsIF7IamtSnFnZOb1ZFd1GI14a ZVqZUG3z1KyP2q4oKjuWsS2nhAqFoGG3YwVafc1S88F6eSJjX0AiLuKIRplVOffLn6hL D0sgx4OOP1APsVs6+0BkGbCYkyEK/A5wMfaMvSWvsw/gt4ZJYnFYJIASVbfprjJXvLjE 1oCw== 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=Y/Z9z3KxUvkNWrhd72QB2/LSG455kaOK5ErkxE1hIbM=; b=iHjWobAlJODJ/b8DaUHtbVkwf8NJKRuUZjcoesVTMzW1O1iVaKGbhE3HYZjcY+uigd sXfA4hDVDqoqeQUoYYX0gvpn7MmRg1TRvrF/lJPvYUHVjKQ2NXcaMspwU1GAR32PBxoW 2wx+BU5mKFURWHTvt+Cfyz9PwgjPAFyF0KszfyETRc8r82Ad/4mYo5bxBf5Lm+T0Qmzk FO6zO2TOGDGYMb3iLIxrJQ9ghBO5rC4o71uuxnSQhrB9O6AO252NIm8ngKU0DAtYYSvW kOxgcUdZksE5EFgwSRSiQya0dWvZihRIZAEW6OF2PxcyDyhZDKgSeZpLJ4KjjzpB2N8N yz7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pA8BB7db; 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 n14-20020ae9c30e000000b0074df9f1f2aasi6283206qkg.690.2023.05.11.01.06.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 11 May 2023 01:06:50 -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=pA8BB7db; 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 1px1J8-0007Hq-7n; Thu, 11 May 2023 04:05:51 -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 1px1Ie-0006Qz-Hv for qemu-devel@nongnu.org; Thu, 11 May 2023 04:05:24 -0400 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1px1IV-00010Q-52 for qemu-devel@nongnu.org; Thu, 11 May 2023 04:05:20 -0400 Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-50b9ef67f35so14689783a12.2 for ; Thu, 11 May 2023 01:05:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1683792310; x=1686384310; 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=Y/Z9z3KxUvkNWrhd72QB2/LSG455kaOK5ErkxE1hIbM=; b=pA8BB7dbSKcNeQ15eOmUwQYTg0FQuh9X6mST9bfxMv4rQ6i3230NU7IOmvRVHeiLCs iFDqQzbjXZNl1SxDKtAvAFw7zj35U56oGDxk7kXerzvj+i+aA4ffiJMBrBKbJ1DRWry4 oDyufdTMP0aPRI1B5OSoJKgVLTOKh75EfL6/pQbsPDzxeL16lTNL772ix9gTfOunjxWb smynthsmlMH2YCyBMoszWc6z2kJR15lA9gDAVCDQ/lXtcB+CcydKeQHDRt1BqKMSkjWA X9UiU7YQRma9hHfMeBq2Vl40M0Kqfx/+Grpavl6ZosBPbgeGmcUsiYXcWhwFPJ5mg2BU H6kA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683792310; x=1686384310; 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=Y/Z9z3KxUvkNWrhd72QB2/LSG455kaOK5ErkxE1hIbM=; b=PcaxkO1kDPuHxsZ8BbR8mlPAziQMEqJqTRj7xYNbzhPCm+FOfMPa3ad/hDRnuT9uGl ayaaMjgmaj7uAcu5wWnhAxK7PoNPPkPwTbUKWua/CSCz8KnCFys+R66e2/jzlxvSEQJH qKy7DkCNTLPfmBJVx3zqujyHdZkFH3sNBbxfYmEZb9SJR0JCZubbJo5JiqOJzb3rpAe2 Bud0x9oBKB+6Gkvtfix0a5dDF6xVqLn+12NWyX1Rzuf575qweqZI0MTASfB7O1mZsPCj CKlcEJoL+kAyT+JbngIz3Z2NzEgqCGLH8e5ojl6e9iCskr/2eaoGRxtrv9zEhv02FTLS t13g== X-Gm-Message-State: AC+VfDx5WvjYoRJOIDTv4k0VHxsLvlmVTAEy/2xJ1rUBCKd+XtadQ6+3 AsXG5GobMuOcUqxQQWECPCmjs+KQy2ijJYbHTM2Icg== X-Received: by 2002:a05:6402:1a48:b0:50c:d5d:c960 with SMTP id bf8-20020a0564021a4800b0050c0d5dc960mr16519972edb.38.1683792309879; Thu, 11 May 2023 01:05:09 -0700 (PDT) Received: from stoup.. ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id i12-20020aa7c70c000000b0050bd7267a5csm2662095edq.58.2023.05.11.01.05.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 May 2023 01:05:09 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Daniel Henrique Barboza Subject: [PULL 28/53] tcg/riscv: Convert tcg_out_qemu_{ld,st}_slow_path Date: Thu, 11 May 2023 09:04:25 +0100 Message-Id: <20230511080450.860923-29-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230511080450.860923-1-richard.henderson@linaro.org> References: <20230511080450.860923-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::530; envelope-from=richard.henderson@linaro.org; helo=mail-ed1-x530.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 Use tcg_out_ld_helper_args, tcg_out_ld_helper_ret, and tcg_out_st_helper_args. Reviewed-by: Alex Bennée Reviewed-by: Daniel Henrique Barboza Signed-off-by: Richard Henderson --- tcg/riscv/tcg-target.c.inc | 37 ++++++++++--------------------------- 1 file changed, 10 insertions(+), 27 deletions(-) diff --git a/tcg/riscv/tcg-target.c.inc b/tcg/riscv/tcg-target.c.inc index 2b2d313fe2..c22d1e35ac 100644 --- a/tcg/riscv/tcg-target.c.inc +++ b/tcg/riscv/tcg-target.c.inc @@ -906,14 +906,14 @@ static void tcg_out_goto(TCGContext *s, const tcg_insn_unit *target) tcg_debug_assert(ok); } +/* We have three temps, we might as well expose them. */ +static const TCGLdstHelperParam ldst_helper_param = { + .ntmp = 3, .tmp = { TCG_REG_TMP0, TCG_REG_TMP1, TCG_REG_TMP2 } +}; + static bool tcg_out_qemu_ld_slow_path(TCGContext *s, TCGLabelQemuLdst *l) { - MemOpIdx oi = l->oi; - MemOp opc = get_memop(oi); - TCGReg a0 = tcg_target_call_iarg_regs[0]; - TCGReg a1 = tcg_target_call_iarg_regs[1]; - TCGReg a2 = tcg_target_call_iarg_regs[2]; - TCGReg a3 = tcg_target_call_iarg_regs[3]; + MemOp opc = get_memop(l->oi); /* resolve label address */ if (!reloc_sbimm12(l->label_ptr[0], tcg_splitwx_to_rx(s->code_ptr))) { @@ -921,13 +921,9 @@ static bool tcg_out_qemu_ld_slow_path(TCGContext *s, TCGLabelQemuLdst *l) } /* call load helper */ - tcg_out_mov(s, TCG_TYPE_PTR, a0, TCG_AREG0); - tcg_out_mov(s, TCG_TYPE_PTR, a1, l->addrlo_reg); - tcg_out_movi(s, TCG_TYPE_PTR, a2, oi); - tcg_out_movi(s, TCG_TYPE_PTR, a3, (tcg_target_long)l->raddr); - + tcg_out_ld_helper_args(s, l, &ldst_helper_param); tcg_out_call_int(s, qemu_ld_helpers[opc & MO_SSIZE], false); - tcg_out_mov(s, (opc & MO_SIZE) == MO_64, l->datalo_reg, a0); + tcg_out_ld_helper_ret(s, l, true, &ldst_helper_param); tcg_out_goto(s, l->raddr); return true; @@ -935,14 +931,7 @@ static bool tcg_out_qemu_ld_slow_path(TCGContext *s, TCGLabelQemuLdst *l) static bool tcg_out_qemu_st_slow_path(TCGContext *s, TCGLabelQemuLdst *l) { - MemOpIdx oi = l->oi; - MemOp opc = get_memop(oi); - MemOp s_bits = opc & MO_SIZE; - TCGReg a0 = tcg_target_call_iarg_regs[0]; - TCGReg a1 = tcg_target_call_iarg_regs[1]; - TCGReg a2 = tcg_target_call_iarg_regs[2]; - TCGReg a3 = tcg_target_call_iarg_regs[3]; - TCGReg a4 = tcg_target_call_iarg_regs[4]; + MemOp opc = get_memop(l->oi); /* resolve label address */ if (!reloc_sbimm12(l->label_ptr[0], tcg_splitwx_to_rx(s->code_ptr))) { @@ -950,13 +939,7 @@ static bool tcg_out_qemu_st_slow_path(TCGContext *s, TCGLabelQemuLdst *l) } /* call store helper */ - tcg_out_mov(s, TCG_TYPE_PTR, a0, TCG_AREG0); - tcg_out_mov(s, TCG_TYPE_PTR, a1, l->addrlo_reg); - tcg_out_movext(s, s_bits == MO_64 ? TCG_TYPE_I64 : TCG_TYPE_I32, a2, - l->type, s_bits, l->datalo_reg); - tcg_out_movi(s, TCG_TYPE_PTR, a3, oi); - tcg_out_movi(s, TCG_TYPE_PTR, a4, (tcg_target_long)l->raddr); - + tcg_out_st_helper_args(s, l, &ldst_helper_param); tcg_out_call_int(s, qemu_st_helpers[opc & MO_SIZE], false); tcg_out_goto(s, l->raddr);