From patchwork Thu May 11 08:04:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 680855 Delivered-To: patch@linaro.org Received: by 2002:a5d:4a41:0:0:0:0:0 with SMTP id v1csp3265407wrs; Thu, 11 May 2023 01:06:36 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4VSj/SV76g0nFMmP26Wed9xkIEwbwdXhScsuZ/CSiTXhWHHw8lL2O0BXTA850RLxJpR9FE X-Received: by 2002:a05:6214:d05:b0:61b:637a:64df with SMTP id 5-20020a0562140d0500b0061b637a64dfmr26348572qvh.3.1683792396540; Thu, 11 May 2023 01:06:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683792396; cv=none; d=google.com; s=arc-20160816; b=LGfQqtWfzCeRisprvbX0azw51pTTmB5t+7W8hW2rYKv5s216nc3la/CONFkoLbTiQL tWsBlG8U0U94ZYJQo76BZ2IjCe9XN3Kk82yG/kMhmonp/FvlmnUlo4HW3TChHJ272SmQ jxFt/5BZABDh05tFCEiFzstRZJjkQt/pbxmdVpFOovmrlVyAWIiuohfPixtsn+RMPbGr Ko0fXVz6r3ev1je4Vtmq6xFxvCjpyodi7uzYtYBwMZpaigbaUDgvmh/MsJ50EFiWwaj2 uGbPEPTleaSlIU47Xn0WBO0c/J6FU4JUR/emU8PJxNX+HdH2ybqoT1KzanYQiguaS1eE 4OWw== 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=DNyOVYVbB6rri70d92kOlQalXLO+2p9TbN15kXr6tJA=; b=TSL46IQFMFR5B9cXbR1jR7JTOLkscvH3uEujkZAGk4hqXziBRkx653WIvaWUvhjrXY 78076wo3qteaR0zbAJi78iH58zOcq3L2wooOdrMeXxJET9t4gQ0utiDBrbpG9sCStyQz nvHQyC9H1uDRb4PZpaC7asEI6/eLwyVVCuvnOCNYIBeCjjgUlJv15rYouMGF4oKKjMbY aIxsda0fxTerU88c6YzNFBz4qZm5hUgl/maHYPXn7zteG0QTWBeNE7wdMH55O/GR5ZFb Rf5A1ATxvGTtsrj0/r3wqTCY4HjVhuMjmypOp6WQIg80MKdK2FPiZC120HpwNmrdiknC vYkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xHahpTdt; 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 dc53-20020a05620a523500b0074de8883cf6si6275059qkb.759.2023.05.11.01.06.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 11 May 2023 01:06:36 -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=xHahpTdt; 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 1px1JC-0007O6-Iy; Thu, 11 May 2023 04:05:55 -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 1px1Il-0006eZ-CQ for qemu-devel@nongnu.org; Thu, 11 May 2023 04:05:27 -0400 Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1px1IS-0000zo-MR for qemu-devel@nongnu.org; Thu, 11 May 2023 04:05:27 -0400 Received: by mail-ed1-x529.google.com with SMTP id 4fb4d7f45d1cf-50bc1612940so15018016a12.2 for ; Thu, 11 May 2023 01:05:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1683792307; x=1686384307; 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=DNyOVYVbB6rri70d92kOlQalXLO+2p9TbN15kXr6tJA=; b=xHahpTdtWuXdysS3gElUpUmTw+jL081oZopLuFV+XcDKAzkAlTb6PpbDwp2RZQlRTE XMI9KTO86GRenDTLi02VuTYkAS+d6xDD+GR5GCyii+I6dJ+Uo4giHbWfi2LMP0zyHCv0 NSl0yqEhb9Ke4BPskK5ZpAt/w19ErJwyba+dRUmtcZndTkCm8U9wGKezKMnYekXhimUG qh0/iAM5SSuZvt346VF9J9Lr9s8/r/V/DZU+b7thjShxlsaPh0eFGozYQ7y3jwk4VHRg lYHKthWai/f5QbvVOtfi2aDp2EJ0KswmH2Nyct/V87gGxGewsJnKQIrelRUl7v5pke/g lA6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683792307; x=1686384307; 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=DNyOVYVbB6rri70d92kOlQalXLO+2p9TbN15kXr6tJA=; b=PdZ2+MwuSCqhh6yzFo+Rulbhs7WkTFfbYrg7L1qya9VfSm/AvxIsdaujHYTBz29p+3 VSEpNy9YJ2VWFvakdq6b7fqWxN7u9A1jTDCzOv01MXr74dgMQinDiBkChVDgU5KKxf8W gq0fKBwR+1RQpAJvWtV8ye1BPuB1ERNe0wpa3EEP4y2UDBo61wV/4O5Q/eBZBTwo5iUK qvnuCNrDLvZJN1646/4cetvLtqovEXmhS1YXi9yv2xdPyutgwDRNaP2ogWs32zJyPoPU JO8dNxGYz7UU4xeVHt5Oc9fRq9ck7kqea8bqwjLhh/RKcv7lagjrUHnHtljInuTK2OKt LsPw== X-Gm-Message-State: AC+VfDywfyVmU6/8Jrz+Ssn02HDjSd8Hq518naLmQ0IwSz7HhYgVudYz avssUj0H7S4tHW6Z7Zot6l3WzvbhBRmqF70+8fdX1Q== X-Received: by 2002:a05:6402:10d7:b0:50d:bb87:2473 with SMTP id p23-20020a05640210d700b0050dbb872473mr6569472edu.1.1683792307242; Thu, 11 May 2023 01:05:07 -0700 (PDT) Received: from stoup.. ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id i12-20020aa7c70c000000b0050bd7267a5csm2662095edq.58.2023.05.11.01.05.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 May 2023 01:05:06 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= Subject: [PULL 23/53] tcg/aarch64: Convert tcg_out_qemu_{ld,st}_slow_path Date: Thu, 11 May 2023 09:04:20 +0100 Message-Id: <20230511080450.860923-24-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::529; envelope-from=richard.henderson@linaro.org; helo=mail-ed1-x529.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, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_HELO_TEMPERROR=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 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))) {