From patchwork Thu Sep 5 13:00:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 825634 Delivered-To: patch@linaro.org Received: by 2002:adf:a345:0:b0:367:895a:4699 with SMTP id d5csp285943wrb; Thu, 5 Sep 2024 06:02:30 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVPDHawSdq3Af/G4bbuNUqQmZ2CQaZWDW6nRg1fUK8kw4//U/UV+0Rjbhaqlf2/iBdlQ7KmnQ==@linaro.org X-Google-Smtp-Source: AGHT+IEzHpkKm03qBLR1yT/0vCZRVavuyVJJQr+DJK4iUT6kAehGw3PamLhTwMxzYnQobRiT+A5r X-Received: by 2002:a05:6808:14d1:b0:3db:2cf3:36e with SMTP id 5614622812f47-3e00cb979ccmr11136139b6e.28.1725541350673; Thu, 05 Sep 2024 06:02:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725541350; cv=none; d=google.com; s=arc-20160816; b=oH41zbt4wLkbD1pWFGYD55FDef3b+nKoZ/DX2amJJ/v78BYUsCRI7P6Ue9Xqe/doHn IW7pUWwTXFTWw2nGOFDA7+7Rq2XRbLZibQgCDff+h8XfW4dmuDHDbYU7kJ9mDxjGMg6K KpHsCrfw7GktoRJ+QJo3qfJqvT5UzidZ1I1x7ttUJgMYCcVAXzGGANBAzy5qWI7KVWSM MuzFp1TcwyHFOtgpZUqog+9Qk/ytTbi/6y308ExqNVC8ricw02ie+anFzcpCQyMTeAt7 JmkAiK0lx+19O5hAGQbTDW+EWC0SaST2RzWWsLqArnoTyvCb2fi8N/DwFzo3jSmmGTwp 2F4w== 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:to:from :dkim-signature; bh=UEvZ92Ysmoac5/8gCPMIYUSdZILiX6VcaOGkdAF88AA=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=Vyy1mB/fNBwWw8KLrCHZ8v7eANkEGL+bxPNuhZxTG+d0ex5jTcJK17yt7uY3AmsmhM al/JjKIm+QL4RTFEjoVjsl5pd0H5YSRg0CARefQXmsTBiIDlGZ/knWFKvLAeEANWdKNl t7K8hypeOkKOCsXLbKNRG4t3AQXNqLf/eBsrvEdqOL+cA1HNsaLR3AT+SHa+3WyD7Ewy ILdq30D50uYY4ldOOmtS+zFKUz71x+rMKS4trkuCK4ibpNMjd6aMt0WGuhlEhqcV33Ks YQM5bfbNacAxWQHEwE/B/3d0roxu+Fb2X4goj3j8M/GkhVf0TIQRWN2IDcxt84EDQ0kJ 5O/A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PNbvC6MD; 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 00721157ae682-6d2d58d5e07si100877267b3.220.2024.09.05.06.02.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Sep 2024 06:02:30 -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=PNbvC6MD; 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 1smC79-0001ne-C4; Thu, 05 Sep 2024 09:01:31 -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 1smC6x-00015k-VQ for qemu-devel@nongnu.org; Thu, 05 Sep 2024 09:01:20 -0400 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1smC6q-0001j5-WE for qemu-devel@nongnu.org; Thu, 05 Sep 2024 09:01:18 -0400 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-42c7b5b2d01so7678845e9.3 for ; Thu, 05 Sep 2024 06:01:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725541266; x=1726146066; 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=UEvZ92Ysmoac5/8gCPMIYUSdZILiX6VcaOGkdAF88AA=; b=PNbvC6MDlIV1Dv0o9BFrGOwsVaaLGFI8ixLHUaGJgeiB42XxcMahXkGbH6mwbODK2T Pd/xbMQ/c9uc7yuJwS+/OhjMiocqsSsZflMg/nYjkL2gMpjSNMOUY13z9EPO76r3eUSv jFJiIoD7YrZyzogdIsumvN2GH6owcggzfNo8OKxkufjfj6M2hQnVMzeUp0a7yMHnnu+W Bvr0HXK7f/OjqzUxeVNXxWtznj+pgHeCDmTywCI51xtstIXpelBTQMZmq9OyuQFAjhrf D3ulv7B0vlWas1Nn1QeeVGQfnxudmSVJz6jKmvQr/qbpCxjU6hA668dAvKUIlZCTRkMH QS/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725541266; x=1726146066; 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=UEvZ92Ysmoac5/8gCPMIYUSdZILiX6VcaOGkdAF88AA=; b=InN2IHRVpCKBion0BiBswqM+OONmy3USBDu93pJGkK6pP+wsnlgQ+JQIU3IH6APEFO Z0UtiLKkRR7VdxZSVBbadAKpdRh+4q5yglwBurPNa4DBdcwlxZCpi1XNBzm03gldGxQR RoKwIaeRounRtE7R6JKGKCPShne+sYR7UixChau5YMLt8byKmyiYiZ8DMn+qbIgmgckK hpj72TGHsjZJ1d14usQHZgv6jG21ImcW1X0FzpF4vSPQzkVRqEIT9ARlnk3/TnuEEze9 dMIip4tyC4uowL9epc3dxE7MZkekz8DDrmq+rqbxt/wv3/RJBU9K4kOaGnEJ1bvNV3bp sLDQ== X-Gm-Message-State: AOJu0Yz3IWtyb07Lq3D+Y+AxTPZHF0MIEgK2Fq2YgXJlqwJuqFOO0oWK UVRmksz8eE6bKM0UzgAK/FTVjcoe1z9zTr42pkopMIT9LF53y4BkpAignWFbiAcqIoTdEBqqfsu / X-Received: by 2002:a05:600c:3b29:b0:426:593c:9359 with SMTP id 5b1f17b1804b1-42c9a3938f6mr22208325e9.32.1725541266080; Thu, 05 Sep 2024 06:01:06 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42bb6e355dfsm232251365e9.46.2024.09.05.06.01.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Sep 2024 06:01:05 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 04/25] target/arm: Pass env pointer through to gvec_bfdot_idx helper Date: Thu, 5 Sep 2024 14:00:39 +0100 Message-Id: <20240905130100.298768-5-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240905130100.298768-1-peter.maydell@linaro.org> References: <20240905130100.298768-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x331.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 Pass the env pointer through to the gvec_bfdot_idx helper, so we can use it to add support for FEAT_EBF16. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/helper.h | 4 ++-- target/arm/tcg/translate-a64.c | 11 ++++++++++- target/arm/tcg/translate-neon.c | 4 ++-- target/arm/tcg/translate-sve.c | 8 +++++++- target/arm/tcg/vec_helper.c | 2 +- 5 files changed, 22 insertions(+), 7 deletions(-) diff --git a/target/arm/helper.h b/target/arm/helper.h index 4466e796cb0..e197b5b1d2c 100644 --- a/target/arm/helper.h +++ b/target/arm/helper.h @@ -1029,8 +1029,8 @@ DEF_HELPER_FLAGS_5(gvec_usmmla_b, TCG_CALL_NO_RWG, DEF_HELPER_FLAGS_6(gvec_bfdot, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, env, i32) -DEF_HELPER_FLAGS_5(gvec_bfdot_idx, TCG_CALL_NO_RWG, - void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_6(gvec_bfdot_idx, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, env, i32) DEF_HELPER_FLAGS_5(gvec_bfmmla, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 3813c75895b..c7876513c72 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -6410,13 +6410,22 @@ static bool do_dot_vector_idx(DisasContext *s, arg_qrrx_e *a, return true; } +static bool do_dot_vector_idx_env(DisasContext *s, arg_qrrx_e *a, + gen_helper_gvec_4_ptr *fn) +{ + if (fp_access_check(s)) { + gen_gvec_op4_env(s, a->q, a->rd, a->rn, a->rm, a->rd, a->idx, fn); + } + return true; +} + TRANS_FEAT(SDOT_vi, aa64_dp, do_dot_vector_idx, a, gen_helper_gvec_sdot_idx_b) TRANS_FEAT(UDOT_vi, aa64_dp, do_dot_vector_idx, a, gen_helper_gvec_udot_idx_b) TRANS_FEAT(SUDOT_vi, aa64_i8mm, do_dot_vector_idx, a, gen_helper_gvec_sudot_idx_b) TRANS_FEAT(USDOT_vi, aa64_i8mm, do_dot_vector_idx, a, gen_helper_gvec_usdot_idx_b) -TRANS_FEAT(BFDOT_vi, aa64_bf16, do_dot_vector_idx, a, +TRANS_FEAT(BFDOT_vi, aa64_bf16, do_dot_vector_idx_env, a, gen_helper_gvec_bfdot_idx) static bool trans_BFMLAL_vi(DisasContext *s, arg_qrrx_e *a) diff --git a/target/arm/tcg/translate-neon.c b/target/arm/tcg/translate-neon.c index 454380f01d7..7de157c539c 100644 --- a/target/arm/tcg/translate-neon.c +++ b/target/arm/tcg/translate-neon.c @@ -391,8 +391,8 @@ static bool trans_VDOT_b16_scal(DisasContext *s, arg_VDOT_b16_scal *a) if (!dc_isar_feature(aa32_bf16, s)) { return false; } - return do_neon_ddda(s, a->q * 6, a->vd, a->vn, a->vm, a->index, - gen_helper_gvec_bfdot_idx); + return do_neon_ddda_env(s, a->q * 6, a->vd, a->vn, a->vm, a->index, + gen_helper_gvec_bfdot_idx); } static bool trans_VFML_scalar(DisasContext *s, arg_VFML_scalar *a) diff --git a/target/arm/tcg/translate-sve.c b/target/arm/tcg/translate-sve.c index e1dd6617e8b..eb77c943c8f 100644 --- a/target/arm/tcg/translate-sve.c +++ b/target/arm/tcg/translate-sve.c @@ -265,6 +265,12 @@ static bool gen_gvec_env_arg_zzzz(DisasContext *s, gen_helper_gvec_4_ptr *fn, return gen_gvec_env_zzzz(s, fn, a->rd, a->rn, a->rm, a->ra, data); } +static bool gen_gvec_env_arg_zzxz(DisasContext *s, gen_helper_gvec_4_ptr *fn, + arg_rrxr_esz *a) +{ + return gen_gvec_env_zzzz(s, fn, a->rd, a->rn, a->rm, a->ra, a->index); +} + /* Invoke an out-of-line helper on 4 Zregs, 1 Preg, plus fpst. */ static bool gen_gvec_fpst_zzzzp(DisasContext *s, gen_helper_gvec_5_ptr *fn, int rd, int rn, int rm, int ra, int pg, @@ -7128,7 +7134,7 @@ TRANS_FEAT_NONSTREAMING(UMMLA, aa64_sve_i8mm, gen_gvec_ool_arg_zzzz, TRANS_FEAT(BFDOT_zzzz, aa64_sve_bf16, gen_gvec_env_arg_zzzz, gen_helper_gvec_bfdot, a, 0) -TRANS_FEAT(BFDOT_zzxz, aa64_sve_bf16, gen_gvec_ool_arg_zzxz, +TRANS_FEAT(BFDOT_zzxz, aa64_sve_bf16, gen_gvec_env_arg_zzxz, gen_helper_gvec_bfdot_idx, a) TRANS_FEAT_NONSTREAMING(BFMMLA, aa64_sve_bf16, gen_gvec_ool_arg_zzzz, diff --git a/target/arm/tcg/vec_helper.c b/target/arm/tcg/vec_helper.c index 01b36fdd786..a2c62a86d84 100644 --- a/target/arm/tcg/vec_helper.c +++ b/target/arm/tcg/vec_helper.c @@ -2828,7 +2828,7 @@ void HELPER(gvec_bfdot)(void *vd, void *vn, void *vm, void *va, } void HELPER(gvec_bfdot_idx)(void *vd, void *vn, void *vm, - void *va, uint32_t desc) + void *va, CPUARMState *env, uint32_t desc) { intptr_t i, j, opr_sz = simd_oprsz(desc); intptr_t index = simd_data(desc);