From patchwork Mon Apr 24 05:40:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 676507 Delivered-To: patch@linaro.org Received: by 2002:a5d:4a41:0:0:0:0:0 with SMTP id v1csp1986452wrs; Sun, 23 Apr 2023 22:50:22 -0700 (PDT) X-Google-Smtp-Source: AKy350Y9IVOvETlZcfuYdHfmhETrh09fRZs/lWlnoAZbFg5o8LDvHva9jFB5eDtuGRjw3388cf5x X-Received: by 2002:a05:6214:2b08:b0:5ef:44fe:f69f with SMTP id jx8-20020a0562142b0800b005ef44fef69fmr25974192qvb.21.1682315422196; Sun, 23 Apr 2023 22:50:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682315422; cv=none; d=google.com; s=arc-20160816; b=TH0wcvI9pgTZ/+ap8DB8x9Ol0iWlvR9LAdXnH4CdgurV3dc2PfWgBZwB5LlXhtWzZD 1fyrJ6qj6EbZsF1Dr2Bz8eR0avTwZcCcRj4XHZZXwVtJyshVkCiHcgUZ54FVFV8io+2N /YlHdbYwjezwOEnyWP/xjA3XQ8Q8ZgXJ+4+fspFGr80zmc+ejFAhp3B0/WPbESDcxhrY pc/y3QpieGicYlGlM4ZE8zEounHFvqgAov/jH/kiPMDeQ1lzmbUCy81D7s7OsI3WpeEz DCYEAVEajRqfTiQAIuGKX+OfizS58aqEeKWThOAkUxmQcvhTyyzzXmDKjdIVUKQvIiyo j3oQ== 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=5ZL038/Ng9nS/xr0DDxwNdtMDtu/OB6KUuAjmGyJXv0=; b=SoZz6CsQbBPTu5Y0sqLLLgLNrT6Vef/oonv4Za/RfF4w8aDwHx6ViaJ9GAF5ABXOhy bJpR8MQMFzYm9RjgRsUvAgdjkqZQANDQKiTUKAHnwqybLx9wjA6ALz3XYpBlyX7Kg1mi /bQ/eOECbeQXov8Kr6DHWrgxdxTb6Lblwb3uYl4R3HpsudjhSxRVfR8pONRc9C4yyWtc 6f5GSUfF/WN7rN2TqYGYZCOCAMhVpjpbdq7B2kr+35Ph/NsBB2FSOxy71PytjQn2MOvX TfS7ALQKIcppwCE3zRsikmkt4TzA+IdBZRKQrxVJqLx+NgvwkMJr6n49N5B32jqLfqMo D+8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oltYc1Ib; 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 r5-20020a056214212500b005ef48c73f73si7080039qvc.231.2023.04.23.22.50.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 23 Apr 2023 22:50:22 -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=oltYc1Ib; 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 1pqp2N-00087c-P7; Mon, 24 Apr 2023 01:46:56 -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 1pqp0C-0005to-Bt for qemu-devel@nongnu.org; Mon, 24 Apr 2023 01:44:43 -0400 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pqp03-0005GQ-W6 for qemu-devel@nongnu.org; Mon, 24 Apr 2023 01:44:35 -0400 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-2f86ee42669so3818541f8f.2 for ; Sun, 23 Apr 2023 22:44:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1682315070; x=1684907070; 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=5ZL038/Ng9nS/xr0DDxwNdtMDtu/OB6KUuAjmGyJXv0=; b=oltYc1IboHs0WxDU+tq7KL0mu+avtM9cwzNM9fqVjgvg0fn4qOCEGKxaca2DYaSZJb CMuOdC4DcDFI3OrrfDg/5owpS1MPUNZfeJDh1x6EZLAfCQ6f40GMnJJt0KyOX4cjhvQ+ vzQHi2+wHuDlKdquO82wpTZzGrlDEwrSO97kuU8XkksPcW2AX7iiauokK+c+HW+hJL5B KCcUlbOBW3MV1z5DkXvHLao/dSr9xekuEVe17B3p8ot/i4gAcoV2lxA5+hwu7YgMQWs/ BZyVFOYKbcHoN8FDiTC6ZMt2IlMkdYqp3PnE+z4MPGfHqJSHHVwKCuVuJVj7M0bWvYDf +QMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682315070; x=1684907070; 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=5ZL038/Ng9nS/xr0DDxwNdtMDtu/OB6KUuAjmGyJXv0=; b=b/Dad374HK3YEah7VmOjZ8jEdNuXvEhZKxeS/U6/K8FEn54huuS347JgcmklhmZR9M LgXqigrv98lrcpROiH8R7GMfaCdZeMzDrVIqep3oqX/zCgDYmElAqzLcUmEz+3tHTrbN Bx0o6iH/PmCTSoXkIcg8355ePS5DE8YNyGQszoceC4tpXNvsIFdHskghZ+Jy/RqMJWxA OEeMD2OIqJHoVJTjUMdy3sj0peF9ASuLL8g13ltfLt9JyBENJ71rdgg3oirzJhlKXPcR hqgLXDPAN1ZdZfvDVlO8pS+8LtbbBG0Gq7BbAZQ8sWGjVoPeQkfneJulseBfRrZg3nFI 0GlQ== X-Gm-Message-State: AAQBX9fKVmNYriGX9SVyUFeXX8zLlJKA2sowhQHPa9qJUcdlRQxLsC7k w0fUmpgZ1neKs7LA1Bo4x9cDkel11GLbdkI4rxJ1Xg== X-Received: by 2002:a05:6000:1b8b:b0:304:71e8:d506 with SMTP id r11-20020a0560001b8b00b0030471e8d506mr2883301wru.48.1682315070505; Sun, 23 Apr 2023 22:44:30 -0700 (PDT) Received: from stoup.c.hoisthospitality.com (cust-west-loneq8-46-193-226-34.wb.wifirst.net. [46.193.226.34]) by smtp.gmail.com with ESMTPSA id u6-20020adff886000000b002f7780eee10sm9986693wrp.59.2023.04.23.22.44.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Apr 2023 22:44:30 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-s390x@nongnu.org, qemu-riscv@nongnu.org, qemu-ppc@nongnu.org, git@xen0n.name, jiaxun.yang@flygoat.com Subject: [PATCH v3 41/57] tcg/aarch64: Convert tcg_out_qemu_{ld,st}_slow_path Date: Mon, 24 Apr 2023 06:40:49 +0100 Message-Id: <20230424054105.1579315-42-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230424054105.1579315-1-richard.henderson@linaro.org> References: <20230424054105.1579315-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x42d.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=unavailable 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. Signed-off-by: Richard Henderson --- tcg/aarch64/tcg-target.c.inc | 40 +++++++++++++++--------------------- 1 file changed, 16 insertions(+), 24 deletions(-) diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc index 202b90c001..62dd22d73c 100644 --- a/tcg/aarch64/tcg-target.c.inc +++ b/tcg/aarch64/tcg-target.c.inc @@ -1580,13 +1580,6 @@ static void tcg_out_cltz(TCGContext *s, TCGType ext, TCGReg d, } } -static void tcg_out_adr(TCGContext *s, TCGReg rd, const void *target) -{ - ptrdiff_t offset = tcg_pcrel_diff(s, target); - tcg_debug_assert(offset == sextract64(offset, 0, 21)); - tcg_out_insn(s, 3406, ADR, rd, offset); -} - typedef struct { TCGReg base; TCGReg index; @@ -1627,47 +1620,46 @@ static void * const qemu_st_helpers[MO_SIZE + 1] = { #endif }; +static const TCGLdstHelperParam ldst_helper_param = { + .ntmp = 1, .tmp = { TCG_REG_TMP } +}; + static bool tcg_out_qemu_ld_slow_path(TCGContext *s, TCGLabelQemuLdst *lb) { - MemOpIdx oi = lb->oi; - MemOp opc = get_memop(oi); + MemOp opc = get_memop(lb->oi); if (!reloc_pc19(lb->label_ptr[0], tcg_splitwx_to_rx(s->code_ptr))) { return false; } - tcg_out_mov(s, TCG_TYPE_PTR, TCG_REG_X0, TCG_AREG0); - tcg_out_mov(s, TARGET_LONG_BITS == 64, TCG_REG_X1, lb->addrlo_reg); - tcg_out_movi(s, TCG_TYPE_I32, TCG_REG_X2, oi); - tcg_out_adr(s, TCG_REG_X3, lb->raddr); + tcg_out_ld_helper_args(s, lb, &ldst_helper_param); tcg_out_call_int(s, qemu_ld_helpers[opc & MO_SIZE]); - - tcg_out_movext(s, lb->type, lb->datalo_reg, - TCG_TYPE_REG, opc & MO_SSIZE, TCG_REG_X0); + tcg_out_ld_helper_ret(s, lb, false, &ldst_helper_param); tcg_out_goto(s, lb->raddr); return true; } static bool tcg_out_qemu_st_slow_path(TCGContext *s, TCGLabelQemuLdst *lb) { - MemOpIdx oi = lb->oi; - MemOp opc = get_memop(oi); - MemOp size = opc & MO_SIZE; + MemOp opc = get_memop(lb->oi); if (!reloc_pc19(lb->label_ptr[0], tcg_splitwx_to_rx(s->code_ptr))) { return false; } - tcg_out_mov(s, TCG_TYPE_PTR, TCG_REG_X0, TCG_AREG0); - tcg_out_mov(s, TARGET_LONG_BITS == 64, TCG_REG_X1, lb->addrlo_reg); - tcg_out_mov(s, size == MO_64, TCG_REG_X2, lb->datalo_reg); - tcg_out_movi(s, TCG_TYPE_I32, TCG_REG_X3, oi); - tcg_out_adr(s, TCG_REG_X4, lb->raddr); + tcg_out_st_helper_args(s, lb, &ldst_helper_param); tcg_out_call_int(s, qemu_st_helpers[opc & MO_SIZE]); tcg_out_goto(s, lb->raddr); return true; } #else +static void tcg_out_adr(TCGContext *s, TCGReg rd, const void *target) +{ + ptrdiff_t offset = tcg_pcrel_diff(s, target); + tcg_debug_assert(offset == sextract64(offset, 0, 21)); + tcg_out_insn(s, 3406, ADR, rd, offset); +} + static bool tcg_out_fail_alignment(TCGContext *s, TCGLabelQemuLdst *l) { if (!reloc_pc19(l->label_ptr[0], tcg_splitwx_to_rx(s->code_ptr))) {