From patchwork Tue Apr 25 19:31:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 676846 Delivered-To: patch@linaro.org Received: by 2002:a5d:4a41:0:0:0:0:0 with SMTP id v1csp2881760wrs; Tue, 25 Apr 2023 12:46:23 -0700 (PDT) X-Google-Smtp-Source: AKy350bY4vbW8e9cWlaaqbsuIbbXN4JuQU2+2nLKCQaCkFxKnVXPkGxWT7NP03lnY99cURwRbO5J X-Received: by 2002:ad4:5f49:0:b0:5ef:5144:9d2f with SMTP id p9-20020ad45f49000000b005ef51449d2fmr31192040qvg.20.1682451982929; Tue, 25 Apr 2023 12:46:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682451982; cv=none; d=google.com; s=arc-20160816; b=aWUDu4LOLOBFSccRNRZnZBVI/18qStF3jHcGrZk+vvHCCP8qCcxYnTeO5KDc1zr20q lCCuYkW15wnyj7BnN9jTFNwTZ28FeykB7oLPrvtNas/cZ6vbLOIHWyHJ/JvmsyyjgUrH JCUOya6QZuAO/UzIRwI3lQq1xrEMlhC0KT1etKtbsecvHj2Ofi4n4qtZOsH9C4MzUv17 J1XP+bFgFj2L78qkhQMwJtAGH1pDY4BUbjQbFwArZDL0StsZTwfFXq0rp6VXNLMiOWy6 Q85Vp6pYSWJIORrEjpMPRmn1lQdlAwtqOW8c4aBgFuwxt23dwKk1bZkXs72K/E0P/FZR jyZg== 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=tw0I+ADtSsoTUZP6PXChoGX/kwSbfoaMV4Di5FGXG0I=; b=rUaKQ1ulupvSNVLMt3A0ixUBBnSpusr9UlowRYer8YgBKd1H3Xet1vIDS/pp1GCgUd ajPx/4amIi0ZApsI8wBrsIMF2uGnY1RMRECBcCV9G7czhFU7v2sKpuvG5vgWeaRn/FSN /HnxT93zfCMrEQfqjmfN2ZdYLFn/YJsUf1UiqaqkW4l0cr6enBt8j9/YXsmdXTTrR30f RpiMlXzAxeO4Ic3+nHlMSbk90Gcd5GRn81DzdfSKuItxZfhxY/xuCxi+p/H93J9IKiPF 9o88eLdpUH6CTZnH0ksI7tqNjbHqDbh8WaHt4VLl9NgLZKWkMvj7h6umIxOJN7dgbX58 mtnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qodv4JEN; 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 c15-20020ad45aef000000b0056eb790b4a9si9351946qvh.539.2023.04.25.12.46.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 25 Apr 2023 12:46: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=qodv4JEN; 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 1prOX8-0001tJ-EV; Tue, 25 Apr 2023 15:41:02 -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 1prOX7-0001og-6P for qemu-devel@nongnu.org; Tue, 25 Apr 2023 15:41:01 -0400 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1prOX4-00070h-Ci for qemu-devel@nongnu.org; Tue, 25 Apr 2023 15:41:00 -0400 Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-4ec81773cf7so6505632e87.2 for ; Tue, 25 Apr 2023 12:40:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1682451657; x=1685043657; 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=tw0I+ADtSsoTUZP6PXChoGX/kwSbfoaMV4Di5FGXG0I=; b=qodv4JENsXPBVovyhFUKZiakrWc+JtBQ6Wn4u/RUJHQ0ExSkxXNwsXQ7frv46tt2IL 4+rfpWjdEb9ImjCsyC9hHqewN8ejk4tAMUUUvvX/vnbpiCYb41v6Mh7ykHRM8n3CUxB2 GGCGpKN8t4DQYT9OMn94g+ZX4SLpFgHVYBI9YAjmWIz6d2WGRJKr22V2AHA605sti8+e 3i3cKAvQwEenPbsvpej19ha2PeBy7vAR2RuMXo5eoLAOjj+Qf6VSPwjWWBhy3wkW64d3 HbPqDDA2x4DbwjFyAU806LCEMysLCK/aRTfuPRSIHD1BKInKenNwogf3UlJPcev2ZLlB iDVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682451657; x=1685043657; 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=tw0I+ADtSsoTUZP6PXChoGX/kwSbfoaMV4Di5FGXG0I=; b=WpXfzF/GFBbWP5rZt9yinj4R+cJdy0JNaV5r4XYsfgwzLs5SPgz59fWHXwW/c9ec6W qol9idGLf6+qRpr3KVscVIrFv0oa73TRy9Wv1uWbsmK1Pc37HTIjETH/FVoee5JhGj2H ThuJLYtuvzafSx0gqB9VNsg8unax+U++lRI4CyuQkrh+ovRIg24qY1yyijR2Y2DL8uBk 4GegMkUu1+oCe5/FPG1JkDj9PnduWtn+mxn8I5oS/cTI7Bzkmw3Wt8kPvPEsawAGgFMS rpaVncsp4B7q6r3PM00I/8xr6RBSRx8hsHa3nscg24eQ3jR3TGJpXykossBLoEylfJBZ cv0A== X-Gm-Message-State: AAQBX9fhA8deWJkCp4pWW19sDyJwweoiPjq9H4LbcRsNgoq5eS1dI4XQ q8ChcPpj+Hp61gH6VwLbmtefQ6QvDXEw8pIkpO8mHw== X-Received: by 2002:ac2:43ce:0:b0:4db:3e7e:51d3 with SMTP id u14-20020ac243ce000000b004db3e7e51d3mr4814225lfl.55.1682451657679; Tue, 25 Apr 2023 12:40:57 -0700 (PDT) Received: from stoup.. ([91.209.212.61]) by smtp.gmail.com with ESMTPSA id d8-20020ac25448000000b004ec55ac6cd1sm2175662lfn.136.2023.04.25.12.40.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Apr 2023 12:40:57 -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, philmd@linaro.org Subject: [PATCH v3 44/57] tcg/aarch64: Use atom_and_align_for_opc Date: Tue, 25 Apr 2023 20:31:33 +0100 Message-Id: <20230425193146.2106111-45-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230425193146.2106111-1-richard.henderson@linaro.org> References: <20230425193146.2106111-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::133; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x133.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 Signed-off-by: Richard Henderson --- tcg/aarch64/tcg-target.c.inc | 38 +++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc index 8e5f3d3688..1d6d382edd 100644 --- a/tcg/aarch64/tcg-target.c.inc +++ b/tcg/aarch64/tcg-target.c.inc @@ -1593,6 +1593,8 @@ typedef struct { TCGReg base; TCGReg index; TCGType index_ext; + MemOp align; + MemOp atom; } HostAddress; bool tcg_target_has_memory_bswap(MemOp memop) @@ -1646,8 +1648,14 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContext *s, HostAddress *h, TCGType addr_type = TARGET_LONG_BITS == 64 ? TCG_TYPE_I64 : TCG_TYPE_I32; TCGLabelQemuLdst *ldst = NULL; MemOp opc = get_memop(oi); - unsigned a_bits = get_alignment_bits(opc); - unsigned a_mask = (1u << a_bits) - 1; + MemOp atom_u; + unsigned a_mask; + + h->align = atom_and_align_for_opc(s, &h->atom, &atom_u, opc, + have_lse2 ? MO_ATOM_WITHIN16 + : MO_ATOM_IFALIGN, + false); + a_mask = (1 << h->align) - 1; #ifdef CONFIG_SOFTMMU unsigned s_bits = opc & MO_SIZE; @@ -1693,7 +1701,7 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContext *s, HostAddress *h, * bits within the address. For unaligned access, we check that we don't * cross pages using the address of the last byte of the access. */ - if (a_bits >= s_bits) { + if (a_mask >= s_mask) { x3 = addr_reg; } else { tcg_out_insn(s, 3401, ADDI, TARGET_LONG_BITS == 64, @@ -1713,11 +1721,9 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContext *s, HostAddress *h, ldst->label_ptr[0] = s->code_ptr; tcg_out_insn(s, 3202, B_C, TCG_COND_NE, 0); - *h = (HostAddress){ - .base = TCG_REG_X1, - .index = addr_reg, - .index_ext = addr_type - }; + h->base = TCG_REG_X1, + h->index = addr_reg; + h->index_ext = addr_type; #else if (a_mask) { ldst = new_ldst_label(s); @@ -1735,17 +1741,13 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContext *s, HostAddress *h, } if (USE_GUEST_BASE) { - *h = (HostAddress){ - .base = TCG_REG_GUEST_BASE, - .index = addr_reg, - .index_ext = addr_type - }; + h->base = TCG_REG_GUEST_BASE; + h->index = addr_reg; + h->index_ext = addr_type; } else { - *h = (HostAddress){ - .base = addr_reg, - .index = TCG_REG_XZR, - .index_ext = TCG_TYPE_I64 - }; + h->base = addr_reg; + h->index = TCG_REG_XZR; + h->index_ext = TCG_TYPE_I64; } #endif