From patchwork Tue Apr 11 01:04:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 672296 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:184:0:0:0:0 with SMTP id p4csp536475wrx; Mon, 10 Apr 2023 18:09:58 -0700 (PDT) X-Google-Smtp-Source: AKy350a742gsRboR90sflY0mstvOZTIDtMjyqEaKIGr1XelcMe1vAfLbBrwlQg2sUow7D3s8PkCS X-Received: by 2002:a05:6214:2581:b0:5cc:277c:b47 with SMTP id fq1-20020a056214258100b005cc277c0b47mr1857657qvb.36.1681175398159; Mon, 10 Apr 2023 18:09:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681175398; cv=none; d=google.com; s=arc-20160816; b=hh6PNvpw5iyJhcHXeud0d7Xd0jXmeTGA1BanbVXOq0IZrcQ1fpU5hhjHt776fhv/Oc /fqeNxGG5/TI4G1dhJHZFAfy4gIGjWthswHP1YF2kV6e7Mx4L+4Lxsyn/ZjvzHz7CzGy Msb9U9k/rF2+I/gC9JpTqPU4ff/WHeHrNnG+ZKYdwUFaEWA6jrNXOjgyCdVzWFledq8v +bEGADZH9uKb0vorZdfF09d+OBXWk59iMBwRdbkpf2/DdNDqoQLyckFzPT0A5BynoIzW jBn5PLQYv9aaNSLqMYeB4JBDSMUfp+8shLdHSs8EGa+Y2d0sgI5uoLqHL+915UcJ01jc nZMw== 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=a4BNCRZN5AKwamsHlqYnaohwz80p9xuy09nGxbOHXPU=; b=Wm3c1I+3ACu4iuzkT2wnPEzDzYtVLuShIjB4gX6dn9cC1PopUD5By3pwewInkruxZq HtOIvXvtEb6eQcvUglEP7y4twhkGcziaPVzT1Q6JPZt/swCBiTxjrmF3l42BXDR0GmCs 2fD30EVOeoGaqoIuBGKB9Ujzw45FipeJN66H6QYb/VkhbgyZ8dVTYFx0ZGY3ynmi+iys bQWtZFPHC7OvxEI7jUGHxXIKUeyZotpepjNW31SZ6/0gS9bT3nTRcScQmRov0oP6710z A8H84IpqBAZA0vNlz06ZIJ8+Rn0qd/yh5iiqgMe1CAw8lMxWCJ0o2YRr9FuYTeGaSA14 LRXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Jldmccfh; 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 js11-20020a0562142aab00b005cf2cd1d2cfsi8232594qvb.510.2023.04.10.18.09.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 10 Apr 2023 18:09:58 -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=Jldmccfh; 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 1pm2TP-0007yt-HO; Mon, 10 Apr 2023 21:07:03 -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 1pm2TM-0007dS-5Y for qemu-devel@nongnu.org; Mon, 10 Apr 2023 21:07:00 -0400 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pm2TJ-00014z-9h for qemu-devel@nongnu.org; Mon, 10 Apr 2023 21:06:59 -0400 Received: by mail-pl1-x631.google.com with SMTP id p8so6322078plk.9 for ; Mon, 10 Apr 2023 18:06:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1681175216; 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=a4BNCRZN5AKwamsHlqYnaohwz80p9xuy09nGxbOHXPU=; b=Jldmccfhe7iH5wCxkS71ExbcEwtkjksV7D20k0rteFWupmBRas8tctJt2/mosHV0Au 81M/o8yT3xLUgNbetkl+FJF55Ole/H2jqGl5y5YZ2ly4Xi7Ov/IvXk/lWrMjCEmAHtZS gpJ4p3IYwugg+zHIolSr3tv0Q3K2JrZXsgIl4VkW7+0woEeIieyixmHVtRv4S0Ph5wJJ KAu3shZmm6zgFSdegHhDvfADcyh2DP9Mgf1ZYz4SIga6ctO2oXaom11j2ZN9a56eGKn3 +Zfb3H6/odwv4ywwTjA4RqusHA2TGYyv/Ow7gsHbfCIYwRwD6934QvR8qz8oiTh9p0Uu nWNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681175216; 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=a4BNCRZN5AKwamsHlqYnaohwz80p9xuy09nGxbOHXPU=; b=ymnAZVDxu4+D3jHmcOrvrVd8Gwv/WBIpMTs1dnrf8EjLlHl7Y91fFXC8soHZc/5k4y VxVLbphwE7p1/1AcFa9U/MPWFY9ox+F49LYVGJcvnqOo5Vl3BvHERbD34Lb7fCMvIRhu 8wD6/q7MnhsZgNcoLZm5gipGyWXA9VAvdmj7DqAl/3LW3fJiY2Z/3RKY/qDW4jkS8iB9 A/HCMeJNpENW6URF57QR/RbwMuXNckowFRKDfwTNFwNASGR1z3N1pRo4DAyPqA17bGmf w0byGg8sXE+tEjiiR67DLuOmuMpfrWYouPq2jJBYHYQr3ES/eDApkllxJePWzwkq9MCO FHOA== X-Gm-Message-State: AAQBX9fWECHNnBVDfkoACKg0VsgQXS82eVEnuYtIvMDyG3+lPn6chT2w 0AI8bu33C0JZkFoNarPbths48TwpccORkUUGjB4A9A== X-Received: by 2002:a17:903:1206:b0:1a6:3737:750d with SMTP id l6-20020a170903120600b001a63737750dmr968203plh.17.1681175215740; Mon, 10 Apr 2023 18:06:55 -0700 (PDT) Received: from stoup.WiFi.IPv4InfoBelow (h146.238.133.40.static.ip.windstream.net. [40.133.238.146]) by smtp.gmail.com with ESMTPSA id s10-20020a65690a000000b0051b0e564963sm1320291pgq.49.2023.04.10.18.06.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Apr 2023 18:06:55 -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 Subject: [PATCH v2 38/54] tcg/aarch64: Convert tcg_out_qemu_{ld,st}_slow_path Date: Mon, 10 Apr 2023 18:04:56 -0700 Message-Id: <20230411010512.5375-39-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230411010512.5375-1-richard.henderson@linaro.org> References: <20230411010512.5375-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::631; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x631.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 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, SUSPICIOUS_RECIPS=2.51 autolearn=no 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 251464ae6f..ed0968133c 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); -} - #ifdef CONFIG_SOFTMMU /* helper signature: helper_ret_ld_mmu(CPUState *env, target_ulong addr, * MemOpIdx oi, uintptr_t ra) @@ -1621,42 +1614,34 @@ 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; @@ -1768,6 +1753,13 @@ static void tcg_out_test_alignment(TCGContext *s, bool is_ld, TCGReg addr_reg, label->raddr = tcg_splitwx_to_rx(s->code_ptr); } +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))) {