From nobody Sun Dec 14 06:15:36 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail header.i=@quicinc.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=quicinc.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1625528172179171.21180546946266; Mon, 5 Jul 2021 16:36:12 -0700 (PDT) Received: from localhost ([::1]:57182 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m0Y8I-0006BS-UL for importer@patchew.org; Mon, 05 Jul 2021 19:36:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35428) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m0Y6y-0003Hn-LU for qemu-devel@nongnu.org; Mon, 05 Jul 2021 19:34:48 -0400 Received: from alexa-out-sd-01.qualcomm.com ([199.106.114.38]:37360) by eggs.gnu.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1m0Y6w-0004dv-F9 for qemu-devel@nongnu.org; Mon, 05 Jul 2021 19:34:48 -0400 Received: from unknown (HELO ironmsg04-sd.qualcomm.com) ([10.53.140.144]) by alexa-out-sd-01.qualcomm.com with ESMTP; 05 Jul 2021 16:34:38 -0700 Received: from vu-tsimpson-aus.qualcomm.com (HELO vu-tsimpson1-aus.qualcomm.com) ([10.222.150.1]) by ironmsg04-sd.qualcomm.com with ESMTP; 05 Jul 2021 16:34:38 -0700 Received: by vu-tsimpson1-aus.qualcomm.com (Postfix, from userid 47164) id F1542144A; Mon, 5 Jul 2021 18:34:37 -0500 (CDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1625528086; x=1657064086; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=87+RL1jrLfkPP+//35JfY4rVGRV6zKvS4dl/OoqSMEY=; b=xoLDbnfkaULe92Ws8lO04YoBZgXun6M36dZ4oSPj+uBT2RPIKzpbocaI ukNnNf+hSx2XS7vCwJ9jnxUrQCkjvD6Monb+UT1UuBC1wIA3JKXbJMRe4 S26gZ7rV/jdfKE/5PsoTYJ1dvv3mgiuLj4sNUMzSe9UAvn03xdagANkJM M=; X-QCInternal: smtphost From: Taylor Simpson To: qemu-devel@nongnu.org Subject: [PATCH 12/20] Hexagon HVX (target/hexagon) helper functions Date: Mon, 5 Jul 2021 18:34:26 -0500 Message-Id: <1625528074-19440-13-git-send-email-tsimpson@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1625528074-19440-1-git-send-email-tsimpson@quicinc.com> References: <1625528074-19440-1-git-send-email-tsimpson@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=199.106.114.38; envelope-from=tsimpson@qualcomm.com; helo=alexa-out-sd-01.qualcomm.com X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_MED=-2.3, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ale@rev.ng, peter.maydell@linaro.org, bcain@quicinc.com, richard.henderson@linaro.org, tsimpson@quicinc.com, philmd@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1625528174339100001 Commit vector stores (masked and scatter/gather) Log vector register writes Add the execution counters to the debug log Signed-off-by: Taylor Simpson --- target/hexagon/helper.h | 1 + target/hexagon/op_helper.c | 51 ++++++++++++++++++++++++++++++++++++++++++= ++-- 2 files changed, 50 insertions(+), 2 deletions(-) diff --git a/target/hexagon/helper.h b/target/hexagon/helper.h index ca201fb..e41a5a1 100644 --- a/target/hexagon/helper.h +++ b/target/hexagon/helper.h @@ -23,6 +23,7 @@ DEF_HELPER_1(debug_start_packet, void, env) DEF_HELPER_FLAGS_3(debug_check_store_width, TCG_CALL_NO_WG, void, env, int= , int) DEF_HELPER_FLAGS_3(debug_commit_end, TCG_CALL_NO_WG, void, env, int, int) DEF_HELPER_2(commit_store, void, env, int) +DEF_HELPER_1(commit_hvx_stores, void, env) DEF_HELPER_FLAGS_4(fcircadd, TCG_CALL_NO_RWG_SE, s32, s32, s32, s32, s32) DEF_HELPER_FLAGS_1(fbrev, TCG_CALL_NO_RWG_SE, i32, i32) DEF_HELPER_3(sfrecipa, i64, env, f32, f32) diff --git a/target/hexagon/op_helper.c b/target/hexagon/op_helper.c index 4595559..4e196f9 100644 --- a/target/hexagon/op_helper.c +++ b/target/hexagon/op_helper.c @@ -25,6 +25,8 @@ #include "arch.h" #include "hex_arch_types.h" #include "fma_emu.h" +#include "mmvec/mmvec.h" +#include "mmvec/macros.h" =20 #define SF_BIAS 127 #define SF_MANTBITS 23 @@ -162,6 +164,50 @@ void HELPER(commit_store)(CPUHexagonState *env, int sl= ot_num) } } =20 +void HELPER(commit_hvx_stores)(CPUHexagonState *env) +{ + int i; + + /* Normal (possibly masked) vector store */ + for (i =3D 0; i < VSTORES_MAX; i++) { + if (env->vstore_pending[i]) { + env->vstore_pending[i] =3D 0; + target_ulong va =3D env->vstore[i].va; + int size =3D env->vstore[i].size; + for (int j =3D 0; j < size; j++) { + if (env->vstore[i].mask.ub[j]) { + put_user_u8(env->vstore[i].data.ub[j], va + j); + } + } + } + } + + /* Scatter store */ + if (env->vtcm_pending) { + env->vtcm_pending =3D false; + if (env->vtcm_log.op) { + /* Need to perform the scatter read/modify/write at commit tim= e */ + if (env->vtcm_log.op_size =3D=3D 2) { + SCATTER_OP_WRITE_TO_MEM(uint16_t); + } else if (env->vtcm_log.op_size =3D=3D 4) { + /* Word Scatter +=3D */ + SCATTER_OP_WRITE_TO_MEM(uint32_t); + } else { + g_assert_not_reached(); + } + } else { + for (i =3D 0; i < env->vtcm_log.size; i++) { + if (env->vtcm_log.mask.ub[i] !=3D 0) { + put_user_u8(env->vtcm_log.data.ub[i], env->vtcm_log.va= [i]); + env->vtcm_log.mask.ub[i] =3D 0; + env->vtcm_log.data.ub[i] =3D 0; + } + + } + } + } +} + static void print_store(CPUHexagonState *env, int slot) { if (!(env->slot_cancelled & (1 << slot))) { @@ -240,9 +286,10 @@ void HELPER(debug_commit_end)(CPUHexagonState *env, in= t has_st0, int has_st1) HEX_DEBUG_LOG("Next PC =3D " TARGET_FMT_lx "\n", env->next_PC); HEX_DEBUG_LOG("Exec counters: pkt =3D " TARGET_FMT_lx ", insn =3D " TARGET_FMT_lx - "\n", + ", hvx =3D " TARGET_FMT_lx "\n", env->gpr[HEX_REG_QEMU_PKT_CNT], - env->gpr[HEX_REG_QEMU_INSN_CNT]); + env->gpr[HEX_REG_QEMU_INSN_CNT], + env->gpr[HEX_REG_QEMU_HVX_CNT]); =20 } =20 --=20 2.7.4