From patchwork Sat Jun 21 23:50:30 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 898845 Delivered-To: patch@linaro.org Received: by 2002:adf:e506:0:b0:3a6:d909:26ce with SMTP id j6csp316446wrm; Sat, 21 Jun 2025 16:59:14 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUkZCO25Ru2z1/f+AS0v9FpDLtMwHh1E4CUQ1YBSLX0CkSIednjTV60nMjLCBWWa9UDu7DGoA==@linaro.org X-Google-Smtp-Source: AGHT+IHJ8l1K07XVvMcv7+a3vX8XM4jtTRUHSvuyfEtMyh0pK+1U4uaOgSRqSmMdzDgATzQypD6F X-Received: by 2002:a05:620a:2a02:b0:7cc:fddb:74d9 with SMTP id af79cd13be357-7d3f98eda38mr1313910685a.22.1750550354389; Sat, 21 Jun 2025 16:59:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1750550354; cv=none; d=google.com; s=arc-20240605; b=DrkjfwTeILS8KjbBcDK86+4i4eOdE1jD4FkvYDG3cMN1fqAnd9GL5/fUxbIQxd6nGv nGY3mUFZxzkJcFZED8ypdzACWMqefFggPtRMGlkqt0Cw+fK13EgryzTXAZzCkmS2uipD MJX/X6jYAXVT4LTwAelirG/SoN2uJcXaxK3zEtWXXCgn6Gu6iPslqt2fgDrPGvWLUGfz NFqpHLc5/sp3BDjnxyxiCltkiFO71Xy6aiXuZvoEaE0Vho/+gvqIPZOxS5GkWGzdQiQQ eDgnW0fj7236thoUllRAlXRWJP2v2+TZCj60ta7REcPN2IJq4LHODmUf8HC8JSyjgSK/ 5E9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:to:from :dkim-signature; bh=cOUr08W+SNGnhfq/OGv+VySWrr4JKZUGPAS+GZzZerU=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=T/bPK34TrSVTQdbQqihgdNa77LdJkE2XKAYa8O3YU01e7imxQwocjqpHma9u3ZH6WL M/aOP2SH+ZUgA1PjBQYHfJKswXqF4xsqZMnm0ZRsW0zO8l6e1rczBVNrMqUKEsRf70Rr KgfEx+UScJbUo47J8OaUouj5cO+OnFaxmcI50Jmte+/ZliF/mMJAFVg3FHlrkTd7rRha XaXMcidsXELRyhCDqKCQjhPJmJ9nLKT5NZAkBdsS8mS59eyXxF8ToN37adPO0cbUljYp THhG1HrImI1GWmkpYx1NnLhVrgadxFdBEJsahmXiRbFaNE+Gbl3jbm0CBmQXq08GsYLP 34/w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cZGXfUvE; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7d3f99e4a35si470511485a.191.2025.06.21.16.59.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Jun 2025 16:59:14 -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=cZGXfUvE; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uT868-0000Wl-E6; Sat, 21 Jun 2025 19:58:12 -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 1uT85f-0005it-3X for qemu-devel@nongnu.org; Sat, 21 Jun 2025 19:57:44 -0400 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uT85c-0006cg-O4 for qemu-devel@nongnu.org; Sat, 21 Jun 2025 19:57:42 -0400 Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-742c7a52e97so2413602b3a.3 for ; Sat, 21 Jun 2025 16:57:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1750550259; x=1751155059; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=cOUr08W+SNGnhfq/OGv+VySWrr4JKZUGPAS+GZzZerU=; b=cZGXfUvEHzoH+D3o3PlX/PK4hHIRtmBqbjcoa95jCdlkpD+8gvRlVO4yIQEWkOrzmE VTW5XY3bZi/buTST/zu0lKGP7wvVEYZQDduyp6omuJxEbCubSgvpa7BL1lDnQ2y8ZvQi 2ilpvfvqLBb8DDA12LxQZ7b34rm7HJNLY0OIJQK+MSUKVn5NjAgAfaeAJQotZrojZGib pdmfqDvh0Ba4pSoQUyTfxWKGeCfdmzoIS1ZzIXGScuhomhoqZY40ShTfCJvHTqrZ5ckP UEhRFm3Gc4MiIOs2xzU17nhSgyghkkJHAaY3s8oKKAkPlczIY2D3oYWkpPlU+XLAQcJB DRAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750550259; x=1751155059; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cOUr08W+SNGnhfq/OGv+VySWrr4JKZUGPAS+GZzZerU=; b=QmkdcTvtUMrhfH7yufUMscAFMKRcbNHZfXeWyiZQdfFnoNu+gc6mEqhApXXdII8/Xf e9caFQXVN3+z3522ivRf3Ft9iyeVBtTpZYiFGoGfys+Yl7P9gQcjRU6C69zgFMJQ1t1E ArfR1JDal17kISC4eNO8WZg40LPp1y+2BC/sr94lQs4yJRYzGN4Ej6Ald+hZRNq6ozTi YPYE7XOZ5VvcltIh9CBJ4aFuxtG0iL7EwaaAzoTW+XBh1g8sXBluPGKcnA0InkWzS8mG sEfeMU0WoxlP65/c1voAQKYV4kikiOhdUET3sQyNqL+ywLKatfngb1e+AjtQFWZbfcmU 29Ug== X-Gm-Message-State: AOJu0YwcxHlOXpq+klNvdHzD+GbA5atNh5aYOoSEbO3pfrjOknF9+KOR JK+7vVBa+k9tlG3aE9nCYDnaA8yX8Sr9874cezdSQoOljI1Jin569NBCv8Dl6fKdIRB06Vh49bT PmFuMOis= X-Gm-Gg: ASbGnctZwwRMWoQrz5RUircwPQtc6qADd66jBbnOOzyryiSeP3/vpWmf851h5I1Xkim z1BOBgIUXYXL4o7JE8bORSLbVlYCN1KoaAM8ZtV3o5HzTbZMk2sPCkISaYdV09v2ZWxTXjlWv5M E23jFOuaXkIPbb3elC0cxGuAxKq7rHRcxnHOmmPhxSqfx2ijBOzp3qXzf2fjjCOHVQUv8zxN7L6 mCxKEeDB1C4wdLz68OY4zhEJXnjNRXfMtPhLpgm9zEl7Hn7sP8UQnkdJfw+Uk2Vc/NyUClXJcxR mmKtiwvQyTVByxLU3XRH0ZnEGpaRF8AH/8hRlKl/cmgDO7THxd0IQOdbJodbhffeWfGHS9c+/1U Dz2+jtXdcNgwZNMFli9D3 X-Received: by 2002:a05:6a20:144f:b0:1f5:97c3:41b9 with SMTP id adf61e73a8af0-22026e6113amr10573591637.5.1750550259213; Sat, 21 Jun 2025 16:57:39 -0700 (PDT) Received: from stoup.. (174-21-67-243.tukw.qwest.net. [174.21.67.243]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-b31f12584cbsm4551790a12.55.2025.06.21.16.57.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Jun 2025 16:57:38 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 094/101] target/arm: Move ld1qq and st1qq primitives to sve_ldst_internal.h Date: Sat, 21 Jun 2025 16:50:30 -0700 Message-ID: <20250621235037.74091-95-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250621235037.74091-1-richard.henderson@linaro.org> References: <20250621235037.74091-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::430; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x430.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 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 Move from sme_helper.c to the shared header. Add a comment noting the lack of atomicity. Signed-off-by: Richard Henderson --- target/arm/tcg/sve_ldst_internal.h | 63 ++++++++++++++++++++++++++++++ target/arm/tcg/sme_helper.c | 44 +++------------------ 2 files changed, 69 insertions(+), 38 deletions(-) diff --git a/target/arm/tcg/sve_ldst_internal.h b/target/arm/tcg/sve_ldst_internal.h index e87beba435..c67cda9d3b 100644 --- a/target/arm/tcg/sve_ldst_internal.h +++ b/target/arm/tcg/sve_ldst_internal.h @@ -141,6 +141,69 @@ DO_LD_PRIM_3(ld1dqu_le, ld1dd_le) #define sve_st1dq_be_tlb sve_st1dd_be_tlb #define sve_st1dq_le_tlb sve_st1dd_le_tlb +/* + * The ARMVectorReg elements are stored in host-endian 64-bit units. + * For 128-bit quantities, the sequence defined by the Elem[] pseudocode + * corresponds to storing the two 64-bit pieces in little-endian order. + */ +/* FIXME: Nothing in this file makes any effort at atomicity. */ + +static inline void sve_ld1qq_be_host(void *vd, intptr_t reg_off, void *host) +{ + sve_ld1dd_be_host(vd, reg_off + 8, host); + sve_ld1dd_be_host(vd, reg_off, host + 8); +} + +static inline void sve_ld1qq_le_host(void *vd, intptr_t reg_off, void *host) +{ + sve_ld1dd_le_host(vd, reg_off, host); + sve_ld1dd_le_host(vd, reg_off + 8, host + 8); +} + +static inline void +sve_ld1qq_be_tlb(CPUARMState *env, void *vd, intptr_t reg_off, + target_ulong addr, uintptr_t ra) +{ + sve_ld1dd_be_tlb(env, vd, reg_off + 8, addr, ra); + sve_ld1dd_be_tlb(env, vd, reg_off, addr + 8, ra); +} + +static inline void +sve_ld1qq_le_tlb(CPUARMState *env, void *vd, intptr_t reg_off, + target_ulong addr, uintptr_t ra) +{ + sve_ld1dd_le_tlb(env, vd, reg_off, addr, ra); + sve_ld1dd_le_tlb(env, vd, reg_off + 8, addr + 8, ra); +} + +static inline void sve_st1qq_be_host(void *vd, intptr_t reg_off, void *host) +{ + sve_st1dd_be_host(vd, reg_off + 8, host); + sve_st1dd_be_host(vd, reg_off, host + 8); +} + +static inline void sve_st1qq_le_host(void *vd, intptr_t reg_off, void *host) +{ + sve_st1dd_le_host(vd, reg_off, host); + sve_st1dd_le_host(vd, reg_off + 8, host + 8); +} + +static inline void +sve_st1qq_be_tlb(CPUARMState *env, void *vd, intptr_t reg_off, + target_ulong addr, uintptr_t ra) +{ + sve_st1dd_be_tlb(env, vd, reg_off + 8, addr, ra); + sve_st1dd_be_tlb(env, vd, reg_off, addr + 8, ra); +} + +static inline void +sve_st1qq_le_tlb(CPUARMState *env, void *vd, intptr_t reg_off, + target_ulong addr, uintptr_t ra) +{ + sve_st1dd_le_tlb(env, vd, reg_off, addr, ra); + sve_st1dd_le_tlb(env, vd, reg_off + 8, addr + 8, ra); +} + #undef DO_LD_TLB #undef DO_ST_TLB #undef DO_LD_HOST diff --git a/target/arm/tcg/sme_helper.c b/target/arm/tcg/sme_helper.c index c8e6a56600..807b160c90 100644 --- a/target/arm/tcg/sme_helper.c +++ b/target/arm/tcg/sme_helper.c @@ -408,54 +408,22 @@ static inline void sme_##NAME##_v_tlb(CPUARMState *env, void *za, \ TLB(env, useronly_clean_ptr(addr), val, ra); \ } -/* - * The ARMVectorReg elements are stored in host-endian 64-bit units. - * For 128-bit quantities, the sequence defined by the Elem[] pseudocode - * corresponds to storing the two 64-bit pieces in little-endian order. - */ -#define DO_LDQ(HNAME, VNAME, BE, HOST, TLB) \ -static inline void HNAME##_host(void *za, intptr_t off, void *host) \ -{ \ - uint64_t val0 = HOST(host), val1 = HOST(host + 8); \ - uint64_t *ptr = za + off; \ - ptr[0] = BE ? val1 : val0, ptr[1] = BE ? val0 : val1; \ -} \ +#define DO_LDQ(HNAME, VNAME) \ static inline void VNAME##_v_host(void *za, intptr_t off, void *host) \ { \ HNAME##_host(za, tile_vslice_offset(off), host); \ } \ -static inline void HNAME##_tlb(CPUARMState *env, void *za, intptr_t off, \ - target_ulong addr, uintptr_t ra) \ -{ \ - uint64_t val0 = TLB(env, useronly_clean_ptr(addr), ra); \ - uint64_t val1 = TLB(env, useronly_clean_ptr(addr + 8), ra); \ - uint64_t *ptr = za + off; \ - ptr[0] = BE ? val1 : val0, ptr[1] = BE ? val0 : val1; \ -} \ static inline void VNAME##_v_tlb(CPUARMState *env, void *za, intptr_t off, \ target_ulong addr, uintptr_t ra) \ { \ HNAME##_tlb(env, za, tile_vslice_offset(off), addr, ra); \ } -#define DO_STQ(HNAME, VNAME, BE, HOST, TLB) \ -static inline void HNAME##_host(void *za, intptr_t off, void *host) \ -{ \ - uint64_t *ptr = za + off; \ - HOST(host, ptr[BE]); \ - HOST(host + 8, ptr[!BE]); \ -} \ +#define DO_STQ(HNAME, VNAME) \ static inline void VNAME##_v_host(void *za, intptr_t off, void *host) \ { \ HNAME##_host(za, tile_vslice_offset(off), host); \ } \ -static inline void HNAME##_tlb(CPUARMState *env, void *za, intptr_t off, \ - target_ulong addr, uintptr_t ra) \ -{ \ - uint64_t *ptr = za + off; \ - TLB(env, useronly_clean_ptr(addr), ptr[BE], ra); \ - TLB(env, useronly_clean_ptr(addr + 8), ptr[!BE], ra); \ -} \ static inline void VNAME##_v_tlb(CPUARMState *env, void *za, intptr_t off, \ target_ulong addr, uintptr_t ra) \ { \ @@ -470,8 +438,8 @@ DO_LD(ld1s_le, uint32_t, ldl_le_p, cpu_ldl_le_data_ra) DO_LD(ld1d_be, uint64_t, ldq_be_p, cpu_ldq_be_data_ra) DO_LD(ld1d_le, uint64_t, ldq_le_p, cpu_ldq_le_data_ra) -DO_LDQ(sve_ld1qq_be, sme_ld1q_be, 1, ldq_be_p, cpu_ldq_be_data_ra) -DO_LDQ(sve_ld1qq_le, sme_ld1q_le, 0, ldq_le_p, cpu_ldq_le_data_ra) +DO_LDQ(sve_ld1qq_be, sme_ld1q_be) +DO_LDQ(sve_ld1qq_le, sme_ld1q_le) DO_ST(st1b, uint8_t, stb_p, cpu_stb_data_ra) DO_ST(st1h_be, uint16_t, stw_be_p, cpu_stw_be_data_ra) @@ -481,8 +449,8 @@ DO_ST(st1s_le, uint32_t, stl_le_p, cpu_stl_le_data_ra) DO_ST(st1d_be, uint64_t, stq_be_p, cpu_stq_be_data_ra) DO_ST(st1d_le, uint64_t, stq_le_p, cpu_stq_le_data_ra) -DO_STQ(sve_st1qq_be, sme_st1q_be, 1, stq_be_p, cpu_stq_be_data_ra) -DO_STQ(sve_st1qq_le, sme_st1q_le, 0, stq_le_p, cpu_stq_le_data_ra) +DO_STQ(sve_st1qq_be, sme_st1q_be) +DO_STQ(sve_st1qq_le, sme_st1q_le) #undef DO_LD #undef DO_ST