From patchwork Tue May 16 19:41:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 682389 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp18793wrt; Tue, 16 May 2023 12:51:28 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4+CJNl6UuwMGumIpWz6xDY8ZRuljWEtmQknAJ/b1RAbH/AK896QCwg0ZIt+Z91s71DQhM4 X-Received: by 2002:ad4:5f4c:0:b0:5f7:a9e1:bbbf with SMTP id p12-20020ad45f4c000000b005f7a9e1bbbfmr61810554qvg.44.1684266688745; Tue, 16 May 2023 12:51:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684266688; cv=none; d=google.com; s=arc-20160816; b=V0QDMjcnbr73OhI/5eIMO5ar/mAfeOGH2XBIk6ZW3xK2fSjeIzJum3z1TfGyhDHUxu QVMVYPvLfOxa8xhlF6Tj4FDoLB6cDZmyANZkW9sAidRtsSzGOv24rkTzyfyUivhB0kof BbYXHVv1sBdq1aUw87osiHPIO3nVKCjmJT468rezcGnlhImnAUWYCK922Jk9zcbB3ckI 1KA64GOaeTTeh4JwBNXt0ni+YO6VSY+6FzNy21T2xpvXYITi1EJP9uyY7QDcxLqiHTYl 2QlHEPEW1aGaOLWJUrN/Fq8ua++pDmV9ntgXhF6TVcHigKyO1yczd4hAbvjSP99ZPLwT SYmw== 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=LPhN/AVmZfqDEN0zKKnHjQGokKYF75xLV5YHB0OEaoc=; b=iPxx4rtN7Mik+ZtC828i0XtMkb7f9lECPVSxsEI3ipHtT7CgvzpP6f/BMNMSTyaCOg dwZAMKf1ft9kkY6ZIM4TikolumzTFB8sV6a7PkmVteT2+or40Ap6D0cXGb6fwTl2ip0u ah6W7hZ+WYl1pbnoCFf0yg35MPGB6P3TO7ie8sSfURdl2LCiTbf4gmhAB+XDajGwZdiP EwPRZFvo9/7jUIugdeX2h4InI1SulT7JreyFz+3WEINogZS07iiHJ5FnWhPZHYbKWKU6 l7b11XL/OG0oJcUZJX3jbyXy1NIkPRPKhpjLuJeEh0jbYPlnCKuZCvGjsTRvhUUq4r1U /nkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="M/N/6lTq"; 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 c19-20020ae9e213000000b0074ab068e8bcsi204439qkc.526.2023.05.16.12.51.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 16 May 2023 12:51:28 -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="M/N/6lTq"; 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 1pz0Z0-0006pW-UY; Tue, 16 May 2023 15:42:26 -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 1pz0Z0-0006pA-02 for qemu-devel@nongnu.org; Tue, 16 May 2023 15:42:26 -0400 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pz0Yy-0002vF-9m for qemu-devel@nongnu.org; Tue, 16 May 2023 15:42:25 -0400 Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-64384274895so10368132b3a.2 for ; Tue, 16 May 2023 12:42:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684266142; x=1686858142; 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=LPhN/AVmZfqDEN0zKKnHjQGokKYF75xLV5YHB0OEaoc=; b=M/N/6lTqV1CBQsGZmMZk88QpJF+qaMz2a3KhjtiDREn5P68V7PCJyfDecKteQH0m3o yrp5icQPqxfJXjwJGj13a4vstUTrLRq17RHdCSoAisJj7LitQMQ6IL/yjkVJp+BwMLxz bNTv/E3xO7OZWUsLizkIAO3KoDCziXwwbksElNKn0QzMa8l/lg1P6Oi74fSfsI18pCBH fzkSm/mTKLl/F62xV2Co7GS8JRm0mkmFT9Vb+yrqNPpYNDPpgnDNFdGxkn4D5hGIa5ta oB1DZTpAZIz/bw189IqP2oWxt60bddaZYzj3VGnuQz8hZCmtw3pd+tM8ZHT5hEE2UMs1 6otQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684266142; x=1686858142; 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=LPhN/AVmZfqDEN0zKKnHjQGokKYF75xLV5YHB0OEaoc=; b=Zb1N5Kbsn2pDYF8SHfupL7eoQRGl482+I71d26TZ76h6ZN1syddzZs7WfJEB39GJ2Z +iQY9i00oT8QyKY14opKwgG1gyS6KQba5+7rX7i+XERKAjRSPWyC2H0dwygbLc+4VmCA lQlNnjl7bV5qIA/Ni7YNRhq9OSNtyow+BLUWywLumO7mYJMBQKNV7uukRGJVdXAu2oMf 3171KMBhQ0UNvR8mkCcDoAzLmCpJ2OtnlymHIhV5CWfsgRLozJ8e26+b+WiTiHEXzeEe rmbis9XYOR/5ZWp+oGwPyYsixbUyBnXT2Swibx0EP1OxvZiVrj56qhicwTSoN+YdvViZ H4Qg== X-Gm-Message-State: AC+VfDyAAd5lj4LxnlcVcMGikRx6QVc9Fs/ZOArD5Hq32PIIU5b2W4jP mj5zcrPlFYvaHrQtv8YjgS3weooijCmfel7zocE= X-Received: by 2002:a05:6a00:124c:b0:647:d698:56d2 with SMTP id u12-20020a056a00124c00b00647d69856d2mr30384765pfi.27.1684266141991; Tue, 16 May 2023 12:42:21 -0700 (PDT) Received: from stoup.. ([2602:ae:1598:4c01:ec81:440e:33a4:40b9]) by smtp.gmail.com with ESMTPSA id z21-20020aa791d5000000b006260526cf0csm13771165pfa.116.2023.05.16.12.42.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 May 2023 12:42:21 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Peter Maydell Subject: [PULL 39/80] tcg/aarch64: Use atom_and_align_for_opc Date: Tue, 16 May 2023 12:41:04 -0700 Message-Id: <20230516194145.1749305-40-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230516194145.1749305-1-richard.henderson@linaro.org> References: <20230516194145.1749305-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42a; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42a.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 Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- tcg/aarch64/tcg-target.c.inc | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc index 0cc719d799..ea4108d59c 100644 --- a/tcg/aarch64/tcg-target.c.inc +++ b/tcg/aarch64/tcg-target.c.inc @@ -1593,6 +1593,7 @@ typedef struct { TCGReg base; TCGReg index; TCGType index_ext; + TCGAtomAlign aa; } HostAddress; bool tcg_target_has_memory_bswap(MemOp memop) @@ -1646,8 +1647,13 @@ 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; + unsigned a_mask; + + h->aa = atom_and_align_for_opc(s, opc, + have_lse2 ? MO_ATOM_WITHIN16 + : MO_ATOM_IFALIGN, + false); + a_mask = (1 << h->aa.align) - 1; #ifdef CONFIG_SOFTMMU unsigned s_bits = opc & MO_SIZE; @@ -1693,7 +1699,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 +1719,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 +1739,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