From nobody Sat May 30 20:11:22 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1776339579; cv=none; d=zohomail.com; s=zohoarc; b=mTpEYJHbOUrFLd+FYE50QiSQsM1XGsXY3Ak2MZmawDQ/VOypIgjmMpQqsZ9ndXktBLkAz7J/En4W+ll1jhd8xLk2zlcNR280NTvNwKEYV6loQRm9zWDC7AaAKxxEWtsbH43H3y5nFLwCa6QqGI91WsSsUW/24pbsuTZ3SQ8drpg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776339579; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=UQmlyxpZaVVP/6TW6V7qRLUtxbYcGCiDyOnIxm58+4w=; b=A7d3tRWnkilwmsF+N1k7rBvxGPHRadHEVbdkZi8uJS3GIAsgjUS5Pt75a7fhaUtZgGYXB3bxPV+FGtqIOrxNZhyaW4pH0U9T7gA/QCAPus+O1cs+TVaPkigxu3ucbXKNFHks7MxyLjWam8S+DL1bRe8n9sf2m07FR1FoGW/l7GA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776339579043862.2713868910075; Thu, 16 Apr 2026 04:39:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wDL44-00056K-MW; Thu, 16 Apr 2026 07:39:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wDL40-00055Y-5x for qemu-devel@nongnu.org; Thu, 16 Apr 2026 07:39:17 -0400 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wDL3x-00039Z-Ow for qemu-devel@nongnu.org; Thu, 16 Apr 2026 07:39:15 -0400 Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 63G7UFgq3733587 for ; Thu, 16 Apr 2026 11:39:11 GMT Received: from mail-dy1-f200.google.com (mail-dy1-f200.google.com [74.125.82.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4djcqwktw1-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 16 Apr 2026 11:39:10 +0000 (GMT) Received: by mail-dy1-f200.google.com with SMTP id 5a478bee46e88-2d93379001eso15669389eec.1 for ; Thu, 16 Apr 2026 04:39:10 -0700 (PDT) Received: from hu-mathbern-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2de8c10a65asm6845391eec.6.2026.04.16.04.39.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Apr 2026 04:39:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=UQmlyxpZaVV P/6TW6V7qRLUtxbYcGCiDyOnIxm58+4w=; b=MteY/FgsqJFRz0fOgVAcde+nPwS RuQGUmBRu2EQxqI5AHx39Xxy7VsFOTy2sKeuv7x+dglo82Un7JaPlGr8DcUbis8s SYe64331+HdzcNGZsgq0JGwQ1qRP1eMrGfnskZ+zbUUEZHaipo+/1BMNv+IZ3xuU iwKrn4xqXLnwsqoQRhHyl8yTPhJLt1ETRPILvYm81DEHtat8EY4S48MTcc/64EvF cKjT3d9L65COm089RtNq8fat0cTltQM7GUPndGwygQ0/E/+S/RzujiW/e2h+ZdFb rQkYpr93UmEu/S1FXZJKh2kQYiwzziUEyZajhZ01/+HJczXYAtrV+bDZing== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1776339550; x=1776944350; darn=nongnu.org; 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=UQmlyxpZaVVP/6TW6V7qRLUtxbYcGCiDyOnIxm58+4w=; b=SJAEetmuY6N1Gn68c5ALC9ObId5aBNFqDOSWZtH/1RluF5waARPPt808U2Wj3s5vXL nJDD/uOYWXldK8/jU0NUJHPzFsIGz4m2QTbTaDLyx/gLOt+Oqq66p7jj1GIh3v4mtZuy MwD1WLD/LQEg86k+D3UNtpAg5cjBvBQMcb3ENiKhIZ1gIT5mSoqVHiNTijocWMukgLQa u6BJyjRH6/g40yhP/17VLEIC89SDZmY6RcqsNgiaztgKzx0EmvMy7XhoNexoKhyfr1gY WEZMGT9rEbeZjTps5keJlDrxJenlVekkn2uXTJPOVXVyv3vYw8KX/w4hpfn6o/+ejalg M0mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776339550; x=1776944350; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=UQmlyxpZaVVP/6TW6V7qRLUtxbYcGCiDyOnIxm58+4w=; b=G957/WM5Ot7LGWrnMdLyL2+srNLHlJoH1xHKn4imgEvksp9dmHsM4tZ/R7uZMnARO4 66rch3j/gXp7T2QV6aj9RSRlAbcTTKc3Hzo/zjxF+GVJcKV4zuXwM65rpgPqKSG7ZvwI 6JbLmuAnOoEb/h4DhD7BMb2aaGzzp5ZLmhoO4UXuaqwRYHVaaKT3ppzGbsv5dJ413zrJ +tBxA0m+s/oBucK/z6Np8o4foT/Q2GfHqlJNgb1eSt0dStgVyOlyUmtVj69y8u233A7p fdn/q/jCS7oLH2+CMhxSYm9nGbIasPO9xJyDW4zGvNyP84ZXo2BvUhBjBe99KcM0kQlx PqGg== X-Gm-Message-State: AOJu0Yz4keKoRNjoQpbCp9ttUYnPF8iWR+qPxv48oYED991NdDHTZ5Ql YuVz63gJYsIRgtKIWdh3FPNQKUd7oFAfZ73vR1+8JqaiY8AP8A5HujZHDUTKAV0JM1av9l6ZGXq n98bLpdY3qGor29zmD/PxftRfDCA8nEp0RPicnYSTf6pQshoNPvFY7ndiRRQ2RojyOoZi X-Gm-Gg: AeBDievbqLKwIZLoRceZHDDLVwYRakQZzIrKJMirWO802/SGtUU4mxD5ilMV042tMSz DDG28O7VY+pCMgwc9x9dvJPl/+h3ArJ2pw9zBN61R9aEgM7ByVRxXJDTg4eyktG5+VYMoecHhuA dhfViyRWcGFSyQB5xcsy/aHe7CXAb+KpdivG1yYTCGRvYLihDYX5ktK2mGRraLq/71FAUW6wxDL wC6pqxo0Cft3OLX5XIpZLZlAJ6YITZ1b/I9rMV0fVnCVuYKYuDPsrce/nKIANG2aETtEUgD6i91 Z6ehzByDbQ25z5kpTnfl6oWExWcOJgKSXncl4yUrjM5ds3bVqxTp4XBDnIePN83kWapOVxdQjBc 1GzjZzayAaYSQ5p2vT/SWSc6/mcFU2u6+4rtN/kBZ1CdbGS4VqD4QgDubiMHHqQEDoN3Af8fdfe czNS8ZlY8/Jp9OYXEA8Nk= X-Received: by 2002:a05:7300:cd93:b0:2dd:405f:89b3 with SMTP id 5a478bee46e88-2dd405f9033mr6231423eec.0.1776339549962; Thu, 16 Apr 2026 04:39:09 -0700 (PDT) X-Received: by 2002:a05:7300:cd93:b0:2dd:405f:89b3 with SMTP id 5a478bee46e88-2dd405f9033mr6231403eec.0.1776339549417; Thu, 16 Apr 2026 04:39:09 -0700 (PDT) From: Matheus Tavares Bernardino To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, ale@rev.ng, anjo@rev.ng, brian.cain@oss.qualcomm.com, ltaylorsimpson@gmail.com, marco.liebel@oss.qualcomm.com, philmd@linaro.org, quic_mburton@quicinc.com, sid.manning@oss.qualcomm.com, Pierrick Bouvier , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH v5 01/16] tests/docker: Update hexagon cross toolchain to 22.1.0 Date: Thu, 16 Apr 2026 04:38:50 -0700 Message-Id: X-Mailer: git-send-email 2.37.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: HXkjJtRd4pttBoMni-GgRxZ8CdTGCcru X-Proofpoint-GUID: HXkjJtRd4pttBoMni-GgRxZ8CdTGCcru X-Authority-Analysis: v=2.4 cv=XOIAjwhE c=1 sm=1 tr=0 ts=69e0ca5e cx=c_pps a=PfFC4Oe2JQzmKTvty2cRDw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=eoimf2acIAo5FJnRuUoq:22 a=ovJmrJClAAAA:8 a=qC_FGOx9AAAA:8 a=EUspDBNiAAAA:8 a=KKAkSRfTAAAA:8 a=q7X4_axEi9qJq2Gpr8MA:9 a=6Ab_bkdmUrQuMsNx7PHu:22 a=brTEhlvMp4NY0_u118I2:22 a=fsdK_YakeE02zTmptMdW:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDE2MDExMCBTYWx0ZWRfX+CYpjh39JB// eJgKtMQpLzE7xtpQyMsTx5NoJintWs/8LmVUf7LwbBYJ82DT77lECWwy0ZApHUtEL9zd8DttHWY D6KjRyJ4PXmbMA1jaNktQYmrByTDSX3hkKcnMLTdZjkZXZzFBxtzTemOuWX+SKyUzUATABR1BtX YrV0KQo0/KU00JdTMwEG3MN5ZJvwjTPFXwoLjm910Tu6GOMsHePatLNqVPlnLJGc15PAKztNoNB NDn3ErMDe60i30TJ+x22vz+hFdhIlQaFb+Y22hOLxqvsSGq8EDsD+qeAXBHMuDN84AOVfMEgMZ2 TeGRh1355ppZMB0IJ6ttFYUGoFs/45A9FLAcb22wX1RlbZ3VVQN+FSnt/TqeC2QNSikKa4uFi7d /5vDqCCjkxi7OcNGSwTQHtk3x0eJpLzqDSRgeOg7QkUo2hX5+ewPXSdvQcdtZT5CIynBOyYOc8h zZBRYrStt6JF+aJkCgg== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-16_03,2026-04-13_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 adultscore=0 suspectscore=0 spamscore=0 malwarescore=0 bulkscore=0 impostorscore=0 phishscore=0 clxscore=1015 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604070000 definitions=main-2604160110 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=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.168.131; envelope-from=matheus.bernardino@oss.qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1776339582481154100 Content-Type: text/plain; charset="utf-8" From: Brian Cain Update the hexagon cross-compiler Docker container to use toolchain version 22.1.0, replacing the previous 12.Dec.2023 release. Changes to accommodate the new toolchain: - Add libc++1, libc++abi1, libunwind-19 runtime deps for the new LLVM-based toolchain - Add zstd for the new .tar.zst archive format - Update artifact URL domain to artifacts.codelinaro.org Reviewed-by: Pierrick Bouvier Signed-off-by: Brian Cain --- tests/docker/dockerfiles/debian-hexagon-cross.docker | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/docker/dockerfiles/debian-hexagon-cross.docker b/tests/d= ocker/dockerfiles/debian-hexagon-cross.docker index 91d4b71ac9..636d0ca8a0 100644 --- a/tests/docker/dockerfiles/debian-hexagon-cross.docker +++ b/tests/docker/dockerfiles/debian-hexagon-cross.docker @@ -19,7 +19,11 @@ RUN apt-get update && \ curl \ ccache \ xz-utils \ + zstd \ ca-certificates \ + libc++1 \ + libc++abi1 \ + libunwind-19 \ bison \ flex \ git \ @@ -40,12 +44,12 @@ RUN apt-get update && \ dpkg-query --showformat '${Package}_${Version}_${Architecture}\n' --sh= ow > /packages.txt =20 ENV TOOLCHAIN_INSTALL /opt -ENV TOOLCHAIN_RELEASE 12.Dec.2023 +ENV TOOLCHAIN_RELEASE 22.1.0 ENV TOOLCHAIN_BASENAME "clang+llvm-${TOOLCHAIN_RELEASE}-cross-hexagon-unkn= own-linux-musl" -ENV TOOLCHAIN_URL https://codelinaro.jfrog.io/artifactory/codelinaro-toolc= hain-for-hexagon/${TOOLCHAIN_RELEASE}/${TOOLCHAIN_BASENAME}.tar.xz +ENV TOOLCHAIN_URL https://artifacts.codelinaro.org/artifactory/codelinaro-= toolchain-for-hexagon/${TOOLCHAIN_RELEASE}_/${TOOLCHAIN_BASENAME}.tar.zst ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers" =20 -RUN curl -#SL "$TOOLCHAIN_URL" | tar -xJC "$TOOLCHAIN_INSTALL" +RUN curl -#SL "$TOOLCHAIN_URL" | tar --zstd -xC "$TOOLCHAIN_INSTALL" ENV PATH $PATH:${TOOLCHAIN_INSTALL}/${TOOLCHAIN_BASENAME}/x86_64-linux-gnu= /bin ENV MAKE /usr/bin/make # As a final step configure the user (if env is defined) --=20 2.37.2 From nobody Sat May 30 20:11:22 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1776339666; cv=none; d=zohomail.com; s=zohoarc; b=mBAzmRRq9j7A5HvLxTGKvuEZDtsruVGUt/a/IGhQzH36sl31YpsEsF+BfKfaQKhU18srEqzi5htKYLT6ghwWCq7M8+rC/+YH7oPCyJYfM+B8wl0PbQ5dM2fMa5dtGu1ISNOUUhIl6UOcJetK20EvTWVnDNdWNTzhmwTlmj9ouvc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776339666; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=nOvzeWfo1gzMP3it2e0DgF8ZBLHR2ZVPC9oC1yks6l8=; b=RD9ulNYCBlqof7u51wVt5ZY4s84MciRvGYhxE3wCjnq+C8JLHnl4WdNw7uNgO3ewLsmnGzxJbpMeTwoZUOnWjDPwyXjklziLMRPnHMAeZsjezOACyCFpZyDccuYKHkdLd4u1YlmT8krOJxt3nWpt47Yk+jVDBZaXAUVGwKFTu3M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776339666222886.6995204783432; Thu, 16 Apr 2026 04:41:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wDL4M-000598-03; Thu, 16 Apr 2026 07:39:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wDL44-00055q-7A for qemu-devel@nongnu.org; Thu, 16 Apr 2026 07:39:20 -0400 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wDL3x-00039c-Vr for qemu-devel@nongnu.org; Thu, 16 Apr 2026 07:39:19 -0400 Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 63G9MsGW1553030 for ; Thu, 16 Apr 2026 11:39:12 GMT Received: from mail-dy1-f198.google.com (mail-dy1-f198.google.com [74.125.82.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4djrsn9g8e-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 16 Apr 2026 11:39:11 +0000 (GMT) Received: by mail-dy1-f198.google.com with SMTP id 5a478bee46e88-2cc75e79b97so30180062eec.1 for ; Thu, 16 Apr 2026 04:39:11 -0700 (PDT) Received: from hu-mathbern-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2de8c10a65asm6845391eec.6.2026.04.16.04.39.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Apr 2026 04:39:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=nOvzeWfo1gz MP3it2e0DgF8ZBLHR2ZVPC9oC1yks6l8=; b=kd+yOI/DlCOOPSx78bzLIcGKQVB QD/8tn2+9BAfDt/qZ6jV3S/+4odZROWfEd4vOYk9Qz4V/O2+V+568X8KclcwNxxx oDl/Wp1ET/jxK9kDjaqxZpNpw7te7dc4TVmD6CNcYZVW9SSHZQb3QZEkEci9gsrL qF2xCErCn1a2KiwfqvAcAl+cdhuTUtxH8TRKgaFhhBmKaikiB+ubbmD8t9uYw4Yq 9yf18PEbI4jt1sRh/hDGLR84mrbqvxPP9AS4QRtIb6jZTw7hJQitiTJnGFXQJoh2 wMtSgcZatIAoBDIFQceXowtFt2ZgkdSiBNh08jkvjN/d9smYgItT/mB6wZw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1776339551; x=1776944351; darn=nongnu.org; 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=nOvzeWfo1gzMP3it2e0DgF8ZBLHR2ZVPC9oC1yks6l8=; b=JE82crSqf41hOsj5nRs6MzNs5ZvghjggLLsAjWM+L/L/osKO35PupNADcKi8pupVeu d3iWwUvT1hCwhawXfw3/HWN57VtMcm0mwoK6gA5bN6JthzfUN/Z3H9aY98mrPEZM0i5f UxruqPP1WG/gm/T/+YVjgTyNiZDuv6i+Ekh1C41Kyu5fQ2+Knxa/+/BcxygQMAwVLCBl n3L/u6mXP9QZQyfy++h0EW3hcAMMei7wlKafsg1Z2la2yrhSLp7vh65BZTU6U/QBOf7+ 7W/2+RExr5wMbWBtdBoOIYIzy0uI4J1qR/snQQvgVUAO4i47iHJXTT3hjyMX/nqzY1fA JWhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776339551; x=1776944351; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=nOvzeWfo1gzMP3it2e0DgF8ZBLHR2ZVPC9oC1yks6l8=; b=BGcsrUWDcLJKPGtObsslr2Fku80GhyFYxptWAfCtqkno7VeOnpFsyd4fWJrIGQ/bdx EdU94DLclj3BKUjZBw4EavSguRRbP9DvD9A0CNRFn2jYMSvE3rruV/COMu/sM4gY7BRG uFPap1nE4eJK7PYc/DdTWFYWHxmi7tjD6t/q69q34G1N+5hayfpvm9y6HCSvWBZgtUiw pMQzKpCvlCWgH7ekgyN0cou8zAQmng032tdyMWRddaFjoNCVjVrwy+TLP4c1i7oPbSr4 jVkqRt252s5IgSh7yVAD0jWcC8NxhBP4kApBIKituctRjdYV/OwNxsxKiWaeX4/mysyF aY9A== X-Gm-Message-State: AOJu0YzPC4+uKXf4g7/NDKIjXBojmvoHk0MGMXU68OPlAKKkIwIh5pVN grrZJ1tGH+qzRIJzqR7TE5u1w7emcvH+GRvijgc5GEHyb+22KVVa7LmDNTbjhZ6p36diHpMb0sY AD0DA6vjbcMLFnw7iEULiafD7nmgV0zSOiEmYE/KRL/4QJkKi9LdFDVwg9Rq870a8XA== X-Gm-Gg: AeBDietOexvrfnJysJ9SLysCsxLp1NuPYOHyBtbNwjn38C/I9SJT/84uRyxKALQir2+ qJFADI6PKPQ2kijYKjebPewFCwCvo8+qHSBUYgypQVcgqki0llGgz4tC45gxTBR4mNG+RncSBGX Z5Bs+FhjksFpwhv6oIj3nKwbRyyM+m0Z4zjrTHOgjfyx8MUBDuJ/7Ndk4J6HJ1iFppyA8qES/cc bIjcs1AuqSftddbRXv8/1ZUHSbQfk9gOOx2hdJA/EQPLvJgBVjXmD3lAaGZ7f29RsB5mqkfOuLd YvngnjDG37bPtH/gQxjSZIciGR6U2JlXlJ/yBQlv81N0inKnPSByfFsSTY3eY8SAoHiL02wUSFJ JhUVW8lDMSk/9yR43PL7f917M7QcTC7oOwe96IyjUfCaAfSACqdj7jmCW9NFVsw/MJl/2BWoUOr e/QpRPsX3fvhz/3XPZoKE= X-Received: by 2002:a05:7301:4089:b0:2be:a2d8:e9e3 with SMTP id 5a478bee46e88-2d58a2a171fmr15870406eec.29.1776339550804; Thu, 16 Apr 2026 04:39:10 -0700 (PDT) X-Received: by 2002:a05:7301:4089:b0:2be:a2d8:e9e3 with SMTP id 5a478bee46e88-2d58a2a171fmr15870377eec.29.1776339550181; Thu, 16 Apr 2026 04:39:10 -0700 (PDT) From: Matheus Tavares Bernardino To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, ale@rev.ng, anjo@rev.ng, brian.cain@oss.qualcomm.com, ltaylorsimpson@gmail.com, marco.liebel@oss.qualcomm.com, philmd@linaro.org, quic_mburton@quicinc.com, sid.manning@oss.qualcomm.com Subject: [PATCH v5 02/16] target/hexagon: fix incorrect/too-permissive HVX encodings Date: Thu, 16 Apr 2026 04:38:51 -0700 Message-Id: <1fe4b8a0fcae6705a591b1b5131e28f6d8062eed.1776339451.git.matheus.bernardino@oss.qualcomm.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: iUxAs-26Vxmz30I6rDlQ9G6bAjVN4sd2 X-Proofpoint-GUID: iUxAs-26Vxmz30I6rDlQ9G6bAjVN4sd2 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDE2MDExMCBTYWx0ZWRfX1jDNb12wB7eX 90T+SkaV9F8UeX8pOphEJ7z7NIsAHu/O8n9gMclS4JZ/ilZKFEnhbKa3l1IqZpX77yUm29JLp0a tj5QM1fhbY2UsuWZFOtq6aWw9kRmHz0XqgDgNabDESkBzl3Bn1YvVA56uAIwHbVYMa8yCwWNOWO r/+rHwUg7DnywU+Xlna93E6lZ/jj6yv9wx7u8bZQFwc85/q2otxZx7liJTS8WGJ6P4jdZuYwL5e 7WqiZlN+Pk+VgERhpbwlN1T84ssnRWEQYSD727N5M61EiCuWKtHYxznjSnkaa9Gc1qUwDpA+FN6 sCF6o46iDqdc382SIfu1QEWHmL5EmREqwabtULVd6PetdcDvUaOy8kW0jslA7AAmpRxNO7fMS2S znnQwwEDCvOa0XbqGNkebIrl/JBRzF284YHbP7mZCJYRkPwH/ASlUIOqBEI7eVYzK7YT6I8kpKv EcRAa2X3yahev962IbQ== X-Authority-Analysis: v=2.4 cv=EojiaycA c=1 sm=1 tr=0 ts=69e0ca5f cx=c_pps a=wEP8DlPgTf/vqF+yE6f9lg==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yOCtJkima9RkubShWh1s:22 a=pGLkceISAAAA:8 a=EUspDBNiAAAA:8 a=LtKSMYrkcOpncNoavBoA:9 a=bBxd6f-gb0O0v-kibOvt:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-16_03,2026-04-13_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 bulkscore=0 adultscore=0 spamscore=0 phishscore=0 impostorscore=0 suspectscore=0 lowpriorityscore=0 malwarescore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604070000 definitions=main-2604160110 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=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.168.131; envelope-from=matheus.bernardino@oss.qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1776339667366154100 Content-Type: text/plain; charset="utf-8" The following encodings have become stricter since v68: - V6_vunpackob, V6_vunpackoh: ---00 -> --000 - V6_vaddbq/hq/wq, V6_vaddbnq/hnq/wnq: ---01 -> --001 - V6_vsubbq/hq, V6_vsubwq/bnq/hnq/wnq: ---01/---10 -> --001/--010 - V6_vhist, V6_vwhist128/256, V6_vwhist128/256_sat: ---00 -> --000 - V6_vhistq, V6_vwhist128/256q, V6_vwhist128/256q_sat: ---10 -> --010 Pre v68 compilers, by default, already use "0" for the non-specified bit that changed in v68, so unless someone is manually writing the binary encoding, this should not cause any backwards incompatibility with pre-v68 binaries. Reviewed-by: Taylor Simpson Signed-off-by: Matheus Tavares Bernardino --- target/hexagon/imported/mmvec/encode_ext.def | 48 ++++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/target/hexagon/imported/mmvec/encode_ext.def b/target/hexagon/= imported/mmvec/encode_ext.def index 402438f566..6d70086b5f 100644 --- a/target/hexagon/imported/mmvec/encode_ext.def +++ b/target/hexagon/imported/mmvec/encode_ext.def @@ -647,36 +647,36 @@ DEF_ENC(V6_vsubububb_sat, ICLASS_CJ" 1 110 101 vvv= vv PP 0 uuuuu 101 ddddd") DEF_ENC(V6_vmpyewuh_64, ICLASS_CJ" 1 110 101 vvvvv PP 0 uuuuu 110 d= dddd") =20 DEF_FIELDROW_DESC32( ICLASS_CJ" 1 110 --0 ----- PP 1 ----- ----- --= -","Vx32=3DVu32") -DEF_ENC(V6_vunpackob, ICLASS_CJ" 1 110 --0 ---00 PP 1 uuuuu 000 xx= xxx") // -DEF_ENC(V6_vunpackoh, ICLASS_CJ" 1 110 --0 ---00 PP 1 uuuuu 001 xx= xxx") // +DEF_ENC(V6_vunpackob, ICLASS_CJ" 1 110 --0 --000 PP 1 uuuuu 000 xx= xxx") // +DEF_ENC(V6_vunpackoh, ICLASS_CJ" 1 110 --0 --000 PP 1 uuuuu 001 xx= xxx") // //DEF_ENC(V6_vunpackow, ICLASS_CJ" 1 110 --0 ---00 PP 1 uuuuu 010 xxxx= x") // =20 -DEF_ENC(V6_vhist, ICLASS_CJ" 1 110 --0 ---00 PP 1 -000- 100 ---= --") -DEF_ENC(V6_vwhist256, ICLASS_CJ" 1 110 --0 ---00 PP 1 -0010 100 ---= --") -DEF_ENC(V6_vwhist256_sat, ICLASS_CJ" 1 110 --0 ---00 PP 1 -0011 100 ---= --") -DEF_ENC(V6_vwhist128, ICLASS_CJ" 1 110 --0 ---00 PP 1 -010- 100 ---= --") -DEF_ENC(V6_vwhist128m, ICLASS_CJ" 1 110 --0 ---00 PP 1 -011i 100 --= ---") +DEF_ENC(V6_vhist, ICLASS_CJ" 1 110 --0 --000 PP 1 -000- 100 ---= --") +DEF_ENC(V6_vwhist256, ICLASS_CJ" 1 110 --0 --000 PP 1 -0010 100 ---= --") +DEF_ENC(V6_vwhist256_sat, ICLASS_CJ" 1 110 --0 --000 PP 1 -0011 100 ---= --") +DEF_ENC(V6_vwhist128, ICLASS_CJ" 1 110 --0 --000 PP 1 -010- 100 ---= --") +DEF_ENC(V6_vwhist128m, ICLASS_CJ" 1 110 --0 --000 PP 1 -011i 100 --= ---") =20 DEF_FIELDROW_DESC32( ICLASS_CJ" 1 110 --0 ----- PP 1 ----- ----- --= -","if (Qv4) Vx32=3DVu32") -DEF_ENC(V6_vaddbq, ICLASS_CJ" 1 110 vv0 ---01 PP 1 uuuuu 000 x= xxxx") // -DEF_ENC(V6_vaddhq, ICLASS_CJ" 1 110 vv0 ---01 PP 1 uuuuu 001 x= xxxx") // -DEF_ENC(V6_vaddwq, ICLASS_CJ" 1 110 vv0 ---01 PP 1 uuuuu 010 x= xxxx") // -DEF_ENC(V6_vaddbnq, ICLASS_CJ" 1 110 vv0 ---01 PP 1 uuuuu 011 xxxx= x") // -DEF_ENC(V6_vaddhnq, ICLASS_CJ" 1 110 vv0 ---01 PP 1 uuuuu 100 xxxx= x") // -DEF_ENC(V6_vaddwnq, ICLASS_CJ" 1 110 vv0 ---01 PP 1 uuuuu 101 xxxx= x") // -DEF_ENC(V6_vsubbq, ICLASS_CJ" 1 110 vv0 ---01 PP 1 uuuuu 110 x= xxxx") // -DEF_ENC(V6_vsubhq, ICLASS_CJ" 1 110 vv0 ---01 PP 1 uuuuu 111 x= xxxx") // +DEF_ENC(V6_vaddbq, ICLASS_CJ" 1 110 vv0 --001 PP 1 uuuuu 000 x= xxxx") // +DEF_ENC(V6_vaddhq, ICLASS_CJ" 1 110 vv0 --001 PP 1 uuuuu 001 x= xxxx") // +DEF_ENC(V6_vaddwq, ICLASS_CJ" 1 110 vv0 --001 PP 1 uuuuu 010 x= xxxx") // +DEF_ENC(V6_vaddbnq, ICLASS_CJ" 1 110 vv0 --001 PP 1 uuuuu 011 xxxx= x") // +DEF_ENC(V6_vaddhnq, ICLASS_CJ" 1 110 vv0 --001 PP 1 uuuuu 100 xxxx= x") // +DEF_ENC(V6_vaddwnq, ICLASS_CJ" 1 110 vv0 --001 PP 1 uuuuu 101 xxxx= x") // +DEF_ENC(V6_vsubbq, ICLASS_CJ" 1 110 vv0 --001 PP 1 uuuuu 110 x= xxxx") // +DEF_ENC(V6_vsubhq, ICLASS_CJ" 1 110 vv0 --001 PP 1 uuuuu 111 x= xxxx") // =20 -DEF_ENC(V6_vsubwq, ICLASS_CJ" 1 110 vv0 ---10 PP 1 uuuuu 000 x= xxxx") // -DEF_ENC(V6_vsubbnq, ICLASS_CJ" 1 110 vv0 ---10 PP 1 uuuuu 001 xxxx= x") // -DEF_ENC(V6_vsubhnq, ICLASS_CJ" 1 110 vv0 ---10 PP 1 uuuuu 010 xxxx= x") // -DEF_ENC(V6_vsubwnq, ICLASS_CJ" 1 110 vv0 ---10 PP 1 uuuuu 011 xxxx= x") // +DEF_ENC(V6_vsubwq, ICLASS_CJ" 1 110 vv0 --010 PP 1 uuuuu 000 x= xxxx") // +DEF_ENC(V6_vsubbnq, ICLASS_CJ" 1 110 vv0 --010 PP 1 uuuuu 001 xxxx= x") // +DEF_ENC(V6_vsubhnq, ICLASS_CJ" 1 110 vv0 --010 PP 1 uuuuu 010 xxxx= x") // +DEF_ENC(V6_vsubwnq, ICLASS_CJ" 1 110 vv0 --010 PP 1 uuuuu 011 xxxx= x") // =20 -DEF_ENC(V6_vhistq, ICLASS_CJ" 1 110 vv0 ---10 PP 1 --00- 100 --= ---") -DEF_ENC(V6_vwhist256q, ICLASS_CJ" 1 110 vv0 ---10 PP 1 --010 100 --= ---") -DEF_ENC(V6_vwhist256q_sat, ICLASS_CJ" 1 110 vv0 ---10 PP 1 --011 100 --= ---") -DEF_ENC(V6_vwhist128q, ICLASS_CJ" 1 110 vv0 ---10 PP 1 --10- 100 --= ---") -DEF_ENC(V6_vwhist128qm, ICLASS_CJ" 1 110 vv0 ---10 PP 1 --11i 100 -= ----") +DEF_ENC(V6_vhistq, ICLASS_CJ" 1 110 vv0 --010 PP 1 --00- 100 --= ---") +DEF_ENC(V6_vwhist256q, ICLASS_CJ" 1 110 vv0 --010 PP 1 --010 100 --= ---") +DEF_ENC(V6_vwhist256q_sat, ICLASS_CJ" 1 110 vv0 --010 PP 1 --011 100 --= ---") +DEF_ENC(V6_vwhist128q, ICLASS_CJ" 1 110 vv0 --010 PP 1 --10- 100 --= ---") +DEF_ENC(V6_vwhist128qm, ICLASS_CJ" 1 110 vv0 --010 PP 1 --11i 100 -= ----") =20 =20 DEF_ENC(V6_vandvqv, ICLASS_CJ" 1 110 vv0 ---11 PP 1 uuuuu 000 d= dddd") --=20 2.37.2 From nobody Sat May 30 20:11:22 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1776339693; cv=none; d=zohomail.com; s=zohoarc; b=bgsH93XtuF5mO9mNEA09Tk0Es2XmClBm7yU0j9uvK7qmiGpd6exIhOIUy3IOWb7CZ43CJlLRWOvQHgYwB8UfcHrAp9l7zdXkgAzqvqxFqWBeEtCAp2x1bpbw9VrH28O3opAfgt27Wt1VHTlTAwg2YnCvWS7S/m+eV5cclEwrzNU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776339693; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=sangyG8tfzJ3xLqN6HjSzyDmUUok+xf6sPcbdCH9vRw=; b=PUxIWa5xqEsrNTNCPZM7GNu/9tfwJ4RP3+INEZLnOjQUcvuqaqppTtlyRi7PZWIWCu9+6eDPSl2buW8tuCVL9+v6yDYV7YsxD7Bfl0RJhiPmG9ZsBPSPPFw0Dez6ck458hu1clCUN5IInEXTVBVx3JN0E/PxJyyIoOWxifaqxis= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776339693702901.7505511397112; Thu, 16 Apr 2026 04:41:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wDL47-00056q-OY; Thu, 16 Apr 2026 07:39:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wDL44-00055s-4b for qemu-devel@nongnu.org; Thu, 16 Apr 2026 07:39:20 -0400 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wDL3y-00039w-FI for qemu-devel@nongnu.org; Thu, 16 Apr 2026 07:39:19 -0400 Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 63G9YVtS1553264 for ; Thu, 16 Apr 2026 11:39:13 GMT Received: from mail-dy1-f198.google.com (mail-dy1-f198.google.com [74.125.82.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4djrsn9g8g-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 16 Apr 2026 11:39:12 +0000 (GMT) Received: by mail-dy1-f198.google.com with SMTP id 5a478bee46e88-2d8a677cdfaso5562870eec.1 for ; Thu, 16 Apr 2026 04:39:12 -0700 (PDT) Received: from hu-mathbern-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2de8c10a65asm6845391eec.6.2026.04.16.04.39.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Apr 2026 04:39:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=sangyG8tfzJ 3xLqN6HjSzyDmUUok+xf6sPcbdCH9vRw=; b=B0BZFSavqLZxDWhJz3eV3mbIQ19 amalyX19y15AsxyHs2/E0xG6gOLJ+V17KUVAEbyo07l/JHaRFFqPQYW6qn7uLk62 /5sglp/z7nn0ZU00mf3D6aAoYCKmIAwj+a14GvkrlVAGqPiBu7QSlNZk4ogsslka hqecS21CDpm7TvinUQIu3bl8K0P2v+0yKsPesz3qhZGf5hOMm91z7jYI0KjtH19Y cQBOpyPeMLKpCMWEJ4Hp+T6UGBAR2tc5AP2MBJhaTRuflPHrkHO0P5VOfcBHy+l/ crXHxJBWwH7j9Gn0fJwbNHUT93+4pyeoiQe7lHXUg104hwf4GyrSA7T6p1Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1776339552; x=1776944352; darn=nongnu.org; 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=sangyG8tfzJ3xLqN6HjSzyDmUUok+xf6sPcbdCH9vRw=; b=KvRoz3lziKnk8STmtVXpNRgHAKC//L67n8aohOKlUUCYTajDglveGj5XpFJ4AOP152 8Mw+Aslv1t+oiNvxJE2HaJlGVOdGrd3Pb7XSUzXnbg2dAtZ55fyciwPm798X7WLVVPzk 1eqWJnM3KpZV0jxWv/OXREW9eV0aBaBSsGhQAo9dFO7z8hZjrl8apMiQ4K3gzZTJ2DCQ 4EQ7UimFsVtMUjirVA3RJCETydhlhD0KdZc41QibZrn3SpLQqkZI8OJN4MRpLNXR+00U MVInrJrM+zDe1/spai0tCmPNy5/9nxCe6HBV/KUqHQWlX4/0BuKDVbZTcyDVZPVYOOsh 7TuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776339552; x=1776944352; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=sangyG8tfzJ3xLqN6HjSzyDmUUok+xf6sPcbdCH9vRw=; b=nCBHLrXt7B2VJBarP3WcyF8DgbeuOs74ojaFIO66ruxuE4stnl+9c++qQx7Tr0tf8I m53siY2oX973AjoqXJ5UmCMzjMQLo09K9/qWKDmwG2qrYKe8og8bDfurKxZuIwvIflD0 jdYkIeZOXw6GL7eEd0R2mhahtFXSzTQla2XLXEr7rfelsiWHoSc/OiwBTsbAxB6FBXTX cg7FExurNkScL0PtP10DfQHNW/mzBF9WDtoyAQ4C7/9sQLO+SttXNkGlzp/RDM7IM0lR Kfu2ieaMAObnC9eXhbeptT3dQ0RHYiGVN8/OGtkgdhNX6EWRLQoHjlB1FaebolO5iRdm VYqA== X-Gm-Message-State: AOJu0Yz8Fzt0vcCOGzmNI1T9nWFXUIsVCNtc9mHI5BZh2ug9d9ULEM85 8SJCNUAOCp2IcSrMRuMPsWn0i1XD+xEloI+82G1IysShL+eA9MboazmqCWI/wtUt/GVWQpQRRYa mMtQysxOlQCB8CcRTIPvNp7qa/EjD8LiPkJ5l8yoiaKWEoc1AzB0VGHJaSmuibOs/0HuM X-Gm-Gg: AeBDiescnPghHozgAhJjaDdAFm+LwvFCqVgnGYoSPXvCv+f3h6ZSemUriAVg3GBZ+Zy sxTKz3TSQ576Qktqp3EZZX0TUeP58yCPYgqtnCytNXuO8Tg33ke63i7eDR+utyUliudtqWh0Kk0 Di0HeF03sOP4x5JA40wDqKsqBenQsMdZ+y7AgdkxdhpffKeSXozM/tUaYBpnyfJAVYvA7zkPqKG 51LuVV14WXSLyxEi/RDvucnf23KzlxqmN0RLcyjf2J1oGlOLbd/ZfN4S/F5Sn5XB4qtjRiDAT/A JcxsxtZegeaEh0V22S20HXLunZYx0APvK95eIjA4HD/G/toVaWmEKq+TlT/3Tkvgpe5PbP7gcia YXyoKz9UDNSKU3aFhHfMbPUDdAn8kwA+EnxwlLTBUQ21zb9uv1LmKUhTI21kaekZ4Rh0E2lBGJn MOsOQqP57iMOc7hG81Iig= X-Received: by 2002:a05:7300:cd86:b0:2dd:db16:478e with SMTP id 5a478bee46e88-2dddb164ee1mr4761090eec.10.1776339551838; Thu, 16 Apr 2026 04:39:11 -0700 (PDT) X-Received: by 2002:a05:7300:cd86:b0:2dd:db16:478e with SMTP id 5a478bee46e88-2dddb164ee1mr4761065eec.10.1776339551217; Thu, 16 Apr 2026 04:39:11 -0700 (PDT) From: Matheus Tavares Bernardino To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, ale@rev.ng, anjo@rev.ng, brian.cain@oss.qualcomm.com, ltaylorsimpson@gmail.com, marco.liebel@oss.qualcomm.com, philmd@linaro.org, quic_mburton@quicinc.com, sid.manning@oss.qualcomm.com Subject: [PATCH v5 03/16] target/hexagon/cpu: add HVX IEEE FP extension Date: Thu, 16 Apr 2026 04:38:52 -0700 Message-Id: <10fb5b86db60a465e51db2cf73185307a1ec0895.1776339451.git.matheus.bernardino@oss.qualcomm.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: dfFrfKXMmgzBeXi9-t5OHpOv8C3H8XDJ X-Proofpoint-GUID: dfFrfKXMmgzBeXi9-t5OHpOv8C3H8XDJ X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDE2MDExMCBTYWx0ZWRfX0eRXuAaqKvXk eCiu8MLm91Oe5H1ObODs6w1ijve1JRRxZAL/Oa1IzhKCpn97ZVVctoJQpgIDwY7MFM7Z6u0yaV3 rL+FnBtmQkH3//93Rwd0CWSNCmTBqQu3/CNp+SduZRzwEabUa0z+rxavChV1Dp9vH+wnt6wTEss l5z4P9JsuZbk1B72zwuT8g2Vr/jADlHY5xB7WZcw4iux2Vn4Y11VXFpAyB1gddtZkzEkamN+Z5N Hx47ysdfXW2/OTMuBq1ROV48C9tZbB7zA33o5Lv85ZSlikGFYabR/40RgYDnN/WsjJUUwtUcH61 IKR+USK5qv3KqLOJ4iB3ZeqRJPBVZXNXU9aDwOZTS7Qgk4IytJrghhabg3BdBUBJnEZanK+AULa rIXbKwY8Z2EztblLmyshqyWmTCwx+tbskS84qEHQ5lNY9MBgpHyG5XDPAmRzzan0uqKB7ZCblfN yuIWP9XrOww2sJ7Cigg== X-Authority-Analysis: v=2.4 cv=EojiaycA c=1 sm=1 tr=0 ts=69e0ca60 cx=c_pps a=wEP8DlPgTf/vqF+yE6f9lg==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yOCtJkima9RkubShWh1s:22 a=EUspDBNiAAAA:8 a=3E6RppW8_B6KdyBj4qEA:9 a=bBxd6f-gb0O0v-kibOvt:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-16_03,2026-04-13_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 bulkscore=0 adultscore=0 spamscore=0 phishscore=0 impostorscore=0 suspectscore=0 lowpriorityscore=0 malwarescore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604070000 definitions=main-2604160110 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=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.168.131; envelope-from=matheus.bernardino@oss.qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1776339694435158500 Content-Type: text/plain; charset="utf-8" This flag will be used to control the HVX IEEE float instructions, which are only available at some Hexagon cores. When unavailable, the instruction effectively only set the destination registers to 0. Signed-off-by: Matheus Tavares Bernardino --- target/hexagon/cpu.h | 1 + target/hexagon/translate.h | 1 + target/hexagon/attribs_def.h.inc | 3 +++ target/hexagon/cpu.c | 1 + target/hexagon/translate.c | 1 + target/hexagon/gen_tcg_funcs.py | 11 +++++++++++ target/hexagon/hex_common.py | 25 +++++++++++++++++++++++++ 7 files changed, 43 insertions(+) diff --git a/target/hexagon/cpu.h b/target/hexagon/cpu.h index 85afd59277..77822a48b6 100644 --- a/target/hexagon/cpu.h +++ b/target/hexagon/cpu.h @@ -127,6 +127,7 @@ struct ArchCPU { bool lldb_compat; target_ulong lldb_stack_adjust; bool short_circuit; + bool ieee_fp_extension; }; =20 #include "cpu_bits.h" diff --git a/target/hexagon/translate.h b/target/hexagon/translate.h index b37cb49238..516aab7038 100644 --- a/target/hexagon/translate.h +++ b/target/hexagon/translate.h @@ -70,6 +70,7 @@ typedef struct DisasContext { target_ulong branch_dest; bool is_tight_loop; bool short_circuit; + bool ieee_fp_extension; bool read_after_write; bool has_hvx_overlap; TCGv new_value[TOTAL_PER_THREAD_REGS]; diff --git a/target/hexagon/attribs_def.h.inc b/target/hexagon/attribs_def.= h.inc index 9e3a05f882..c85cd5d17c 100644 --- a/target/hexagon/attribs_def.h.inc +++ b/target/hexagon/attribs_def.h.inc @@ -173,5 +173,8 @@ DEF_ATTRIB(NOTE_SHIFT_RESOURCE, "Uses the HVX shift res= ource.", "", "") DEF_ATTRIB(RESTRICT_NOSLOT1_STORE, "Packet must not have slot 1 store", ""= , "") DEF_ATTRIB(RESTRICT_LATEPRED, "Predicate can not be used as a .new.", "", = "") =20 +/* HVX IEEE FP extension attributes */ +DEF_ATTRIB(HVX_IEEE_FP, "HVX IEEE FP extension instruction", "", "") + /* Keep this as the last attribute: */ DEF_ATTRIB(ZZ_LASTATTRIB, "Last attribute in the file", "", "") diff --git a/target/hexagon/cpu.c b/target/hexagon/cpu.c index ffd14bb467..8b72a5d3c8 100644 --- a/target/hexagon/cpu.c +++ b/target/hexagon/cpu.c @@ -54,6 +54,7 @@ static const Property hexagon_cpu_properties[] =3D { DEFINE_PROP_UNSIGNED("lldb-stack-adjust", HexagonCPU, lldb_stack_adjus= t, 0, qdev_prop_uint32, target_ulong), DEFINE_PROP_BOOL("short-circuit", HexagonCPU, short_circuit, true), + DEFINE_PROP_BOOL("ieee-fp", HexagonCPU, ieee_fp_extension, true), }; =20 const char * const hexagon_regnames[TOTAL_PER_THREAD_REGS] =3D { diff --git a/target/hexagon/translate.c b/target/hexagon/translate.c index 633401451d..fa8f615a9e 100644 --- a/target/hexagon/translate.c +++ b/target/hexagon/translate.c @@ -988,6 +988,7 @@ static void hexagon_tr_init_disas_context(DisasContextB= ase *dcbase, ctx->branch_cond =3D TCG_COND_NEVER; ctx->is_tight_loop =3D FIELD_EX32(hex_flags, TB_FLAGS, IS_TIGHT_LOOP); ctx->short_circuit =3D hex_cpu->short_circuit; + ctx->ieee_fp_extension =3D hex_cpu->ieee_fp_extension; } =20 static void hexagon_tr_tb_start(DisasContextBase *db, CPUState *cpu) diff --git a/target/hexagon/gen_tcg_funcs.py b/target/hexagon/gen_tcg_funcs= .py index 87b7f10d7f..b752ec883c 100755 --- a/target/hexagon/gen_tcg_funcs.py +++ b/target/hexagon/gen_tcg_funcs.py @@ -22,6 +22,14 @@ import string import hex_common =20 +def gen_disabled_ieee_insn(f, tag, regs): + f.write(" if (!ctx->ieee_fp_extension) {\n") + for regtype, regid in regs: + reg =3D hex_common.get_register(tag, regtype, regid) + if reg.is_hvx_reg() and reg.is_written(): + reg.gen_zero(f) + f.write(" return;\n") + f.write(" }\n") =20 ## ## Generate the TCG code to call the helper @@ -62,6 +70,9 @@ def gen_tcg_func(f, tag, regs, imms): i =3D 1 if immlett.isupper() else 0 f.write(f" int {hex_common.imm_name(immlett)} =3D insn->immed[{= i}];\n") =20 + if "A_HVX_IEEE_FP" in hex_common.attribdict[tag]: + gen_disabled_ieee_insn(f, tag, regs) + if hex_common.is_idef_parser_enabled(tag): declared =3D [] ## Handle registers diff --git a/target/hexagon/hex_common.py b/target/hexagon/hex_common.py index c0e9f26aeb..e82a3da1e4 100755 --- a/target/hexagon/hex_common.py +++ b/target/hexagon/hex_common.py @@ -723,6 +723,11 @@ def decl_tcg(self, f, tag, regno): TCGv_ptr {self.reg_tcg()} =3D tcg_temp_new_ptr(); tcg_gen_addi_ptr({self.reg_tcg()}, tcg_env, {self.hvx_off(= )}); """)) + def gen_zero(self, f): + f.write(code_fmt(f"""\ + tcg_gen_gvec_dup_imm(MO_64, {self.hvx_off()}, + sizeof(MMVector), sizeof(MMVector), 0); + """)) def gen_write(self, f, tag): pass def helper_hvx_desc(self, f): @@ -789,6 +794,11 @@ def decl_tcg(self, f, tag, regno): TCGv_ptr {self.reg_tcg()} =3D tcg_temp_new_ptr(); tcg_gen_addi_ptr({self.reg_tcg()}, tcg_env, {self.hvx_off(= )}); """)) + def gen_zero(self, f): + f.write(code_fmt(f"""\ + tcg_gen_gvec_dup_imm(MO_64, {self.hvx_off()}, + sizeof(MMVector), sizeof(MMVector), 0); + """)) def gen_write(self, f, tag): pass def helper_hvx_desc(self, f): @@ -821,6 +831,11 @@ def decl_tcg(self, f, tag, regno): vreg_src_off(ctx, {self.reg_num}), sizeof(MMVector), sizeof(MMVector)); """)) + def gen_zero(self, f): + f.write(code_fmt(f"""\ + tcg_gen_gvec_dup_imm(MO_64, {self.hvx_off()}, + sizeof(MMVector), sizeof(MMVector), 0); + """)) def gen_write(self, f, tag): f.write(code_fmt(f"""\ gen_vreg_write(ctx, {self.hvx_off()}, {self.reg_num}, @@ -854,6 +869,11 @@ def decl_tcg(self, f, tag, regno): TCGv_ptr {self.reg_tcg()} =3D tcg_temp_new_ptr(); tcg_gen_addi_ptr({self.reg_tcg()}, tcg_env, {self.hvx_off(= )}); """)) + def gen_zero(self, f): + f.write(code_fmt(f"""\ + tcg_gen_gvec_dup_imm(MO_64, {self.hvx_off()}, + sizeof(MMVectorPair), sizeof(MMVectorPair), 0); + """)) def gen_write(self, f, tag): pass def helper_hvx_desc(self, f): @@ -913,6 +933,11 @@ def decl_tcg(self, f, tag, regno): TCGv_ptr {self.reg_tcg()} =3D tcg_temp_new_ptr(); tcg_gen_addi_ptr({self.reg_tcg()}, tcg_env, {self.hvx_off(= )}); """)) + def gen_zero(self, f): + f.write(code_fmt(f"""\ + tcg_gen_gvec_dup_imm(MO_64, {self.hvx_off()}, + sizeof(MMVectorPair), sizeof(MMVectorPair), 0); + """)) def gen_write(self, f, tag): f.write(code_fmt(f"""\ gen_vreg_write_pair(ctx, {self.hvx_off()}, {self.reg_num}, --=20 2.37.2 From nobody Sat May 30 20:11:22 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1776339624; cv=none; d=zohomail.com; s=zohoarc; b=JYzOmlwFMLnaU7kq2R7Z8uGPeoGjzcxiYztG/aY0epmV3GOdnSAx3ZQA7xDW84K+OoWAQ4pVY+tjMq3nKN1nPwHle7k0SICV73ygS679ecGqO1ZZdSmgxsrxeu7y9TZUJfMM8Mu798wOw+j89HvZogd1W5L5gNgeQY1WHVVARaI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776339624; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Deo326n2qmwFTkLiBkqpjqgcq8M3rSAS5nM+pXYoWxY=; b=JVwAbOdtaabiV7dsF30JvGansyDKr/BICEbkJzxljc5oW2l0Kjap2nWa/DHqpF5QK4JXbUEIo/PXHaiN/bNtXsDmmTSFOXOecGfKxif/G0K7nUlg+ZwRDRX8xBVHY/LtEWGGoKZCGn3oDOpZbD/sYmMiic9SbMZ71ubmGPrjirc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776339624634931.0408476076847; Thu, 16 Apr 2026 04:40:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wDL45-00056S-UU; Thu, 16 Apr 2026 07:39:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wDL44-00055t-4d for qemu-devel@nongnu.org; Thu, 16 Apr 2026 07:39:20 -0400 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wDL3y-00039y-Tr for qemu-devel@nongnu.org; Thu, 16 Apr 2026 07:39:19 -0400 Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 63G90YD22979251 for ; Thu, 16 Apr 2026 11:39:13 GMT Received: from mail-dy1-f197.google.com (mail-dy1-f197.google.com [74.125.82.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4djvru8hmn-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 16 Apr 2026 11:39:13 +0000 (GMT) Received: by mail-dy1-f197.google.com with SMTP id 5a478bee46e88-2cc75e79b97so30180117eec.1 for ; Thu, 16 Apr 2026 04:39:13 -0700 (PDT) Received: from hu-mathbern-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2de8c10a65asm6845391eec.6.2026.04.16.04.39.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Apr 2026 04:39:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=Deo326n2qmw FTkLiBkqpjqgcq8M3rSAS5nM+pXYoWxY=; b=NRreBNDXiUH/0MBBNFYzSvMC0l2 eYOuX4Gt3F7C354/6F+siRNJyCcYusFr/k9EQEvEFVy6Fb2SHbwkiyH+XH62HJcP /VXGy+E4wsMeDY2kcPAb/b8iNJ9rn3C/MWr6X16rlgousEWKxBKKFnz3q/7lmptx nhJyUGDVYbzrLRi7x613pAUkdMRF4DXshRYO0voY8FUVepHzrviy46NImPWVnwwv 0PVGT7EYNgXtAAks69gEuSafUrejum4nejG3chaoWtS7Da+nTk36zvNZvH33WX4w 7gnzrgnUU3be5Z6nvKamLz5uUtfllBH/vcNxSxN2sUv+BKi5EWqkU6XO/Pw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1776339553; x=1776944353; darn=nongnu.org; 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=Deo326n2qmwFTkLiBkqpjqgcq8M3rSAS5nM+pXYoWxY=; b=e7r13KwRwTs3YUaYBtMmg5oNuakoSqwPQCuVEbh+0hQjl9OXWH6AWfSio3GzapJzkL ghSGBqXXKbkfs1E6Hp/4r/UkfSyogFZI7IBwD6Wj4OH7seBDJcvqJwO1oDfqi3mAF/Gs DzY2HdyFpSEGvzrYWJgLIQBPHoHvQ9q+M0iBRPvHJ82zY062tdvwwXYdnoxtRbbnAngK RH6/DRRfzZ9ndtO2UHWeKPlL+sySwkyhvcGz0QP0SJvJDL9Os2ipWwTxI9drE7uUL+iL LHkLw4tszGzar5TR9jXcwZt0tybD1w10qrPM8poqqGLlyewjSVwjlLJKZ8aTG3vWZYeO mVAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776339553; x=1776944353; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Deo326n2qmwFTkLiBkqpjqgcq8M3rSAS5nM+pXYoWxY=; b=iNXeMoSpEHFeB0ty0cN6IzYliO1QxITBnjDucYMEvc9ce9/VhbtLx/YKD87fZH+g56 RvZDS6juZJ3tV0EZhzfymgGkFNnuBOx8XaXd42FEjyIfs7hpLnWBFMm75zq6RQS4mDEb CFUrL9olwyJ8DQTfvV0UNg3JVIMNsWYuzpi08M1+wWWc3pNfXXNFDh4N7cEsVXQ1yAV8 AV09EaWUcCadC6Jio+DWwWNe1f0ZyFiM71+CQkEYZsgVMmfrbkzQ3b0SwyXVtRAqDnSQ m/yup8tZpAyyXQW5lEYSq5zTejotW6tHB2epNzDPgWDnXx8jpGMqJ3JkkxEVSVS1Gtnd gAbQ== X-Gm-Message-State: AOJu0YzrpO5dlrbQ0JJJ8fZM9DNLF2cxE13A59BHQeVvc7uZS49LAfO/ 2R5b67vWYHOwOr6NczfmgfvgANekmK1nYs+qXXfK1snh4CCFqAavETcUWklfRo5HA8yy05nu/NA l9uMQZbWXIBz+Fwft972WWdhijyMgD6ZIJoEtaOsvLcGzDfMj/Q4nB72PVTbkunJH1nJl X-Gm-Gg: AeBDiesZMCQbAIPgaY5oan7x9WRPalcwa+bE7MBweIFgGO4kSKEgp3TKe8QajLklXtt zJP41aqeG1/QuTg6aYPMfKOsI6PcjmJA7TpPtD/LXo5KuOGZ8T7HZYwxYu23R77wrUKy+B6/+UF fl+1tc7Eso9dXgo6dZnSK+P1dz+KaVh7NTNVD8+haQ2QgoMlVlDLKi/mdRSDXH/wPBZeX6jGRK9 UsRL8Uh7UztcWoVf+StWe0ZppN0+2Ie3bMwttHwjKomCtdITzhbH+gyUYf4VXCcavSDyhaVO6vK 4rgNwaK/6tXDDUOtwEZvwqcKNwvkbF0Wsi1nKQth/lNMrZYJmBHxZ1p6e7/sz6wR+/Uze8Hln0B XcHO38/akSajYDlemK9UUQMjocd1Gr6gZkJhnqdueaFD0wjZZCrLg4Q0Fn22eK+VLAG7oaP2h1t oLrxCqh47Nijhg08Jt3fE= X-Received: by 2002:a05:7300:a284:b0:2da:4216:7ea3 with SMTP id 5a478bee46e88-2da42169606mr8509845eec.14.1776339552640; Thu, 16 Apr 2026 04:39:12 -0700 (PDT) X-Received: by 2002:a05:7300:a284:b0:2da:4216:7ea3 with SMTP id 5a478bee46e88-2da42169606mr8509824eec.14.1776339552104; Thu, 16 Apr 2026 04:39:12 -0700 (PDT) From: Matheus Tavares Bernardino To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, ale@rev.ng, anjo@rev.ng, brian.cain@oss.qualcomm.com, ltaylorsimpson@gmail.com, marco.liebel@oss.qualcomm.com, philmd@linaro.org, quic_mburton@quicinc.com, sid.manning@oss.qualcomm.com Subject: [PATCH v5 04/16] hexagon: group cpu configurations in their own struct Date: Thu, 16 Apr 2026 04:38:53 -0700 Message-Id: <8f9a2e2ccfd2eeda73a63d1a6abbfd6e5458b44c.1776339451.git.matheus.bernardino@oss.qualcomm.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDE2MDExMCBTYWx0ZWRfX27yTu/YaTXpV nj6RWIgkKuNplm610I80sqK29d2cQq5dd9533yGjHdmzVg9lDR0DacETb6rK+7zKUuGCIPSQcD1 bry1nYH+047OADH7rGiGMTrIOns+yNwqaXC4gFbQjvOAS7HNhbRnKPJ/TIKpSu2L0WRq30AgPFr w3aKKks+7ja4mfuRbgZK4L56BloJy8bujzO+G1kgGfijk5HXNYDSuCbcIOhe0cV5lZy2Tjstn+/ 8qHX/veBbqu29uhjFc0QVKKKhV5YTR+if+qJA0DO8b2H8/WXy6v/NMYJo8rgeGnPRLownuy5ztN MxwH5RSAJe5BssHArHluNX++9LybNyhSMAB+TbdYhHp6BgKdi0bImt/bp2KONgaiDIEG94t8gfQ xC8SwrQMyFtsIyjHFGzAQltj2EI76uMLEwhRw1BA26x4Jj2Ia0Be0gydzC6K6Ac5sn2r9Y6Glx0 ncysHNufBenoMhZtlQw== X-Proofpoint-GUID: 2mz1PFc3c2E69X2nPpsGjO1t7JimMrlS X-Proofpoint-ORIG-GUID: 2mz1PFc3c2E69X2nPpsGjO1t7JimMrlS X-Authority-Analysis: v=2.4 cv=GcInWwXL c=1 sm=1 tr=0 ts=69e0ca61 cx=c_pps a=Uww141gWH0fZj/3QKPojxA==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=Um2Pa8k9VHT-vaBCBUpS:22 a=pGLkceISAAAA:8 a=EUspDBNiAAAA:8 a=AHWWR7nXwgbOQO2z_T8A:9 a=PxkB5W3o20Ba91AHUih5:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-16_03,2026-04-13_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 adultscore=0 priorityscore=1501 malwarescore=0 impostorscore=0 phishscore=0 suspectscore=0 bulkscore=0 spamscore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604070000 definitions=main-2604160110 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=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.168.131; envelope-from=matheus.bernardino@oss.qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1776339626720154100 Content-Type: text/plain; charset="utf-8" This will be used in a follow up commit. Reviewed-by: Taylor Simpson Signed-off-by: Matheus Tavares Bernardino Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- target/hexagon/cpu.h | 10 +++------- target/hexagon/cpu_bits.h | 7 +++++++ target/hexagon/cpu.c | 14 +++++++------- target/hexagon/translate.c | 6 +++--- 4 files changed, 20 insertions(+), 17 deletions(-) diff --git a/target/hexagon/cpu.h b/target/hexagon/cpu.h index 77822a48b6..d28beaa92f 100644 --- a/target/hexagon/cpu.h +++ b/target/hexagon/cpu.h @@ -119,19 +119,15 @@ typedef struct HexagonCPUClass { ResettablePhases parent_phases; } HexagonCPUClass; =20 +#include "cpu_bits.h" + struct ArchCPU { CPUState parent_obj; =20 CPUHexagonState env; - - bool lldb_compat; - target_ulong lldb_stack_adjust; - bool short_circuit; - bool ieee_fp_extension; + HexagonCPUConfig cfg; }; =20 -#include "cpu_bits.h" - FIELD(TB_FLAGS, IS_TIGHT_LOOP, 0, 1) =20 G_NORETURN void hexagon_raise_exception_err(CPUHexagonState *env, diff --git a/target/hexagon/cpu_bits.h b/target/hexagon/cpu_bits.h index 19beca81c0..83d13de569 100644 --- a/target/hexagon/cpu_bits.h +++ b/target/hexagon/cpu_bits.h @@ -20,6 +20,13 @@ =20 #include "qemu/bitops.h" =20 +typedef struct HexagonCPUConfig { + bool lldb_compat; + uint32_t lldb_stack_adjust; + bool short_circuit; + bool ieee_fp_extension; +} HexagonCPUConfig; + #define PCALIGN 4 #define PCALIGN_MASK (PCALIGN - 1) =20 diff --git a/target/hexagon/cpu.c b/target/hexagon/cpu.c index 8b72a5d3c8..5470d9c7ce 100644 --- a/target/hexagon/cpu.c +++ b/target/hexagon/cpu.c @@ -50,11 +50,11 @@ static ObjectClass *hexagon_cpu_class_by_name(const cha= r *cpu_model) } =20 static const Property hexagon_cpu_properties[] =3D { - DEFINE_PROP_BOOL("lldb-compat", HexagonCPU, lldb_compat, false), - DEFINE_PROP_UNSIGNED("lldb-stack-adjust", HexagonCPU, lldb_stack_adjus= t, 0, - qdev_prop_uint32, target_ulong), - DEFINE_PROP_BOOL("short-circuit", HexagonCPU, short_circuit, true), - DEFINE_PROP_BOOL("ieee-fp", HexagonCPU, ieee_fp_extension, true), + DEFINE_PROP_BOOL("lldb-compat", HexagonCPU, cfg.lldb_compat, false), + DEFINE_PROP_UNSIGNED("lldb-stack-adjust", HexagonCPU, cfg.lldb_stack_a= djust, + 0, qdev_prop_uint32, target_ulong), + DEFINE_PROP_BOOL("short-circuit", HexagonCPU, cfg.short_circuit, true), + DEFINE_PROP_BOOL("ieee-fp", HexagonCPU, cfg.ieee_fp_extension, true), }; =20 const char * const hexagon_regnames[TOTAL_PER_THREAD_REGS] =3D { @@ -77,7 +77,7 @@ const char * const hexagon_regnames[TOTAL_PER_THREAD_REGS= ] =3D { static target_ulong adjust_stack_ptrs(CPUHexagonState *env, target_ulong a= ddr) { HexagonCPU *cpu =3D env_archcpu(env); - target_ulong stack_adjust =3D cpu->lldb_stack_adjust; + target_ulong stack_adjust =3D cpu->cfg.lldb_stack_adjust; target_ulong stack_start =3D env->stack_start; target_ulong stack_size =3D 0x10000; =20 @@ -181,7 +181,7 @@ static void hexagon_dump(CPUHexagonState *env, FILE *f,= int flags) { HexagonCPU *cpu =3D env_archcpu(env); =20 - if (cpu->lldb_compat) { + if (cpu->cfg.lldb_compat) { /* * When comparing with LLDB, it doesn't step through single-cycle * hardware loops the same way. So, we just skip them here diff --git a/target/hexagon/translate.c b/target/hexagon/translate.c index fa8f615a9e..ce3af96675 100644 --- a/target/hexagon/translate.c +++ b/target/hexagon/translate.c @@ -987,8 +987,8 @@ static void hexagon_tr_init_disas_context(DisasContextB= ase *dcbase, ctx->num_hvx_insns =3D 0; ctx->branch_cond =3D TCG_COND_NEVER; ctx->is_tight_loop =3D FIELD_EX32(hex_flags, TB_FLAGS, IS_TIGHT_LOOP); - ctx->short_circuit =3D hex_cpu->short_circuit; - ctx->ieee_fp_extension =3D hex_cpu->ieee_fp_extension; + ctx->short_circuit =3D hex_cpu->cfg.short_circuit; + ctx->ieee_fp_extension =3D hex_cpu->cfg.ieee_fp_extension; } =20 static void hexagon_tr_tb_start(DisasContextBase *db, CPUState *cpu) @@ -1041,7 +1041,7 @@ static void hexagon_tr_translate_packet(DisasContextB= ase *dcbase, CPUState *cpu) * so end the TLB after every packet. */ HexagonCPU *hex_cpu =3D env_archcpu(env); - if (hex_cpu->lldb_compat && qemu_loglevel_mask(CPU_LOG_TB_CPU)) { + if (hex_cpu->cfg.lldb_compat && qemu_loglevel_mask(CPU_LOG_TB_CPU)= ) { ctx->base.is_jmp =3D DISAS_TOO_MANY; } } --=20 2.37.2 From nobody Sat May 30 20:11:22 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1776339664; cv=none; d=zohomail.com; s=zohoarc; b=L4e3NGUOJyvOn61hQbnwnEdRovww8nNzJvslNJX2Qr+J4wb9A5QAIrDg92IPgOmL26RFb5BQhq6F4F9b2PI3D7ENgmLk8BA0P+44CLZkCfwDkL4JlzOB/ij5LGBwEUGJxzBA04qR3YA+v9SYef9okpuOjhOP6oE9g7Xwe85bz1k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776339664; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ybwCHZLfhnyCfuN9WWdAhCLFmoos/vVMcKHV+YU2Zd4=; b=k/8GHLPN7VR6z5BWKrGnCR0b/NNhw+4/S0iOZGl701UY0aN+tpyrafJt2fTe01N+wtGhw6UiOAyXuAd7MH1yJbEVIp4pwjjHl9Sd7xTnRJP3zCsKBpv9E9wwEmNLWrvJtEOJ5XNtajd8N1/n5Jo+oZt3qgApkxmt6sBHUJ7c4kk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776339664142932.2260581087947; Thu, 16 Apr 2026 04:41:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wDL4Q-0005EX-D8; Thu, 16 Apr 2026 07:39:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wDL45-00056T-OT for qemu-devel@nongnu.org; Thu, 16 Apr 2026 07:39:21 -0400 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wDL43-0003AF-Rz for qemu-devel@nongnu.org; Thu, 16 Apr 2026 07:39:21 -0400 Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 63G8Mhjk3733617 for ; Thu, 16 Apr 2026 11:39:15 GMT Received: from mail-dy1-f200.google.com (mail-dy1-f200.google.com [74.125.82.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4djcqwktwg-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 16 Apr 2026 11:39:14 +0000 (GMT) Received: by mail-dy1-f200.google.com with SMTP id 5a478bee46e88-2c0ba59a830so10020963eec.0 for ; Thu, 16 Apr 2026 04:39:14 -0700 (PDT) Received: from hu-mathbern-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2de8c10a65asm6845391eec.6.2026.04.16.04.39.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Apr 2026 04:39:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=ybwCHZLfhny CfuN9WWdAhCLFmoos/vVMcKHV+YU2Zd4=; b=Byr7ot8ieGuX1N5ri82I7lmiSfV aCBL49jm6QfNYZ51/0cceMu7jAKUQK8jVro6F+fH9s+BXL6bLHF+BO25oHdf3C7r KLZeSxQ5NrU7qz8XYzvv+nCyK1hlCO81h/fODpi9Cc2gmnb1F9F6SQjkACkRtNPn nPDwxzp66hJTZoB9ZJAU5a/98s2/IB6yNyacVuNs/c3cEdNK9aTHMX5SjFSqUPm4 LXwGeMEuyuPbRTBujxifs3Oirs5RMKZ/r/F3T8oyf7EqaS2GomGrlSgF5+7yJDld f0wNUTLBYcQh2n03/i4CoQh5oximnozeqyybgM9hw34Bkq40xc1W00Mh9mw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1776339554; x=1776944354; darn=nongnu.org; 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=ybwCHZLfhnyCfuN9WWdAhCLFmoos/vVMcKHV+YU2Zd4=; b=h6ZEQbX/QjrX7HbI6dQUmbZ+IomVEpJrxNxhpQdHEUgk/UZhompraI4/ytELkj4zL1 4LSez+RrcOagJg0poBGGhYO2tX+SNkdBzmN8YVuuOa5awYxL5rgBbf8xHGnah22yIcyx xfHgcMMb70dcywNAmjgm8Pr6glWI8X8pdPaidf/yhHgViNCAQRWfw6MHeFi4LsV5p0Ro /iCh3oe1lmKJ8U7hRg4/r0KOKuIobWTvCHhmSz3q57bxceK3D3AslzLDpcnBH7LAbq0e udUAasU5g57xJ5AtClhbIPNWaVDB+EffjX6EvyD/QcgDSuRIp92+2/8q0HcJs9MIERGk 3/pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776339554; x=1776944354; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=ybwCHZLfhnyCfuN9WWdAhCLFmoos/vVMcKHV+YU2Zd4=; b=h5tb476SqSdXI3pT+Y+ETuurb8dSDaL8ZTjV1S9YGIuRS5LicxsUk2OTv6QxatIMYk /JK2j4N7d0cnhj545lI3HhlAT6Q0UcP4HALZ1f01+xBX1CYxR2kDiIGKwPBMOBVpMpvt 36dAOmzsrfYElGJAam/094PxmQf+cuEAbSDOT+E9eW7TwRZtpRsdbxv0c7efBBqz3Lo6 BlU+ArMVJ/0uljzRUH2L/+lcupXdHy4hgcjbxaBwaBmkN3tVirrxc1Q1mOUh+Suh+4Uh UtDPsdO/ufRUhs7ACBgkl8/YqBOf64OynBpwlOJPGD4akg2D1dIUFe+38Nb4Ean3gnnz Npng== X-Gm-Message-State: AOJu0YwM57GniJN5dYCEECvPYq13SzvQrBh1axg30BBpFwN6q/xa7qtP qskut1TlsZKPkOa16QxSqSYrXtbT3o+r2ZQ4U85kpujwT1XN5e+aW9RyHLcB8Z7MDiRDFedGTwW j/Lh5UskxbLecxqsqUc5LroN9Wk9jy8k4d/oztPPsN35cZxD6+wRjBBt38Pf66cVVRE9d X-Gm-Gg: AeBDieurG4OIl0RSLZdFbEVejjzHsxKDrVlZc1Pg2vQuV7sSjab25CcYTDtUgY5LdY/ 1ItnbOdxZW1G8KqGfTl2Djhs1rzTpPs/ZsDa/ScJWOV5INAdfG+6/vhs0rj4WnJJpB8k/uji2sM ZRXOGOa8C/9PHiyXW+SOw5bB1WmGWqzHjzF03pu3JNYTnbQFRywcjBiZejdSTYnp8Y6hlPJtEm6 QUV9Jfvf57ydye4Ucc5c4VK3Qx6XvYQFXL7oToqFaKBckjZBl8ZCXbWev4MmWkrcwPG21i2WcSg kTwZhCMMMNSl4zMw4PYZJoofMwISTqdWVfgpYaA4YTc0ku7chIAqsxgvkSKpCvtUHB2hip+7y4G eJJszl8GqSKLSKgfpwjvBxkPexLYbLwlWpka14VXLzBKPX68jloOjpMkHoTb5BklmfjBW/Fg1r+ jDnMDCTYtntqaPkk+yqGs= X-Received: by 2002:a05:7300:a287:b0:2c1:3f85:747 with SMTP id 5a478bee46e88-2d5894628demr13808502eec.21.1776339553495; Thu, 16 Apr 2026 04:39:13 -0700 (PDT) X-Received: by 2002:a05:7300:a287:b0:2c1:3f85:747 with SMTP id 5a478bee46e88-2d5894628demr13808475eec.21.1776339552863; Thu, 16 Apr 2026 04:39:12 -0700 (PDT) From: Matheus Tavares Bernardino To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, ale@rev.ng, anjo@rev.ng, brian.cain@oss.qualcomm.com, ltaylorsimpson@gmail.com, marco.liebel@oss.qualcomm.com, philmd@linaro.org, quic_mburton@quicinc.com, sid.manning@oss.qualcomm.com Subject: [PATCH v5 05/16] hexagon: print info on "-d in_asm" for disabled IEEE FP instructions Date: Thu, 16 Apr 2026 04:38:54 -0700 Message-Id: <1bdc772e4a795ecd9f5bf2b7e7143cc4b297318c.1776339451.git.matheus.bernardino@oss.qualcomm.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: fsy5q0_QbfNxr2g5Zma8Vfsm1J0CRdw- X-Proofpoint-GUID: fsy5q0_QbfNxr2g5Zma8Vfsm1J0CRdw- X-Authority-Analysis: v=2.4 cv=XOIAjwhE c=1 sm=1 tr=0 ts=69e0ca62 cx=c_pps a=PfFC4Oe2JQzmKTvty2cRDw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=eoimf2acIAo5FJnRuUoq:22 a=pGLkceISAAAA:8 a=EUspDBNiAAAA:8 a=uwSgyZDXI7pCxt1u4dUA:9 a=6Ab_bkdmUrQuMsNx7PHu:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDE2MDExMCBTYWx0ZWRfX+G+q7TCNfhC9 Rhs2Nk3qjKe+YfteQaz/mfrPLvivhieLpq57qipwe3mN0K0Gjj1YyMuW2lUSYBBF3sd/PKOv/FA JIZSkffZu20XYGtbGvtUrx0YnTVopG0ysOJrrj3gPff3xWdfEjA/RVbslVedJHdAkaWPjfPsmEy yGA43JbCw4kS4J0zvmGvvjJhnu3DC3BodquUU44HZlDB+vZBEvy8bycgKWWzar6+k6RAhpTFpcc 5Smvj1tigrm5N3YrxH4XbuthqR0lSkvU7UvrEObm5DbtORjxXQtjPxLQV6G0aT+N/vMnSX496mh zvDF37hkrfCaLDIXjlZ1+KJqv2own9IvC/P6XBb5Jeee7m5XbtwkXdnq0ytdhZynAqNDhZ+s4BO eVwLb+ZWLquqD5uhoIyKeBOeKVvAM2CTU3Fw66Mkys+MVymC5HsdEsfNK7DMm8Lffov1Ur+h4dH OQ2YnJjlFQG5oxmhVGw== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-16_03,2026-04-13_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 adultscore=0 suspectscore=0 spamscore=0 malwarescore=0 bulkscore=0 impostorscore=0 phishscore=0 clxscore=1015 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604070000 definitions=main-2604160110 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=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.168.131; envelope-from=matheus.bernardino@oss.qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1776339666051158500 Content-Type: text/plain; charset="utf-8" When cpu->cfg.ieee_fp_extension is off, IEEE FP instructions don't get executed. Let's print that info on the "-d in_asm" output to help users. This will generate an output like the following: 0x00020e30: 0x1f82e1c0 { V0.sf =3D vadd(V1.sf,V2.sf) (disabled: no i= eee_fp) } Reviewed-by: Taylor Simpson Signed-off-by: Matheus Tavares Bernardino Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- target/hexagon/cpu_bits.h | 3 ++- target/hexagon/printinsn.h | 2 +- disas/hexagon.c | 3 ++- target/hexagon/cpu.c | 2 ++ target/hexagon/decode.c | 4 ++-- target/hexagon/printinsn.c | 7 ++++++- 6 files changed, 15 insertions(+), 6 deletions(-) diff --git a/target/hexagon/cpu_bits.h b/target/hexagon/cpu_bits.h index 83d13de569..1f9e617d72 100644 --- a/target/hexagon/cpu_bits.h +++ b/target/hexagon/cpu_bits.h @@ -72,6 +72,7 @@ static inline bool is_packet_end(uint32_t endocing) return ((bits =3D=3D 0x3) || (bits =3D=3D 0x0)); } =20 -int disassemble_hexagon(uint32_t *words, int nwords, bfd_vma pc, GString *= buf); +int disassemble_hexagon(uint32_t *words, int nwords, bfd_vma pc, + GString *buf, const HexagonCPUConfig *cfg); =20 #endif diff --git a/target/hexagon/printinsn.h b/target/hexagon/printinsn.h index 2ecd1731d0..6a45ec571f 100644 --- a/target/hexagon/printinsn.h +++ b/target/hexagon/printinsn.h @@ -21,7 +21,7 @@ #include "insn.h" =20 void snprint_a_pkt_disas(GString *buf, Packet *pkt, uint32_t *words, - target_ulong pc); + target_ulong pc, const HexagonCPUConfig *cfg); void snprint_a_pkt_debug(GString *buf, Packet *pkt); =20 #endif diff --git a/disas/hexagon.c b/disas/hexagon.c index c1a4ffc5f6..e2d3804606 100644 --- a/disas/hexagon.c +++ b/disas/hexagon.c @@ -57,8 +57,9 @@ int print_insn_hexagon(bfd_vma memaddr, struct disassembl= e_info *info) return PACKET_WORDS_MAX * sizeof(uint32_t); } =20 + const HexagonCPUConfig *cfg =3D info->target_info; buf =3D g_string_sized_new(PACKET_BUFFER_LEN); - len =3D disassemble_hexagon(words, i, memaddr, buf); + len =3D disassemble_hexagon(words, i, memaddr, buf, cfg); (*info->fprintf_func)(info->stream, "%s", buf->str); g_string_free(buf, true); =20 diff --git a/target/hexagon/cpu.c b/target/hexagon/cpu.c index 5470d9c7ce..d7f4df5f96 100644 --- a/target/hexagon/cpu.c +++ b/target/hexagon/cpu.c @@ -307,6 +307,8 @@ static void hexagon_cpu_disas_set_info(const CPUState *= cs, { info->print_insn =3D print_insn_hexagon; info->endian =3D BFD_ENDIAN_LITTLE; + HexagonCPU *cpu =3D HEXAGON_CPU(cs); + info->target_info =3D &cpu->cfg; } =20 static void hexagon_cpu_realize(DeviceState *dev, Error **errp) diff --git a/target/hexagon/decode.c b/target/hexagon/decode.c index dbc9c630e8..d7ce8c8e1b 100644 --- a/target/hexagon/decode.c +++ b/target/hexagon/decode.c @@ -801,7 +801,7 @@ int decode_packet(DisasContext *ctx, int max_words, con= st uint32_t *words, =20 /* Used for "-d in_asm" logging */ int disassemble_hexagon(uint32_t *words, int nwords, bfd_vma pc, - GString *buf) + GString *buf, const HexagonCPUConfig *cfg) { DisasContext ctx; Packet pkt; @@ -810,7 +810,7 @@ int disassemble_hexagon(uint32_t *words, int nwords, bf= d_vma pc, ctx.pkt =3D &pkt; =20 if (decode_packet(&ctx, nwords, words, &pkt, true) > 0) { - snprint_a_pkt_disas(buf, &pkt, words, pc); + snprint_a_pkt_disas(buf, &pkt, words, pc, cfg); return pkt.encod_pkt_size_in_bytes; } else { g_string_assign(buf, ""); diff --git a/target/hexagon/printinsn.c b/target/hexagon/printinsn.c index 4865cdd133..85527f56e2 100644 --- a/target/hexagon/printinsn.c +++ b/target/hexagon/printinsn.c @@ -51,7 +51,7 @@ static void snprintinsn(GString *buf, Insn *insn) } =20 void snprint_a_pkt_disas(GString *buf, Packet *pkt, uint32_t *words, - target_ulong pc) + target_ulong pc, const HexagonCPUConfig *cfg) { bool has_endloop0 =3D false; bool has_endloop1 =3D false; @@ -85,6 +85,11 @@ void snprint_a_pkt_disas(GString *buf, Packet *pkt, uint= 32_t *words, g_string_append(buf, "\t"); snprintinsn(buf, &(pkt->insn[i])); =20 + if (!cfg->ieee_fp_extension && + GET_ATTRIB(pkt->insn[i].opcode, A_HVX_IEEE_FP)) { + g_string_append(buf, " (disabled: no ieee_fp)"); + } + if (i < pkt->num_insns - 1) { /* * Subinstructions are two instructions encoded --=20 2.37.2 From nobody Sat May 30 20:11:22 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1776339698; cv=none; d=zohomail.com; s=zohoarc; b=QT6AnBEXKhjyu0STAI1/6/xNu+Sw5crdT4dhg/VgL1xT/KjsUJsp8w11aNPQvsJUHz6KfCkBPilcNl5RyjBqJBcSHmL/p525hyLlQc99koWVsycddjVTZ3Z0j1zx7HNH8iyNplU6e6wmL7MQGw+BZJT/dwM7S2wEeNpv+FPumBw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776339698; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=jCVq6vhL1FMNRU1Z8bQ3f+kHHA+t9pwM2JO0iG0it9o=; b=X5zEsMOlvZf44ryGk8a+46TK4qGg2Opn5v1t6HJiCeyQDiQe1nh696q3Y/K18i7SD+VFmJXJCEzuX8g8iel0X/oVafC2JImxYgrrSXycoASY9bEWov8anbXB4TBJ54txS8TZl8En+aFpFjzHU7XLEXI1OSfKySx+6wRXA/QzAdE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776339698710612.654551634485; Thu, 16 Apr 2026 04:41:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wDL4N-0005DA-RX; Thu, 16 Apr 2026 07:39:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wDL48-00057Q-2j for qemu-devel@nongnu.org; Thu, 16 Apr 2026 07:39:27 -0400 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wDL43-0003Aa-TO for qemu-devel@nongnu.org; Thu, 16 Apr 2026 07:39:23 -0400 Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 63GAXw2O1245168 for ; Thu, 16 Apr 2026 11:39:16 GMT Received: from mail-dy1-f199.google.com (mail-dy1-f199.google.com [74.125.82.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4djx4k863u-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 16 Apr 2026 11:39:16 +0000 (GMT) Received: by mail-dy1-f199.google.com with SMTP id 5a478bee46e88-2ba8013a9e3so9608050eec.0 for ; Thu, 16 Apr 2026 04:39:16 -0700 (PDT) Received: from hu-mathbern-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2de8c10a65asm6845391eec.6.2026.04.16.04.39.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Apr 2026 04:39:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=jCVq6vhL1FM NRU1Z8bQ3f+kHHA+t9pwM2JO0iG0it9o=; b=OuJaF6mMig2Zt0kfHfDoSuV3/JK e6g5LhmDo8QnblRdtY3P7VN3IhPhLq0udE/DciQjM4t19CI6pi6pn28ivj3ygpBT en05i23vfe7akDR1z3OI/gAymPYOT/SH99OqGp3I8JzudFSPNxRru8htrlf89JWp kgGAacReDIFVCl0SyerfE5VpDWAOJhCuzCtgKYYo7xWau86Y4DyqGn3VgSimeZ1n 9fa8dEJ1pXSFfEv91OnmhDx4V818YvxhfNzD3LsNlbktlqH5zirm8xjH4RuvR227 QQ0n35dv6SbEJ3yJVRY9sVDqKVNIT5ZOArimQK61iTPZ2Pr/h2wYBkQ9s/w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1776339555; x=1776944355; darn=nongnu.org; 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=jCVq6vhL1FMNRU1Z8bQ3f+kHHA+t9pwM2JO0iG0it9o=; b=DfG5wyKMyl3HT51QSZKrGq9KF6zkD0WIGQckZandOdhBYCxq/xSn2bz2ck0N+kkX9a hD3TK1JDVFfyayBN9UV8VWgC1R00VJGWHnY1ed6h6Xy4GftPDFQja77oL7wuvqm6gNHI o5B/wmhZY67eeUcyojvphhED9ifpL6/CQ8TF8pqFvu8ztMJB1Gq45AGviOnHxAo72CBd IvB/B0FWLWy3WcsiYk29AS5elgMZL8bfRLsIL30EItSeEW/i6S5YB9cN2ajlh1Z6In8F syUz5CUtZx4QVl+ymC24/YG+AO4PlOlOHI+VT5AWNNMwoy8NLQlzm2uuYtyqlVSugDRX V/YQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776339555; x=1776944355; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=jCVq6vhL1FMNRU1Z8bQ3f+kHHA+t9pwM2JO0iG0it9o=; b=ACp+WKCNK2DltNPZ2Xurhatku1rbufFvyz7GKv9Kwjl0hr9jkxcmGfvU6oljs9oSM8 +6ptV3fDiX2vIlabsTN0rG1YW65jMYWyBwVTkIa3XSNFqg3ZbY1XG9BQ9bDNfjzfkece TLS6JP/jVL116ZY3vac7c6/pGlqDEbpZw3K5A/IP/+gVKecpyqJYlWfio1cEHHf1QFO6 qGum7haRZI7g77SQMWXY3gGcd/PMhtTK2+OflVVIfgMINsOnetmOJievsJkIxBYo87rM QH8GVDLJa/Ydyoa9yafMux4sypBIvzc8j6wknqNJMVmZS04a/A6RH86zPDvy5Sy/oV3p aRMw== X-Gm-Message-State: AOJu0Yz01PXnufgCCIw5/Eb5KuStvAbnm7lK73IPtHnAes8hFvOFr7Uz 6LL0RJixXuhvQ3OxfzVpxfRGYyxRzHBkAdmtrOI0r9iTYrt9hMR3WKVmihsbNCtoL2F7aG96u4N w9aWaRfo53EPdOl6vRVREJ9NHSgYTQEGqDrUDvs9hFIyN/uDQJKGtpskGe1bfGB+hLCL5 X-Gm-Gg: AeBDiesf8kVtGd9VjbqaUi4DA3XN/xFnaLV2mCfjKoJZeidyPYDxV77tQdK//SY8ght z7dhZ9Zv7dwF82G9RO6vT+Ak1QWS2DDoFSo/BBTnV9BZBwLiLrl8JJwYi22badHO4m42B7XML8t EH9EM6Z8mnj1t70Newl8uV4OEDBpK41Pmrw1kiaqDIzFMoEbAufp6D+ytmIp/W6NkoMoTXMSpzJ 5cUqgT+28OysOlzGe+BjilmUhfAld0Yhzgf39yUUFh6GpRp2APF6dMiWWDIRXtLS4AbXjgKoK/T vnCGJwCHFVEaRaVWa91bhn8tzbgUhhjEPX1lupHr8xUrJB4HOnWKLbVVDtSaqJ4Xivs4wm1G756 4bn1QnUSZTaXTk28bbzRmUunDMAe2dZasugvArRGqITRd/gJR+56dpiTy3fN4eWU4aYhrOiOVKo 2JWdA3Ftkgdg32QSrALCA= X-Received: by 2002:a05:7300:72ce:b0:2d8:71c2:255d with SMTP id 5a478bee46e88-2d871c22a7cmr10402386eec.14.1776339554490; Thu, 16 Apr 2026 04:39:14 -0700 (PDT) X-Received: by 2002:a05:7300:72ce:b0:2d8:71c2:255d with SMTP id 5a478bee46e88-2d871c22a7cmr10402357eec.14.1776339553846; Thu, 16 Apr 2026 04:39:13 -0700 (PDT) From: Matheus Tavares Bernardino To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, ale@rev.ng, anjo@rev.ng, brian.cain@oss.qualcomm.com, ltaylorsimpson@gmail.com, marco.liebel@oss.qualcomm.com, philmd@linaro.org, quic_mburton@quicinc.com, sid.manning@oss.qualcomm.com Subject: [PATCH v5 06/16] target/hexagon: add v68 HVX IEEE float arithmetic insns Date: Thu, 16 Apr 2026 04:38:55 -0700 Message-Id: <8923b6c6bc4fe750c07a07bcd490761f8bab52fe.1776339451.git.matheus.bernardino@oss.qualcomm.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: GH3dyIT7ovzPVxmuu582DwQYvgdVNJS5 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDE2MDExMCBTYWx0ZWRfX5FxkiEX6v158 hEyoHIN4baWc6qDG/5xyoUXypj9+XWO32TpVL+j9meZv0ryrm+UbYICJsxKQZOK3p4y4oh9eycO 0BawFfkDMHwau1JAnuB2udx3JtToNClYVDhELCwJb9ocRGRtcslYqMOc5BTo6YwhK/0LOba1ubM kplvb/mq0wTZPdT2t0qtkh1jk5BUTbJNOYxJE7/FHlWvPQ4hztKmlXMQP/jaEFkBaaTuv0jTPqu 9rLfqCTEb/w9YJOI1ScRF5vP27+T4xiOpSbdpV4ZLxos4k0xVlT9J5IkkQ0H8LGIeWF/G9mdToh y6QZPRVDPIcJ8J+6pnUUebMHd0HD9B542YCyH9CIUCJAeR5F3bW3w0pMJ/wJu0sDT2b5R+GviTY WKAraN1maONBMOaG0ZsO89ZfHLq3XeLi7P/2XnGPJMU6Je0VArE43s++HmvJq+CPwtnOxYv/nv3 YPdN6ZxfW7XfRm6nDYg== X-Authority-Analysis: v=2.4 cv=H47rBeYi c=1 sm=1 tr=0 ts=69e0ca64 cx=c_pps a=cFYjgdjTJScbgFmBucgdfQ==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=YMgV9FUhrdKAYTUUvYB2:22 a=pGLkceISAAAA:8 a=EUspDBNiAAAA:8 a=4NIkZbyvPJlZ22FWuuMA:9 a=scEy_gLbYbu1JhEsrz4S:22 X-Proofpoint-ORIG-GUID: GH3dyIT7ovzPVxmuu582DwQYvgdVNJS5 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-16_03,2026-04-13_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 suspectscore=0 lowpriorityscore=0 clxscore=1015 priorityscore=1501 phishscore=0 bulkscore=0 adultscore=0 spamscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604070000 definitions=main-2604160110 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=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.168.131; envelope-from=matheus.bernardino@oss.qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1776339700084154100 Content-Type: text/plain; charset="utf-8" Add HVX IEEE floating-point arithmetic instructions: - vmpy_sf_sf, vmpy_sf_hf, vmpy_hf_hf: multiply operations - vdmpy_sf_hf: dot-product multiply - vmpy_sf_hf_acc, vmpy_hf_hf_acc, vdmpy_sf_hf_acc: multiply-accumulate - vadd_sf_sf, vsub_sf_sf, vadd_sf_hf, vsub_sf_hf: add/sub with sf output - vadd_hf_hf, vsub_hf_hf: add/sub with hf output Reviewed-by: Taylor Simpson Signed-off-by: Matheus Tavares Bernardino --- target/hexagon/cpu.h | 1 + target/hexagon/mmvec/hvx_ieee_fp.h | 18 ++++ target/hexagon/mmvec/macros.h | 1 + target/hexagon/mmvec/mmvec.h | 2 + target/hexagon/attribs_def.h.inc | 4 + target/hexagon/arch.c | 8 ++ target/hexagon/cpu.c | 3 + target/hexagon/mmvec/hvx_ieee_fp.c | 21 ++++ target/hexagon/hex_common.py | 1 + target/hexagon/imported/mmvec/encode_ext.def | 18 ++++ target/hexagon/imported/mmvec/ext.idef | 101 +++++++++++++++++++ target/hexagon/meson.build | 1 + 12 files changed, 179 insertions(+) create mode 100644 target/hexagon/mmvec/hvx_ieee_fp.h create mode 100644 target/hexagon/mmvec/hvx_ieee_fp.c diff --git a/target/hexagon/cpu.h b/target/hexagon/cpu.h index d28beaa92f..5a008d1949 100644 --- a/target/hexagon/cpu.h +++ b/target/hexagon/cpu.h @@ -87,6 +87,7 @@ typedef struct CPUArchState { MemLog mem_log_stores[STORES_MAX]; =20 float_status fp_status; + float_status hvx_fp_status; =20 target_ulong llsc_addr; target_ulong llsc_val; diff --git a/target/hexagon/mmvec/hvx_ieee_fp.h b/target/hexagon/mmvec/hvx_= ieee_fp.h new file mode 100644 index 0000000000..75008deb3b --- /dev/null +++ b/target/hexagon/mmvec/hvx_ieee_fp.h @@ -0,0 +1,18 @@ +/* + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef HEXAGON_HVX_IEEE_H +#define HEXAGON_HVX_IEEE_H + +#include "fpu/softfloat.h" + +#define f16_to_f32(A) float16_to_float32((A), true, &env->hvx_fp_status) + +float32 fp_mult_sf_hf(float16 a1, float16 a2, float_status *fp_status); +float32 fp_vdmpy(float16 a1, float16 a2, float16 a3, float16 a4, + float_status *fp_status); + +#endif diff --git a/target/hexagon/mmvec/macros.h b/target/hexagon/mmvec/macros.h index c7840fbf2e..ac709d8993 100644 --- a/target/hexagon/mmvec/macros.h +++ b/target/hexagon/mmvec/macros.h @@ -23,6 +23,7 @@ #include "mmvec/system_ext_mmvec.h" #include "accel/tcg/getpc.h" #include "accel/tcg/probe.h" +#include "mmvec/hvx_ieee_fp.h" =20 #ifndef QEMU_GENERATE #define VdV (*(MMVector *restrict)(VdV_void)) diff --git a/target/hexagon/mmvec/mmvec.h b/target/hexagon/mmvec/mmvec.h index 52d470709c..31909303b5 100644 --- a/target/hexagon/mmvec/mmvec.h +++ b/target/hexagon/mmvec/mmvec.h @@ -38,6 +38,8 @@ typedef union { int16_t h[MAX_VEC_SIZE_BYTES / 2]; uint8_t ub[MAX_VEC_SIZE_BYTES / 1]; int8_t b[MAX_VEC_SIZE_BYTES / 1]; + float32 sf[MAX_VEC_SIZE_BYTES / 4]; + float16 hf[MAX_VEC_SIZE_BYTES / 2]; } MMVector; =20 typedef union { diff --git a/target/hexagon/attribs_def.h.inc b/target/hexagon/attribs_def.= h.inc index c85cd5d17c..d3c4bf6301 100644 --- a/target/hexagon/attribs_def.h.inc +++ b/target/hexagon/attribs_def.h.inc @@ -175,6 +175,10 @@ DEF_ATTRIB(RESTRICT_LATEPRED, "Predicate can not be us= ed as a .new.", "", "") =20 /* HVX IEEE FP extension attributes */ DEF_ATTRIB(HVX_IEEE_FP, "HVX IEEE FP extension instruction", "", "") +DEF_ATTRIB(HVX_IEEE_FP_ACC, "HVX IEEE FP accumulate instruction", "", "") +DEF_ATTRIB(HVX_IEEE_FP_OUT_16, "HVX IEEE FP 16-bit output", "", "") +DEF_ATTRIB(HVX_IEEE_FP_OUT_32, "HVX IEEE FP 32-bit output", "", "") +DEF_ATTRIB(CVI_VX_NO_TMP_LD, "HVX multiply without tmp load", "", "") =20 /* Keep this as the last attribute: */ DEF_ATTRIB(ZZ_LASTATTRIB, "Last attribute in the file", "", "") diff --git a/target/hexagon/arch.c b/target/hexagon/arch.c index e17e714a6a..358aa71e03 100644 --- a/target/hexagon/arch.c +++ b/target/hexagon/arch.c @@ -199,6 +199,10 @@ void arch_fpop_start(CPUHexagonState *env) set_float_rounding_mode( softfloat_roundingmodes[fREAD_REG_FIELD(USR, USR_FPRND)], &env->fp_status); + /* + * No need to check env->hvx_fp_status, these instructions don't + * raise exceptions nor interact with usr fields. + */ } =20 #ifdef CONFIG_USER_ONLY @@ -232,6 +236,10 @@ void arch_fpop_end(CPUHexagonState *env, bool pkt_need= _commit) SOFTFLOAT_TEST_FLAG(float_flag_overflow, FPOVFF, FPOVFE); SOFTFLOAT_TEST_FLAG(float_flag_underflow, FPUNFF, FPUNFE); } + /* + * No need to check env->hvx_fp_status, these instructions don't + * raise exceptions nor interact with usr fields. + */ } =20 int arch_sf_recip_common(float32 *Rs, float32 *Rt, float32 *Rd, int *adjus= t, diff --git a/target/hexagon/cpu.c b/target/hexagon/cpu.c index d7f4df5f96..d6ca51f175 100644 --- a/target/hexagon/cpu.c +++ b/target/hexagon/cpu.c @@ -300,6 +300,9 @@ static void hexagon_cpu_reset_hold(Object *obj, ResetTy= pe type) set_float_detect_tininess(float_tininess_before_rounding, &env->fp_sta= tus); /* Default NaN value: sign bit set, all frac bits set */ set_float_default_nan_pattern(0b11111111, &env->fp_status); + + set_default_nan_mode(1, &env->hvx_fp_status); + set_float_default_nan_pattern(0b01111111, &env->hvx_fp_status); } =20 static void hexagon_cpu_disas_set_info(const CPUState *cs, diff --git a/target/hexagon/mmvec/hvx_ieee_fp.c b/target/hexagon/mmvec/hvx_= ieee_fp.c new file mode 100644 index 0000000000..3367226998 --- /dev/null +++ b/target/hexagon/mmvec/hvx_ieee_fp.c @@ -0,0 +1,21 @@ +/* + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "hvx_ieee_fp.h" + +float32 fp_mult_sf_hf(float16 a1, float16 a2, float_status *fp_status) +{ + return float32_mul(float16_to_float32(a1, true, fp_status), + float16_to_float32(a2, true, fp_status), fp_status); +} + +float32 fp_vdmpy(float16 a1, float16 a2, float16 a3, float16 a4, + float_status *fp_status) +{ + return float32_add(fp_mult_sf_hf(a1, a3, fp_status), + fp_mult_sf_hf(a2, a4, fp_status), fp_status); +} diff --git a/target/hexagon/hex_common.py b/target/hexagon/hex_common.py index e82a3da1e4..9819201b50 100755 --- a/target/hexagon/hex_common.py +++ b/target/hexagon/hex_common.py @@ -215,6 +215,7 @@ def need_env(tag): "A_LOAD" in attribdict[tag] or "A_CVI_GATHER" in attribdict[tag] or "A_CVI_SCATTER" in attribdict[tag] or + "A_HVX_IEEE_FP" in attribdict[tag] or "A_IMPLICIT_WRITES_USR" in attribdict[tag]) =20 =20 diff --git a/target/hexagon/imported/mmvec/encode_ext.def b/target/hexagon/= imported/mmvec/encode_ext.def index 6d70086b5f..4ce87d09fd 100644 --- a/target/hexagon/imported/mmvec/encode_ext.def +++ b/target/hexagon/imported/mmvec/encode_ext.def @@ -804,5 +804,23 @@ DEF_ENC(V6_vmpyewuh, ICLASS_CJ" 1 111 111 vvvvv PP = 0 uuuuu 101 ddddd") DEF_ENC(V6_vmpyowh, ICLASS_CJ" 1 111 111 vvvvv PP 0 uuuuu 111 ddddd= ") DEF_ENC(V6_vmpyuhvs,"00011111110vvvvvPP1uuuuu111ddddd") =20 +/* IEEE FP multiply instructions */ +DEF_ENC(V6_vmpy_sf_sf,"00011111100vvvvvPP1uuuuu001ddddd") +DEF_ENC(V6_vmpy_sf_hf,"00011111100vvvvvPP1uuuuu010ddddd") +DEF_ENC(V6_vmpy_hf_hf,"00011111100vvvvvPP1uuuuu011ddddd") +DEF_ENC(V6_vdmpy_sf_hf,"00011111101vvvvvPP1uuuuu110ddddd") + +/* IEEE FP multiply-accumulate instructions */ +DEF_ENC(V6_vmpy_sf_hf_acc,"00011100010vvvvvPP1uuuuu001xxxxx") +DEF_ENC(V6_vmpy_hf_hf_acc,"00011100010vvvvvPP1uuuuu010xxxxx") +DEF_ENC(V6_vdmpy_sf_hf_acc,"00011100010vvvvvPP1uuuuu011xxxxx") + +/* IEEE FP add/sub instructions */ +DEF_ENC(V6_vadd_sf_sf,"00011111100vvvvvPP1uuuuu110ddddd") +DEF_ENC(V6_vsub_sf_sf,"00011111100vvvvvPP1uuuuu111ddddd") +DEF_ENC(V6_vadd_sf_hf,"00011111100vvvvvPP1uuuuu100ddddd") +DEF_ENC(V6_vsub_sf_hf,"00011111100vvvvvPP1uuuuu101ddddd") +DEF_ENC(V6_vadd_hf_hf,"00011111101vvvvvPP1uuuuu111ddddd") +DEF_ENC(V6_vsub_hf_hf,"00011111011vvvvvPP1uuuuu000ddddd") =20 #endif /* NO MMVEC */ diff --git a/target/hexagon/imported/mmvec/ext.idef b/target/hexagon/import= ed/mmvec/ext.idef index 03d31f6181..14df8e4790 100644 --- a/target/hexagon/imported/mmvec/ext.idef +++ b/target/hexagon/imported/mmvec/ext.idef @@ -2895,9 +2895,110 @@ EXTINSN(V6_vprefixqw,"Vd32.w=3Dprefixsum(Qv4)", A= TTRIBS(A_EXTENSION,A_CVI,A_CVI_ } } ) =20 +/* KVX - IEEE FP Instructions */ =20 +/* Single pipe, 32-bit output */ +#define ITERATOR_INSN_IEEE_FP_32(WIDTH,TAG,SYNTAX,DESCR,CODE) \ +EXTINSN(V6_##TAG, SYNTAX, \ +ATTRIBS(A_EXTENSION,A_HVX_IEEE_FP,A_CVI,A_CVI_VX,A_HVX_IEEE_FP_OUT_32), \ +DESCR, DO_FOR_EACH_CODE(WIDTH, CODE)) =20 +/* Single pipe, 16-bit output */ +#define ITERATOR_INSN_IEEE_FP_16(WIDTH,TAG,SYNTAX,DESCR,CODE) \ +EXTINSN(V6_##TAG, SYNTAX, \ +ATTRIBS(A_EXTENSION,A_HVX_IEEE_FP,A_CVI,A_CVI_VX,A_HVX_IEEE_FP_OUT_16), \ +DESCR, DO_FOR_EACH_CODE(WIDTH, CODE)) =20 +/* Two pipes: P2 & P3, single output: P2, 32-bit output */ +#define ITERATOR_INSN_IEEE_FP_DOUBLE_SINGLE_32(WIDTH,TAG,SYNTAX,DESCR,CODE= ) \ +EXTINSN(V6_##TAG, SYNTAX, \ +ATTRIBS(A_EXTENSION,A_HVX_IEEE_FP,A_CVI,A_CVI_VX_DV,A_HVX_IEEE_FP_OUT_32),= \ +DESCR, DO_FOR_EACH_CODE(WIDTH, CODE)) + +/* Two pipes: P2 & P3, two outputs, 32-bit output */ +#define ITERATOR_INSN_IEEE_FP_DOUBLE_32(WIDTH,TAG,SYNTAX,DESCR,CODE) \ +EXTINSN(V6_##TAG, SYNTAX, \ +ATTRIBS(A_EXTENSION,A_HVX_IEEE_FP,A_CVI,A_CVI_VX_DV,A_HVX_IEEE_FP_OUT_32),= \ +DESCR, DO_FOR_EACH_CODE(WIDTH, CODE)) + +/* + * single pipe, accumulate instruction, produces 16-bit output, requires 1= 6-bit + * accumulate input + */ +#define ITERATOR_INSN_IEEE_FP_ACC_16(WIDTH,TAG,SYNTAX,DESCR,CODE) \ +EXTINSN(V6_##TAG, SYNTAX, \ +ATTRIBS(A_EXTENSION,A_HVX_IEEE_FP,A_CVI,A_CVI_VX,A_HVX_IEEE_FP_ACC,A_HVX_I= EEE_FP_OUT_16,A_CVI_VX_NO_TMP_LD), \ +DESCR, DO_FOR_EACH_CODE(WIDTH, CODE)) + +/* + * single pipe, accumulate instruction, produces 32-bit output, requires 3= 2-bit + * accumulate input + */ +#define ITERATOR_INSN_IEEE_FP_ACC_32(WIDTH,TAG,SYNTAX,DESCR,CODE) \ +EXTINSN(V6_##TAG, SYNTAX, \ +ATTRIBS(A_EXTENSION,A_HVX_IEEE_FP,A_CVI,A_CVI_VX,A_HVX_IEEE_FP_ACC,A_HVX_I= EEE_FP_OUT_32,A_CVI_VX_NO_TMP_LD), \ +DESCR, DO_FOR_EACH_CODE(WIDTH, CODE)) + +/* IEEE FP multiply instructions */ +ITERATOR_INSN_IEEE_FP_DOUBLE_SINGLE_32(32, vmpy_sf_sf, + "Vd32.sf=3Dvmpy(Vu32.sf,Vv32.sf)", "Vector IEEE mul: sf", + VdV.sf[i] =3D float32_mul(VuV.sf[i], VvV.sf[i], &env->hvx_fp_status)) +ITERATOR_INSN_IEEE_FP_DOUBLE_32(32, vmpy_sf_hf, + "Vdd32.sf=3Dvmpy(Vu32.hf,Vv32.hf)", "Vector IEEE mul: hf widen to sf", + VddV.v[0].sf[i] =3D fp_mult_sf_hf(VuV.hf[2*i], VvV.hf[2*i], &env->hvx_= fp_status); + VddV.v[1].sf[i] =3D fp_mult_sf_hf(VuV.hf[2*i+1], VvV.hf[2*i+1], &env->= hvx_fp_status)) +ITERATOR_INSN_IEEE_FP_16(16, vmpy_hf_hf, "Vd32.hf=3Dvmpy(Vu32.hf,Vv32.= hf)", + "Vector IEEE mul: hf", + VdV.hf[i] =3D float16_mul(VuV.hf[i], VvV.hf[i], &env->hvx_fp_status)) +ITERATOR_INSN_IEEE_FP_32(32, vdmpy_sf_hf, "Vd32.sf=3Dvdmpy(Vu32.hf,Vv3= 2.hf)", + "Vector IEEE mul reduction: hf widen to sf", + VdV.sf[i] =3D fp_vdmpy(VuV.hf[2*i+1], VuV.hf[2*i], VvV.hf[2*i+1], + VvV.hf[2*i], &env->hvx_fp_status)) + +/* IEEE FP multiply-accumulate instructions */ +ITERATOR_INSN_IEEE_FP_DOUBLE_32(32, vmpy_sf_hf_acc, + "Vxx32.sf+=3Dvmpy(Vu32.hf,Vv32.hf)", "Vector IEEE fma: hf widen to sf", + VxxV.v[0].sf[i] =3D float32_muladd(f16_to_f32(VuV.hf[2*i]), + f16_to_f32(VvV.hf[2*i]), + VxxV.v[0].sf[i], 0, &env->hvx_fp_stat= us); + VxxV.v[1].sf[i] =3D float32_muladd(f16_to_f32(VuV.hf[2*i+1]), + f16_to_f32(VvV.hf[2*i+1]), + VxxV.v[1].sf[i], 0, &env->hvx_fp_stat= us)) +ITERATOR_INSN_IEEE_FP_ACC_16(16, vmpy_hf_hf_acc, + "Vx32.hf+=3Dvmpy(Vu32.hf,Vv32.hf)", "Vector IEEE fma: hf", + VxV.hf[i] =3D float16_muladd(VuV.hf[i], VvV.hf[i], VxV.hf[i], 0, &env-= >hvx_fp_status)) +ITERATOR_INSN_IEEE_FP_ACC_32(32, vdmpy_sf_hf_acc, + "Vx32.sf+=3Dvdmpy(Vu32.hf,Vv32.hf)", "Vector IEEE fma reduce: hf widen= to sf", + VxV.sf[i] =3D float32_add(fp_vdmpy(VuV.hf[2*i+1], VuV.hf[2*i], + VvV.hf[2*i+1], VvV.hf[2*i], + &env->hvx_fp_status), + VxV.sf[i], &env->hvx_fp_status)) + +/* IEEE FP add/sub instructions */ +ITERATOR_INSN_IEEE_FP_32(32, vadd_sf_sf, "Vd32.sf=3Dvadd(Vu32.sf,Vv32.sf)", + "Vector IEEE add: sf", + VdV.sf[i] =3D float32_add(VuV.sf[i], VvV.sf[i], &env->hvx_fp_status)) +ITERATOR_INSN_IEEE_FP_32(32, vsub_sf_sf, "Vd32.sf=3Dvsub(Vu32.sf,Vv32.sf)", + "Vector IEEE sub: sf", + VdV.sf[i] =3D float32_sub(VuV.sf[i], VvV.sf[i], &env->hvx_fp_status)) +ITERATOR_INSN_IEEE_FP_16(16, vadd_hf_hf, "Vd32.hf=3Dvadd(Vu32.hf,Vv32.hf)", + "Vector IEEE add: hf", + VdV.hf[i] =3D float16_add(VuV.hf[i], VvV.hf[i], &env->hvx_fp_status)) +ITERATOR_INSN_IEEE_FP_16(16, vsub_hf_hf, "Vd32.hf=3Dvsub(Vu32.hf,Vv32.hf)", + "Vector IEEE sub: hf", + VdV.hf[i] =3D float16_sub(VuV.hf[i], VvV.hf[i], &env->hvx_fp_status)) +ITERATOR_INSN_IEEE_FP_DOUBLE_32(32, vadd_sf_hf, + "Vdd32.sf=3Dvadd(Vu32.hf,Vv32.hf)", "Vector IEEE add: hf widen to sf", + VddV.v[0].sf[i] =3D float32_add(f16_to_f32(VuV.hf[2*i]), + f16_to_f32(VvV.hf[2*i]), &env->hvx_fp_st= atus); + VddV.v[1].sf[i] =3D float32_add(f16_to_f32(VuV.hf[2*i+1]), + f16_to_f32(VvV.hf[2*i+1]), &env->hvx_fp_= status)) +ITERATOR_INSN_IEEE_FP_DOUBLE_32(32, vsub_sf_hf, + "Vdd32.sf=3Dvsub(Vu32.hf,Vv32.hf)", "Vector IEEE sub: hf widen to sf", + VddV.v[0].sf[i] =3D float32_sub(f16_to_f32(VuV.hf[2*i]), + f16_to_f32(VvV.hf[2*i]), &env->hvx_fp_st= atus); + VddV.v[1].sf[i] =3D float32_sub(f16_to_f32(VuV.hf[2*i+1]), + f16_to_f32(VvV.hf[2*i+1]), &env->hvx_fp_= status)) =20 /*************************************************************************= ***** DEBUG Vector/Register Printing diff --git a/target/hexagon/meson.build b/target/hexagon/meson.build index d169cf71b2..9195014821 100644 --- a/target/hexagon/meson.build +++ b/target/hexagon/meson.build @@ -250,6 +250,7 @@ hexagon_ss.add(files( 'fma_emu.c', 'mmvec/decode_ext_mmvec.c', 'mmvec/system_ext_mmvec.c', + 'mmvec/hvx_ieee_fp.c', )) =20 # --=20 2.37.2 From nobody Sat May 30 20:11:22 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1776339674; cv=none; d=zohomail.com; s=zohoarc; b=YBaq8cqRsvqkPK3zczpmI0YPegyIWZ9cRCfjWp+Xhyzyyek9blu9ycKE7EYn6WoM5svT7QhBVfMUGa+M1iW0w16alHXS7VmFgzms/ayw+j/4opSe71pFi/KaTQZQ+BLvShTK5FFVpV8t+u0T6j/VZT3OHX7y7CY6/L/8nZ39yj8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776339674; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=mKOxYRftlw4atMQY4G9h8sTwL51kYBv6lJOgxUyKXww=; b=C6NIL0RpMCZS7mRnuhKg5WyRrFLJyKXHvZ1IXHIe+DVSjOLvz5fYnrbv+Iu7U135tdInshh/ILQxk++hvWSoXDZKBPRSxVdAlB+1IjQNqtlWrA+eqT15vSeKFT+cJpx8YFaZNFHTwaK9sQp2ln5rTPPnRzUCb8eitPyYzjVCPaY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776339674228987.01207061709; Thu, 16 Apr 2026 04:41:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wDL4M-00059B-12; Thu, 16 Apr 2026 07:39:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wDL46-00056o-3l for qemu-devel@nongnu.org; Thu, 16 Apr 2026 07:39:23 -0400 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wDL43-0003Aj-SB for qemu-devel@nongnu.org; Thu, 16 Apr 2026 07:39:21 -0400 Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 63GAY4eq1245269 for ; Thu, 16 Apr 2026 11:39:17 GMT Received: from mail-dy1-f197.google.com (mail-dy1-f197.google.com [74.125.82.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4djx4k863w-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 16 Apr 2026 11:39:17 +0000 (GMT) Received: by mail-dy1-f197.google.com with SMTP id 5a478bee46e88-2bdd327d970so391548eec.1 for ; Thu, 16 Apr 2026 04:39:17 -0700 (PDT) Received: from hu-mathbern-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2de8c10a65asm6845391eec.6.2026.04.16.04.39.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Apr 2026 04:39:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=mKOxYRftlw4 atMQY4G9h8sTwL51kYBv6lJOgxUyKXww=; b=X5S1EigY7lm+vg1NHzykTOeMYQy nInVwDb9Rtfsn09uMCwKEZCpeO/l1Vs+AS1AGVV6Acse362ooJrcrB+KnRTXQTu3 zvTi4zFsuS9tF7dzmkgrU4nYBsCfiFprH5553BSd9QDZ6iBzKxQtWb0L1rNM5XDy pljCMXIjqOU3h142j+J7vew8jDDkrnRgdNAudoONnGRJVJ95aNKQmol2FHct08Rk Hs9gNLKC4d2MFUjmGWqkIU0A5C3V57nymQZymzqkJjY3Zv8f4yZ+z5ClfZ0idSiI CuQUEGPuO0b1SBG6ojJYrRBHK/cRDLLmmIgb3a/ibOqgjz+ivlxm2xTYBjQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1776339556; x=1776944356; darn=nongnu.org; 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=mKOxYRftlw4atMQY4G9h8sTwL51kYBv6lJOgxUyKXww=; b=TubuXfu/hu7T2vlxupj1az4sgO33LqJ72MBDpN6PJ5KP9L1ahUemja5iywXwiCOzut hXlcLrweWonn0HUxYNG6pBWse00SzFKRc53jHS4mdjRy2PuR3U1IX3OBKWECt9qZaKRC RICgkG3DdftWOArARBysiocMXbfCsNos6xJGXaYsI06W7BgtVDbvBll9yJjOlqdO6lQM opYGFodz0VIeZAtq8mVoWNHCoO0X0aVKHQ47/Gx+uUSifixIz02qU4yuAeeu+QXhSXeo mbjhGKbI03qOuyeZ96jgv1xLuDZB/79O3fIC88d0WxJfGb603TNKeyAk+wYv4JGZOBup QzWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776339556; x=1776944356; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=mKOxYRftlw4atMQY4G9h8sTwL51kYBv6lJOgxUyKXww=; b=ebZVhoIMEW8kGh1BIk2gzkjKG5Tby3tGco3TGdfV/z4CCntdyXhznMrGJcQm1qUNTg TLJkcmMMH56AVQHl56XTbKlwEnlFLjtuExxvgaR13zme4tz13NLeg2dLVyFMhGEH7SHt msKCKQbVLZV38PmFH4W+uhJuBl8ZBvWwxSMQg8fXE1iTcfEx5wW2UMiRwIjekHQ0hzvF Vj9xG3nL5v1G+YfZ+vhJtWScI2GI402TGMWSNDXQUmtSFpG34vMoaFKn+2AwLp5nx8lg WzwDJzhbI3fBlTM/KFQPsDFS5b4lowArIxDLxKpPTFRrLV//mMi9MVdYmQTkrnFu7XWL 6BcA== X-Gm-Message-State: AOJu0Yw3pm+dq/NL5KKIkhyOuYnhZ2FDfaS7ZXgxc1dDGiP2wuDEXcRV UA8DNNzMN/YXkIWyoFArZ19Cie6zYzN0GHP/Emyo8FG3RwP3VlnNsd4lUJNuLx3r6eiYDQBFgmM Y0ejv3YTRiULo2E2Rd9hsBRzAOfK5OMn1HJKaV6R/BlLZJgRR0aZvjI1jRcm+kujufNCL X-Gm-Gg: AeBDiesxCcC4ysmSQPg+MDf2/ua3eloW1gSDD72eZD7btExQ60FJZs+we0BBV2XRvY5 kPxQ1vFatu5rTjaUWZaJ2Gh6DkebyAuf46v4+KBP0kUhPqxx7bpRhRtVBtSDpW7wP3FBderJkNj jtnOcibDs+KtTtJphmWxQgwechdAPc+Lg+Taf2SaCdaavxhDv1+rSC6SgMkTAFia84wd3NNOu/i bwbRA5jc/z9AWDiLpgY76SE+63kJuy6WCHLS/Z2XV/DPLqL2xwcPZVHQ9jaxzj4eg1DbcYUR0fW u49rK3tLwQ9Y7Nghz1wCJ0QrqqjEJVxNdLiGFAAmguFpx+J0pKABsGqGEuyTPisBjgO40qqwLHE aJ/YQMYVPkVQCu3YyWhxiNb751ZaNvCfKl9oxznEuXA/5kpBIz9GAJ30ur2mNcB/KX7AP1ttKTK 7yXn+vkogerqgRgrxOUsc= X-Received: by 2002:a05:7300:2d15:b0:2d8:b2e1:20da with SMTP id 5a478bee46e88-2e21ada9946mr529936eec.2.1776339555277; Thu, 16 Apr 2026 04:39:15 -0700 (PDT) X-Received: by 2002:a05:7300:2d15:b0:2d8:b2e1:20da with SMTP id 5a478bee46e88-2e21ada9946mr529916eec.2.1776339554673; Thu, 16 Apr 2026 04:39:14 -0700 (PDT) From: Matheus Tavares Bernardino To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, ale@rev.ng, anjo@rev.ng, brian.cain@oss.qualcomm.com, ltaylorsimpson@gmail.com, marco.liebel@oss.qualcomm.com, philmd@linaro.org, quic_mburton@quicinc.com, sid.manning@oss.qualcomm.com Subject: [PATCH v5 07/16] target/hexagon: add v68 HVX IEEE float min/max insns Date: Thu, 16 Apr 2026 04:38:56 -0700 Message-Id: <8e274a7a10a5aae23eb1250db0b4f4250c81f3ef.1776339451.git.matheus.bernardino@oss.qualcomm.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: 8_cMysrQjUqyawERF-nTdw4oLMveHO1k X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDE2MDExMCBTYWx0ZWRfX8dmjNcC0u+Js 3PQUBpDqMxAbY73XHQj27DXXhcnPNZHidLUnGymEHFgOfmMpVpZVa6oFfgkksk/8MwMWR8sMksh Caj8fBM0AD4Q/auLCdi+in8Sz8GybheCUXgSQMgVlYf0qL/GWm9EBhBcs5jPOtRbQVtu9u2CQ8M neSCaxsp43UV/1ZDN4s/tyTLNkV0QnZWgGBP5f8MDzixBu3BmYEuvrW6zZ++nYozmi+Zi33KmdT AwjzoCOXmVjVJXFY73xXJXq/pFp2ziyyCTmL7MZF7h1YW3n3W3WgSn80rxxxifVWzdZ3sL+f4Lm O2gOtn1DGWzIxWgFfX7Atu9BoH1v5pVHu650f56y+u2M4DYr05CuNYIWyJFFgQ55J4CK+h1ZjNs tmiesYiE/yCZESTcyfjGdjGajbj7vDPWP0Ir2T2zSPGzYnllP4S5DT8QgWSoIdOMjfD7t3lTecP CAhl1puzW+X0Ao2oCWw== X-Authority-Analysis: v=2.4 cv=H47rBeYi c=1 sm=1 tr=0 ts=69e0ca65 cx=c_pps a=Uww141gWH0fZj/3QKPojxA==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=YMgV9FUhrdKAYTUUvYB2:22 a=pGLkceISAAAA:8 a=EUspDBNiAAAA:8 a=KsDfajj0LuzFEeFCdIYA:9 a=PxkB5W3o20Ba91AHUih5:22 X-Proofpoint-ORIG-GUID: 8_cMysrQjUqyawERF-nTdw4oLMveHO1k X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-16_03,2026-04-13_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 suspectscore=0 lowpriorityscore=0 clxscore=1015 priorityscore=1501 phishscore=0 bulkscore=0 adultscore=0 spamscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604070000 definitions=main-2604160110 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=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.168.131; envelope-from=matheus.bernardino@oss.qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1776339675616154101 Content-Type: text/plain; charset="utf-8" Add HVX IEEE floating-point min/max instructions: - vfmin_hf, vfmin_sf: IEEE floating-point minimum - vfmax_hf, vfmax_sf: IEEE floating-point maximum - vmax_hf, vmax_sf: qfloat IEEE maximum - vmin_hf, vmin_sf: qfloat IEEE minimum The Hexagon qfloat variants are similar to the IEEE-754 ones, but they handle NaN slightly differently. See comment on hvx_ieee_fp.h Reviewed-by: Taylor Simpson Signed-off-by: Matheus Tavares Bernardino --- target/hexagon/mmvec/hvx_ieee_fp.h | 6 +++ target/hexagon/attribs_def.h.inc | 2 + target/hexagon/mmvec/hvx_ieee_fp.c | 50 ++++++++++++++++++++ target/hexagon/hex_common.py | 1 + target/hexagon/imported/mmvec/encode_ext.def | 10 ++++ target/hexagon/imported/mmvec/ext.idef | 36 +++++++++++++- 6 files changed, 104 insertions(+), 1 deletion(-) diff --git a/target/hexagon/mmvec/hvx_ieee_fp.h b/target/hexagon/mmvec/hvx_= ieee_fp.h index 75008deb3b..dff2fab14c 100644 --- a/target/hexagon/mmvec/hvx_ieee_fp.h +++ b/target/hexagon/mmvec/hvx_ieee_fp.h @@ -15,4 +15,10 @@ float32 fp_mult_sf_hf(float16 a1, float16 a2, float_stat= us *fp_status); float32 fp_vdmpy(float16 a1, float16 a2, float16 a3, float16 a4, float_status *fp_status); =20 +/* Qfloat min/max treat +NaN as greater than +INF and -NaN as smaller than= -INF */ +float32 qf_max_sf(float32 a1, float32 a2, float_status *fp_status); +float32 qf_min_sf(float32 a1, float32 a2, float_status *fp_status); +float16 qf_max_hf(float16 a1, float16 a2, float_status *fp_status); +float16 qf_min_hf(float16 a1, float16 a2, float_status *fp_status); + #endif diff --git a/target/hexagon/attribs_def.h.inc b/target/hexagon/attribs_def.= h.inc index d3c4bf6301..2d0fc7e9c0 100644 --- a/target/hexagon/attribs_def.h.inc +++ b/target/hexagon/attribs_def.h.inc @@ -81,6 +81,7 @@ DEF_ATTRIB(CVI_SCATTER, "CVI Scatter operation", "", "") DEF_ATTRIB(CVI_SCATTER_RELEASE, "CVI Store Release for scatter", "", "") DEF_ATTRIB(CVI_TMP_DST, "CVI instruction that doesn't write a register", "= ", "") DEF_ATTRIB(CVI_SLOT23, "Can execute in slot 2 or slot 3 (HVX)", "", "") +DEF_ATTRIB(CVI_VA_2SRC, "Execs on multimedia vector engine; requires two s= rcs", "", "") =20 DEF_ATTRIB(VTCM_ALLBANK_ACCESS, "Allocates in all VTCM schedulers.", "", "= ") =20 @@ -179,6 +180,7 @@ DEF_ATTRIB(HVX_IEEE_FP_ACC, "HVX IEEE FP accumulate ins= truction", "", "") DEF_ATTRIB(HVX_IEEE_FP_OUT_16, "HVX IEEE FP 16-bit output", "", "") DEF_ATTRIB(HVX_IEEE_FP_OUT_32, "HVX IEEE FP 32-bit output", "", "") DEF_ATTRIB(CVI_VX_NO_TMP_LD, "HVX multiply without tmp load", "", "") +DEF_ATTRIB(HVX_FLT, "This a floating point HVX instruction.", "", "") =20 /* Keep this as the last attribute: */ DEF_ATTRIB(ZZ_LASTATTRIB, "Last attribute in the file", "", "") diff --git a/target/hexagon/mmvec/hvx_ieee_fp.c b/target/hexagon/mmvec/hvx_= ieee_fp.c index 3367226998..2ae79a485a 100644 --- a/target/hexagon/mmvec/hvx_ieee_fp.c +++ b/target/hexagon/mmvec/hvx_ieee_fp.c @@ -19,3 +19,53 @@ float32 fp_vdmpy(float16 a1, float16 a2, float16 a3, flo= at16 a4, return float32_add(fp_mult_sf_hf(a1, a3, fp_status), fp_mult_sf_hf(a2, a4, fp_status), fp_status); } + +#define float32_is_pos_nan(X) (float32_is_any_nan(X) && !float32_is_neg(X)) +#define float32_is_neg_nan(X) (float32_is_any_nan(X) && float32_is_neg(X)) +#define float16_is_pos_nan(X) (float16_is_any_nan(X) && !float16_is_neg(X)) +#define float16_is_neg_nan(X) (float16_is_any_nan(X) && float16_is_neg(X)) + +/* Qfloat min/max treat +NaN as greater than +INF and -NaN as smaller than= -INF */ +float32 qf_max_sf(float32 a1, float32 a2, float_status *fp_status) +{ + if (float32_is_pos_nan(a1) || float32_is_neg_nan(a2)) { + return a1; + } + if (float32_is_pos_nan(a2) || float32_is_neg_nan(a1)) { + return a2; + } + return float32_max(a1, a2, fp_status); +} + +float32 qf_min_sf(float32 a1, float32 a2, float_status *fp_status) +{ + if (float32_is_pos_nan(a1) || float32_is_neg_nan(a2)) { + return a2; + } + if (float32_is_pos_nan(a2) || float32_is_neg_nan(a1)) { + return a1; + } + return float32_min(a1, a2, fp_status); +} + +float16 qf_max_hf(float16 a1, float16 a2, float_status *fp_status) +{ + if (float16_is_pos_nan(a1) || float16_is_neg_nan(a2)) { + return a1; + } + if (float16_is_pos_nan(a2) || float16_is_neg_nan(a1)) { + return a2; + } + return float16_max(a1, a2, fp_status); +} + +float16 qf_min_hf(float16 a1, float16 a2, float_status *fp_status) +{ + if (float16_is_pos_nan(a1) || float16_is_neg_nan(a2)) { + return a2; + } + if (float16_is_pos_nan(a2) || float16_is_neg_nan(a1)) { + return a1; + } + return float16_min(a1, a2, fp_status); +} diff --git a/target/hexagon/hex_common.py b/target/hexagon/hex_common.py index 9819201b50..168112c66f 100755 --- a/target/hexagon/hex_common.py +++ b/target/hexagon/hex_common.py @@ -216,6 +216,7 @@ def need_env(tag): "A_CVI_GATHER" in attribdict[tag] or "A_CVI_SCATTER" in attribdict[tag] or "A_HVX_IEEE_FP" in attribdict[tag] or + "A_HVX_FLT" in attribdict[tag] or "A_IMPLICIT_WRITES_USR" in attribdict[tag]) =20 =20 diff --git a/target/hexagon/imported/mmvec/encode_ext.def b/target/hexagon/= imported/mmvec/encode_ext.def index 4ce87d09fd..d7f50db778 100644 --- a/target/hexagon/imported/mmvec/encode_ext.def +++ b/target/hexagon/imported/mmvec/encode_ext.def @@ -823,4 +823,14 @@ DEF_ENC(V6_vsub_sf_hf,"00011111100vvvvvPP1uuuuu101dddd= d") DEF_ENC(V6_vadd_hf_hf,"00011111101vvvvvPP1uuuuu111ddddd") DEF_ENC(V6_vsub_hf_hf,"00011111011vvvvvPP1uuuuu000ddddd") =20 +/* IEEE FP min/max instructions */ +DEF_ENC(V6_vfmin_hf,"00011100011vvvvvPP1uuuuu000ddddd") +DEF_ENC(V6_vfmin_sf,"00011100011vvvvvPP1uuuuu001ddddd") +DEF_ENC(V6_vfmax_hf,"00011100011vvvvvPP1uuuuu010ddddd") +DEF_ENC(V6_vfmax_sf,"00011100011vvvvvPP1uuuuu011ddddd") +DEF_ENC(V6_vmax_sf,"00011111110vvvvvPP1uuuuu001ddddd") +DEF_ENC(V6_vmin_sf,"00011111110vvvvvPP1uuuuu010ddddd") +DEF_ENC(V6_vmax_hf,"00011111110vvvvvPP1uuuuu011ddddd") +DEF_ENC(V6_vmin_hf,"00011111110vvvvvPP1uuuuu100ddddd") + #endif /* NO MMVEC */ diff --git a/target/hexagon/imported/mmvec/ext.idef b/target/hexagon/import= ed/mmvec/ext.idef index 14df8e4790..0e9cace203 100644 --- a/target/hexagon/imported/mmvec/ext.idef +++ b/target/hexagon/imported/mmvec/ext.idef @@ -43,7 +43,9 @@ EXTINSN(V6_##TAG, SYNTAX, ATTRIBS(A_EXTENSION,A_CVI,A_CVI_VA), \ DESCR, DO_FOR_EACH_CODE(WIDTH, CODE)) =20 - +#define ITERATOR_INSN_ANY_SLOT_2SRC(WIDTH,TAG,SYNTAX,DESCR,CODE) \ +EXTINSN(V6_##TAG, SYNTAX, ATTRIBS(A_EXTENSION,A_CVI,A_CVI_VA,A_CVI_VA_2SRC= ,A_HVX_FLT), \ +DESCR, DO_FOR_EACH_CODE(WIDTH, CODE)) =20 #define ITERATOR_INSN2_ANY_SLOT(WIDTH,TAG,SYNTAX,SYNTAX2,DESCR,CODE) \ ITERATOR_INSN_ANY_SLOT(WIDTH,TAG,SYNTAX2,DESCR,CODE) @@ -3000,6 +3002,38 @@ ITERATOR_INSN_IEEE_FP_DOUBLE_32(32, vsub_sf_hf, VddV.v[1].sf[i] =3D float32_sub(f16_to_f32(VuV.hf[2*i+1]), f16_to_f32(VvV.hf[2*i+1]), &env->hvx_fp_= status)) =20 +#define ITERATOR_INSN_IEEE_FP_16_32_LATE(WIDTH,TAG,SYNTAX,DESCR,CODE) \ +EXTINSN(V6_##TAG, SYNTAX, \ + ATTRIBS(A_EXTENSION,A_HVX_IEEE_FP,A_CVI,A_CVI_VX,A_HVX_IEEE_FP_OUT= _16,A_HVX_IEEE_FP_OUT_32), \ + DESCR, DO_FOR_EACH_CODE(WIDTH, CODE)) + +/* IEEE FP min/max instructions */ +ITERATOR_INSN_IEEE_FP_16_32_LATE(16, vfmin_hf, "Vd32.hf=3Dvfmin(Vu32.hf,Vv= 32.hf)", \ + "Vector IEEE min: hf", VdV.hf[i] =3D float16_min(VuV.hf[i], VvV.hf[i]= , \ + &env->hvx_fp_status)) +ITERATOR_INSN_IEEE_FP_16_32_LATE(32, vfmin_sf, "Vd32.sf=3Dvfmin(Vu32.sf,Vv= 32.sf)", \ + "Vector IEEE min: sf", VdV.sf[i] =3D float32_min(VuV.sf[i], VvV.sf[i]= , \ + &env->hvx_fp_status)) +ITERATOR_INSN_IEEE_FP_16_32_LATE(16, vfmax_hf, "Vd32.hf=3Dvfmax(Vu32.hf,V= v32.hf)", \ + "Vector IEEE max: hf", VdV.hf[i] =3D float16_max(VuV.hf[i], VvV.hf[i],= \ + &env->hvx_fp_status)) +ITERATOR_INSN_IEEE_FP_16_32_LATE(32, vfmax_sf, "Vd32.sf=3Dvfmax(Vu32.sf,V= v32.sf)", \ + "Vector IEEE max: sf", VdV.sf[i] =3D float32_max(VuV.sf[i], VvV.sf[i],= \ + &env->hvx_fp_status)) + +ITERATOR_INSN_ANY_SLOT_2SRC(32,vmax_sf,"Vd32.sf=3Dvmax(Vu32.sf,Vv32.sf)", \ + "Vector max of sf input", VdV.sf[i] =3D qf_max_sf(VuV.sf[i], VvV.sf[i]= , \ + &env->hvx_fp_status)) +ITERATOR_INSN_ANY_SLOT_2SRC(32,vmin_sf,"Vd32.sf=3Dvmin(Vu32.sf,Vv32.sf)", \ + "Vector min of sf input", VdV.sf[i] =3D qf_min_sf(VuV.sf[i], VvV.sf[i]= , \ + &env->hvx_fp_status)) +ITERATOR_INSN_ANY_SLOT_2SRC(16,vmax_hf,"Vd32.hf=3Dvmax(Vu32.hf,Vv32.hf)", \ + "Vector max of hf input", VdV.hf[i] =3D qf_max_hf(VuV.hf[i], VvV.hf[i]= , \ + &env->hvx_fp_status)) +ITERATOR_INSN_ANY_SLOT_2SRC(16,vmin_hf,"Vd32.hf=3Dvmin(Vu32.hf,Vv32.hf)", \ + "Vector min of hf input", VdV.hf[i] =3D qf_min_hf(VuV.hf[i], VvV.hf[i]= , \ + &env->hvx_fp_status)) + /*************************************************************************= ***** DEBUG Vector/Register Printing *************************************************************************= *****/ --=20 2.37.2 From nobody Sat May 30 20:11:22 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1776339678; cv=none; d=zohomail.com; s=zohoarc; b=Nom4mKuVi6OvX6Fn4c9OIqlAuL8JhnsN9+BdPmdJ437Z3zmvVtykX99pQ5mlTXYJAGYxz/H/Y8xi1sySXyNIFCuXyP2t5WzUnfuRmIuDGnyFVb6/DJwpPJ0LUVepUsClfdPFz/P5qXXQhSpDn6b/7xXQXhqhsDLKEGsOv80gZsE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776339678; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ZzRENYlKEMPWXVJIPHrKdHk5SD4R2N5ZAAlk3V6uJ1Y=; b=eRUU3KAlzQc+V8sWfCuVspTwa+gcXM3NVYC3a+2KHFTsF7fncVQwmNTqes2In37I1Kb9EcDDSntnKvspoYi7q2cXhKLqVzw4YdMkf1uvnWSqRIkq71Oak6c/NVH8ISxNrK8kWi3Ozk3XsJlNoG2kZiCU55p7uGIMU9gSqpTph6w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776339678057945.7679975757478; Thu, 16 Apr 2026 04:41:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wDL4M-00059F-7h; Thu, 16 Apr 2026 07:39:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wDL47-00056r-79 for qemu-devel@nongnu.org; Thu, 16 Apr 2026 07:39:23 -0400 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wDL44-0003Ar-Bi for qemu-devel@nongnu.org; Thu, 16 Apr 2026 07:39:22 -0400 Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 63G9YVtV1553264 for ; Thu, 16 Apr 2026 11:39:19 GMT Received: from mail-dy1-f197.google.com (mail-dy1-f197.google.com [74.125.82.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4djrsn9g8y-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 16 Apr 2026 11:39:18 +0000 (GMT) Received: by mail-dy1-f197.google.com with SMTP id 5a478bee46e88-2d3a617ad90so27056431eec.0 for ; Thu, 16 Apr 2026 04:39:18 -0700 (PDT) Received: from hu-mathbern-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2de8c10a65asm6845391eec.6.2026.04.16.04.39.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Apr 2026 04:39:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=ZzRENYlKEMP WXVJIPHrKdHk5SD4R2N5ZAAlk3V6uJ1Y=; b=hweQ38cQM8tZvDlt6bv0fdLebkj FkzAjS8mLnwF42V7BOOYP6LcaeqNh9MMNUebPrea/YpS8yrwd04rpV8VDHxg1t9R U3C96cOdRgvK0le16vD8RAE6PjM9tGJzDJVC8jJDWj5F4VXOrqg18dpoPc/P8Taw n+8QeLFMDwrwpocs7NlsqADuIjIhEcAg+hRXux7EWNWH/bMpKxuhtVZiF5cJ5NPH RjJgpdU9PoKue+BQzhzDPRgw6cpeWbDcBzO4qu97454lEJCoxD9MetiRtSkEz8NB RJzpriqSgrQZMGlKHNrNxJS976459l/VE7oFkpxl0u6bKo+4bN9hgkPHOxw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1776339558; x=1776944358; darn=nongnu.org; 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=ZzRENYlKEMPWXVJIPHrKdHk5SD4R2N5ZAAlk3V6uJ1Y=; b=ID/Cp4UuH47ToZeNOzcCYSFM8vlyMfpMXvXnzPxlZQa1WsjbDlXNSgrx4XDaSWUGUD YIosejw/rmQ+AaqZCHajMlSqQloCR7rB98O9wrGxHO9NZT3T8b+IuGsiKtKeFSZ7HHOB wicZanB9H3BNNJ9e/iP7XIdPHFeZtqfjS+UQnPUm2ciOPN5pUl8JJHNueUfYu9JhQKQq fhloHnWRjrW6j7LMt0AEu6H+KR6ULHJnM+SjcgZpoPNOvOKgw8neKYfg0/GqWbSg2Ej3 W4QeqxKMEECBSOq8f/M8Y0FWbvKO0baDlSUngKY319vvFdoSquP4a4dBm89V6gdlb+6m fK0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776339558; x=1776944358; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=ZzRENYlKEMPWXVJIPHrKdHk5SD4R2N5ZAAlk3V6uJ1Y=; b=Iy5BQO4550HMct5iptBt5hSb/y/WpZR4En8kbuD6yctwWI9dLnR9iWSzZi9uU6kv3p NyT3CKIcMxwhe6hi8G+QDoOYsps3XgPCnrAlkRaWyOE2whCIrfMciN5Wfa5kSFmI1LuK TxaU+DnYqSq8H6bR7RP2BPgtgiCaPmrmsQA9APd7koZ6opZbiYCarEnxMps0A4oR6IM/ ePZMvgtSNRHyUCjmF+YDg+dyOhjcfZlB1hPXlJr7c56k5C1w9S2gi93mRzO4sk+BNaoO WCb8x/TqGDhoOHaoBCearkoiuePxkKY43uKYv+s31d6Bzsj6CZ2J2PVygH/JP6Ir+EBB d0ZA== X-Gm-Message-State: AOJu0YzZzfsGprRaskU+SdJ49jf/uOvpQ0YxAOTu6lAMusYRbOxRGOXi 8ka5JkznhbMAmxjfmPlI1iaBmChs/WYmg/LXYFcfS5diaci7czoVSz0Rc844Ofp7dtSZhiMfOn4 Ffn5fAdx13dwIRvjDZYYmmKGUAEnRgWbFJPRzBxey3Z07zzPHyAuVzgb+lii1BVpSJY86 X-Gm-Gg: AeBDieufOpxymsx8bnkwJLX/7QvLAPX9RcEDOqj7e3t8I9SLs7ttPDaJiuC6bQP2qZY WtxtKk6HYDwDdAzr9IXcTi/Tiix0+gpMDxmFX2glNik9EMbOGjSL0EPouTmGL1qyQ2mL8GuzKXU WFyy2chrNchRUQ7V7NKSy9xg6NDWOo03fotQBaFLb1Y8YH7ChaXF4PSj2gM126wiZ1GdOPYavMU 1KA15ayjU9H7KV2gcES32ZC2+ITK7pBXmpJJfG+fSX/BU9/ThGw2gLqPnJJAM1yjQmR9LfalIak kKxNHSX/b7Hd/QtXPr1e9C/jmg38k4Jxme2MTZgixfot4ZH0a6dlIe1ojx7tCsad1r/nkCqyrr6 RcJp27NOOnQ7MOHTdumjocQU/6CMrKZ00CtOmG2lH6vIbeCtVpLXA55zlkWVmk2sCR07X+6nXFC 94Gh3ZFe7sXqJUWhrJ8Ak= X-Received: by 2002:a05:7301:434c:b0:2c1:6676:5ebd with SMTP id 5a478bee46e88-2d587e7a9e8mr13980539eec.10.1776339557803; Thu, 16 Apr 2026 04:39:17 -0700 (PDT) X-Received: by 2002:a05:7301:434c:b0:2c1:6676:5ebd with SMTP id 5a478bee46e88-2d587e7a9e8mr13980525eec.10.1776339557237; Thu, 16 Apr 2026 04:39:17 -0700 (PDT) From: Matheus Tavares Bernardino To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, ale@rev.ng, anjo@rev.ng, brian.cain@oss.qualcomm.com, ltaylorsimpson@gmail.com, marco.liebel@oss.qualcomm.com, philmd@linaro.org, quic_mburton@quicinc.com, sid.manning@oss.qualcomm.com Subject: [PATCH v5 08/16] target/hexagon: add v68 HVX IEEE float misc insns Date: Thu, 16 Apr 2026 04:38:57 -0700 Message-Id: <0bd3279ca0bbf7c01548e3b4e7a9c8fdbdbe4ee1.1776339451.git.matheus.bernardino@oss.qualcomm.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: hSS_mjQBZDNIgRfIjzICZuqPXX3Ca9g3 X-Proofpoint-GUID: hSS_mjQBZDNIgRfIjzICZuqPXX3Ca9g3 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDE2MDExMCBTYWx0ZWRfX20zseLpbVoDJ dnonAcY2ta8+kDeGPwuG1RDkxo5yNXyNHM4y9kBgUBoww8yH2p3nFkIEza5HZIF77g2t7N4IUpe 5Js4wOHbUurBkPR5daqbaWLHWqMDz9Cc4jEVYguxl1i2AycCdJJSXxLVY7oDdXSAjRxLu+7vQoi EjrHb8Y4d1MBe7j1tbmPky6hiUk9lq0ahC939vuir5ntgeoWTSiJNDoomypIxv+oRO2lZ1PCKMJ UY5T/DPGc/yQHY1HrVL4RJGpknIqskulEKa0tB/HkClf2AYWHQvWFXuFlh9VSpgOKaiL+01R9JJ Rqs9cXErnbV9NrtB1TWUsI2+ATjHdNOR5kXWv8JMpu7aL1ccGwRHPXbItr7rpi0PjKXAq2LGrKL NRC2ao9x6bBlonn77NVT7wz4oIsBjYhYxk/k92NTn7xX0d1tTdMhjbIwVI1A9o2zK8pNmKdyM4H a0cKpzxj9FqZiHNqi4Q== X-Authority-Analysis: v=2.4 cv=EojiaycA c=1 sm=1 tr=0 ts=69e0ca66 cx=c_pps a=Uww141gWH0fZj/3QKPojxA==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yOCtJkima9RkubShWh1s:22 a=pGLkceISAAAA:8 a=EUspDBNiAAAA:8 a=287aDwLwmCB6td_Y28QA:9 a=PxkB5W3o20Ba91AHUih5:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-16_03,2026-04-13_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 bulkscore=0 adultscore=0 spamscore=0 phishscore=0 impostorscore=0 suspectscore=0 lowpriorityscore=0 malwarescore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604070000 definitions=main-2604160110 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=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.168.131; envelope-from=matheus.bernardino@oss.qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1776339680116158500 Content-Type: text/plain; charset="utf-8" Add HVX IEEE floating-point miscellaneous instructions: - vassign_fp (vfmv): vector move - vfneg_hf, vfneg_sf: vector floating-point negate - vabs_hf, vabs_sf: vector absolute value Reviewed-by: Taylor Simpson Signed-off-by: Matheus Tavares Bernardino --- target/hexagon/imported/mmvec/encode_ext.def | 7 +++++++ target/hexagon/imported/mmvec/ext.idef | 12 ++++++++++++ 2 files changed, 19 insertions(+) diff --git a/target/hexagon/imported/mmvec/encode_ext.def b/target/hexagon/= imported/mmvec/encode_ext.def index d7f50db778..72daf8724c 100644 --- a/target/hexagon/imported/mmvec/encode_ext.def +++ b/target/hexagon/imported/mmvec/encode_ext.def @@ -833,4 +833,11 @@ DEF_ENC(V6_vmin_sf,"00011111110vvvvvPP1uuuuu010ddddd") DEF_ENC(V6_vmax_hf,"00011111110vvvvvPP1uuuuu011ddddd") DEF_ENC(V6_vmin_hf,"00011111110vvvvvPP1uuuuu100ddddd") =20 +/* IEEE FP move, negate, abs instructions */ +DEF_ENC(V6_vassign_fp,"00011110--0-0110PP1uuuuu001ddddd") +DEF_ENC(V6_vfneg_hf,"00011110--0-0110PP1uuuuu010ddddd") +DEF_ENC(V6_vfneg_sf,"00011110--0-0110PP1uuuuu011ddddd") +DEF_ENC(V6_vabs_hf,"00011110--0-0110PP1uuuuu100ddddd") +DEF_ENC(V6_vabs_sf,"00011110--0-0110PP1uuuuu101ddddd") + #endif /* NO MMVEC */ diff --git a/target/hexagon/imported/mmvec/ext.idef b/target/hexagon/import= ed/mmvec/ext.idef index 0e9cace203..1b16ed0628 100644 --- a/target/hexagon/imported/mmvec/ext.idef +++ b/target/hexagon/imported/mmvec/ext.idef @@ -3034,6 +3034,18 @@ ITERATOR_INSN_ANY_SLOT_2SRC(16,vmin_hf,"Vd32.hf=3Dvm= in(Vu32.hf,Vv32.hf)", \ "Vector min of hf input", VdV.hf[i] =3D qf_min_hf(VuV.hf[i], VvV.hf[i]= , \ &env->hvx_fp_status)) =20 +/* IEEE FP move, negate, abs instructions */ +ITERATOR_INSN_IEEE_FP_16_32_LATE(32, vassign_fp, "Vd32.w=3Dvfmv(Vu32.w)", \ + "Vector IEEE move", VdV.w[i] =3D VuV.w[i]) +ITERATOR_INSN_IEEE_FP_16_32_LATE(16, vfneg_hf, "Vd32.hf=3Dvfneg(Vu32.hf)",= \ + "Vector IEEE neg: hf", VdV.hf[i] =3D float16_chs(VuV.hf[i])) +ITERATOR_INSN_IEEE_FP_16_32_LATE(32, vfneg_sf, "Vd32.sf=3Dvfneg(Vu32.sf)",= \ + "Vector IEEE neg: sf", VdV.sf[i] =3D float32_chs(VuV.sf[i])) +ITERATOR_INSN_IEEE_FP_16_32_LATE(16, vabs_hf, "Vd32.hf=3Dvabs(Vu32.hf)", \ + "Vector IEEE abs: hf", VdV.hf[i] =3D float16_abs(VuV.hf[i])) +ITERATOR_INSN_IEEE_FP_16_32_LATE(32, vabs_sf, "Vd32.sf=3Dvabs(Vu32.sf)", \ + "Vector IEEE abs: sf", VdV.sf[i] =3D float32_abs(VuV.sf[i])) + /*************************************************************************= ***** DEBUG Vector/Register Printing *************************************************************************= *****/ --=20 2.37.2 From nobody Sat May 30 20:11:22 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1776339698; cv=none; d=zohomail.com; s=zohoarc; b=BfY+ftlDCRNZuke+PIhqCr081zxmAAK8a4k7HCKgIyUIRfja3Eb+JDat3wfBmOxM66QrL0zPPZ8u0hxAIkvL6TCKqLCe3gERPWixUuRoNNxwsf1igO5tgAf5UApR3nW+RadgQvTeTcFhLav5cuGl8uumkMcZutyvkLusZyKUus0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776339698; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ZzpX2dtmew8OnfEXBDiB07/5iswcyFDy+0j5bknVIDY=; b=J7DM+T2HxEPLtVOBFRIuFpCbYuuz+bBorTAhy8oodUHrs3hfznZ9gBBh4GuHngs4dPUocSCbUAsyX4m+KYcJ8/0SeLKg3k8v2nwzgEOMk8fBVOwGkJAL7hNSmnqf/PKqw1jPtEYUR4SKsP7j1baNjwESZbLS14cOIzS8Jz94qSs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776339698151703.228399892775; Thu, 16 Apr 2026 04:41:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wDL4N-0005Ci-AC; Thu, 16 Apr 2026 07:39:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wDL47-000572-Ry for qemu-devel@nongnu.org; Thu, 16 Apr 2026 07:39:26 -0400 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wDL45-0003BG-Eh for qemu-devel@nongnu.org; Thu, 16 Apr 2026 07:39:23 -0400 Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 63G8WVPb3089108 for ; Thu, 16 Apr 2026 11:39:20 GMT Received: from mail-dy1-f198.google.com (mail-dy1-f198.google.com [74.125.82.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4djp6a9xs1-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 16 Apr 2026 11:39:19 +0000 (GMT) Received: by mail-dy1-f198.google.com with SMTP id 5a478bee46e88-2bda35eab74so506848eec.0 for ; Thu, 16 Apr 2026 04:39:19 -0700 (PDT) Received: from hu-mathbern-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2de8c10a65asm6845391eec.6.2026.04.16.04.39.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Apr 2026 04:39:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=ZzpX2dtmew8 OnfEXBDiB07/5iswcyFDy+0j5bknVIDY=; b=R7EabLm5Pjn7zH+jVLIZBkPvpAG yHjmUGlPVHssQGRSP826skmQ3tZrHhqkqfM9C+HABBEpZHTQhenfhjmwAKgD7QGb pIE5XRFRCHZfBgMM6Qhujr2GilUqgv3SbHs9afU2M2tHBa2qtg0a7nMHllcSi6zT Dgn4K65HiogMLbrI+7ChP2puQf56e7fkdqg3e9Ho0dQL51Is3gugqnhlHBod02vC 10EVPykjdPV9opOJV7EZued256ncSZkQKSmrU2s3bUuLoJyC0tzrZ4enyBKx8jOL Q9BMvNBvUzdufepFnAarmQSxi2WlDDyW1qX3gHTzM/7hN2k8xRIDbDgRifA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1776339559; x=1776944359; darn=nongnu.org; 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=ZzpX2dtmew8OnfEXBDiB07/5iswcyFDy+0j5bknVIDY=; b=H30AOP/wyvjYx3ly6jjkAeFnbdAVYdOTw9BnYfGnUa1zcGRHOQN7I3A3f5/Ic4c5IK gIhOyGyjNBpnWD5sQwg4G8BEuPo2UMeRHkBT9qmudKmamfc+5hVJLDI+WFnwigiG3Z6t qIcGUkNlJhvxqVi19lY2g8HC6awtSZJ227I+Qd9nIieq8+yaURy9JV2hpvuf2krWPSbq uoXFuApNMh+jk7xMzPDJ6d6AAg2asQMU01Rxyxkl+6JJjnXKyexOb3SWuQErzb/9Rcaq UESY7p/5jcVGVM3w/Zav1chPR4gCHgjdywMd+Ms8gGVoEUrXl6EXq/bT9y8+/J0CTGNM QBgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776339559; x=1776944359; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=ZzpX2dtmew8OnfEXBDiB07/5iswcyFDy+0j5bknVIDY=; b=KbxQrX3Fx74Va2NAMAhB0NcPAIHNU/VZs7kjdMxXKrdJktquMA9UbnF6XfUgP1TMjI wojmwErHMjRk0EBY5g3qLaPHYsRReTvUr++GerTHFm8lBxBrGbKPCTiS8xozuPxaJYOJ 2woWYdke7YAlU977CJuthAjZMjJ9Pk/3p+TZcjwyhfF8SIZSvB/R1DXM5lDmi5Knn6vi fOGsJIkdqi8LEe9UOEar4pssPcTlsspyLUzlcLe5eIwmENrp5VbEtROXujKUc0uzhlY5 F4tGKgBUlHWKPEFoNZSQn2+Jz/p+4T4FQpRdw4usVz+0pK+rPkcMNH0YBWndDnzuVmNl QYfw== X-Gm-Message-State: AOJu0YwQVAIyf7Uyydg7fQDugxXD+QcMUpJwnHd3EUharVSlCXkbq/1S NjMFZIaIZBy4CQtyoaPDqhdTOzb2WY7RDjCrVqiDL07sQC9Nd6GF20YLQAitTpo8xxia2S3eP0m rpfCcJQiLjQ4SyeDpv3tThBLHo0INgRQsYpbjVbSpCsPkLxxDsJBB2o0TwN7psSaOdqNw X-Gm-Gg: AeBDievalvieGooyKhP2OUiw8J5ltuIQEpiSa6yGeaJnBy/wEASPiPTkHHeSi9+mdb+ ySoAH0bhtv2onqUXq+n749vZUuUMRSHtlbdEtYGQt1oAe8gMvSHpyiGids6ZXwcM+FQrHjxU+0v pJOVfiYie9jSCrTawiXrBd4mjwlAgnGHQUPSRJPVak0aPlD41Oml3bzVKLCJCxTygV83hMfaqJ2 IkjE6oekWbQV4O6cIft2MVKMpKPd1vX6nOIdcVMajCYkQ0q88KvSp+cUX8Iv92IhuBq/jQkbwVu tFxRoRLDkiMe6A5EgMQqbtYWfQnadt5wNoJAmUM+yLdEm7gw4xTNeYmFVXFM3aZUNRjzrktSSQP Ap1aQpdTrLt6+88pL/L7Q7M4ueuo7a64ygR+UWuyv2jrcbxGgsja/lQZqKsn+2yXfv3Zup9eO3z LY56fT33CkQ2kXDZ6Ofjk= X-Received: by 2002:a05:7300:ed03:b0:2d9:1c9d:fc22 with SMTP id 5a478bee46e88-2df7f947fbemr1621883eec.21.1776339558817; Thu, 16 Apr 2026 04:39:18 -0700 (PDT) X-Received: by 2002:a05:7300:ed03:b0:2d9:1c9d:fc22 with SMTP id 5a478bee46e88-2df7f947fbemr1621853eec.21.1776339558169; Thu, 16 Apr 2026 04:39:18 -0700 (PDT) From: Matheus Tavares Bernardino To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, ale@rev.ng, anjo@rev.ng, brian.cain@oss.qualcomm.com, ltaylorsimpson@gmail.com, marco.liebel@oss.qualcomm.com, philmd@linaro.org, quic_mburton@quicinc.com, sid.manning@oss.qualcomm.com Subject: [PATCH v5 09/16] target/hexagon: add v68 HVX IEEE float conversion insns Date: Thu, 16 Apr 2026 04:38:58 -0700 Message-Id: X-Mailer: git-send-email 2.37.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: ds2pkqBWbCMsgA898ef876-G8Dgckijo X-Authority-Analysis: v=2.4 cv=NuvhtcdJ c=1 sm=1 tr=0 ts=69e0ca67 cx=c_pps a=wEP8DlPgTf/vqF+yE6f9lg==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_K5XuSEh1TEqbUxoQ0s3:22 a=pGLkceISAAAA:8 a=EUspDBNiAAAA:8 a=2JvGeOnW2cDEA-NDw-QA:9 a=bBxd6f-gb0O0v-kibOvt:22 X-Proofpoint-GUID: ds2pkqBWbCMsgA898ef876-G8Dgckijo X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDE2MDExMCBTYWx0ZWRfX9tLysj9ZgPaw Lh0p3SVkzMA7KlLzheD29Z0PU0ENeqQrGxo5aaIBArxAjjKCqPCR0dEfBcxLNbjlxDPX/QL+LJu L1ULNW6bI192GqneKMTeGFnztglEt7xPUgKzlxPIIJdCV4BPtjN57a/VchsE8wW2T3bLqj8e/xP cEuuoXn7Qeh/qON7gU44HQPrhov/9XdhIFd3tYlsztSeaNfBtgnc9yYXrZNulwGwkxuPVI+etoY urB06wQXNrY0wPxPNeXlhdxRzjRYqvdsK7WbxwZ59lYMj2r1Mj5A/9vjlVBa808PNBSNl9zCojg rQymVIf2/OY0QGMzOK1Ytf+1U0dE1GeJiYr7wD+zJ5hG5s7k98U8Y4qFS2BiFtWqry63jqNOj7w GkcgzW2PdvOgGLbSVWXIbcQISTQjCUwrWxwJqFT1VAEkGFCygDkBWf7RtxvXgNgJeFnDvwUgUif hhNcorf/IoRj+HbtJBg== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-16_03,2026-04-13_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 bulkscore=0 suspectscore=0 spamscore=0 lowpriorityscore=0 priorityscore=1501 adultscore=0 impostorscore=0 phishscore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604070000 definitions=main-2604160110 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=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.168.131; envelope-from=matheus.bernardino@oss.qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1776339700329158500 Content-Type: text/plain; charset="utf-8" Add HVX IEEE floating-point conversion instructions: - vconv_hf_h, vconv_h_hf, vconv_sf_w, vconv_w_sf: vconv operations - vcvt_hf_sf, vcvt_sf_hf: float <-> half float conversions - vcvt_hf_b, vcvt_hf_h, vcvt_hf_ub, vcvt_hf_uh: int to half float - vcvt_b_hf, vcvt_h_hf, vcvt_ub_hf, vcvt_uh_hf: half float to int Reviewed-by: Taylor Simpson Signed-off-by: Matheus Tavares Bernardino --- target/hexagon/mmvec/hvx_ieee_fp.h | 4 + target/hexagon/mmvec/hvx_ieee_fp.c | 18 ++++ target/hexagon/imported/mmvec/encode_ext.def | 18 ++++ target/hexagon/imported/mmvec/ext.idef | 97 ++++++++++++++++++++ 4 files changed, 137 insertions(+) diff --git a/target/hexagon/mmvec/hvx_ieee_fp.h b/target/hexagon/mmvec/hvx_= ieee_fp.h index dff2fab14c..bdc21e08f0 100644 --- a/target/hexagon/mmvec/hvx_ieee_fp.h +++ b/target/hexagon/mmvec/hvx_ieee_fp.h @@ -10,6 +10,7 @@ #include "fpu/softfloat.h" =20 #define f16_to_f32(A) float16_to_float32((A), true, &env->hvx_fp_status) +#define f32_to_f16(A) float32_to_float16((A), true, &env->hvx_fp_status) =20 float32 fp_mult_sf_hf(float16 a1, float16 a2, float_status *fp_status); float32 fp_vdmpy(float16 a1, float16 a2, float16 a3, float16 a4, @@ -21,4 +22,7 @@ float32 qf_min_sf(float32 a1, float32 a2, float_status *f= p_status); float16 qf_max_hf(float16 a1, float16 a2, float_status *fp_status); float16 qf_min_hf(float16 a1, float16 a2, float_status *fp_status); =20 +int32_t conv_w_sf(float32 a, float_status *fp_status); +int16_t conv_h_hf(float16 a, float_status *fp_status); + #endif diff --git a/target/hexagon/mmvec/hvx_ieee_fp.c b/target/hexagon/mmvec/hvx_= ieee_fp.c index 2ae79a485a..697f35b5ed 100644 --- a/target/hexagon/mmvec/hvx_ieee_fp.c +++ b/target/hexagon/mmvec/hvx_ieee_fp.c @@ -69,3 +69,21 @@ float16 qf_min_hf(float16 a1, float16 a2, float_status *= fp_status) } return float16_min(a1, a2, fp_status); } + +int32_t conv_w_sf(float32 a, float_status *fp_status) +{ + /* float32_to_int32 converts any NaN to MAX, hexagon looks at the sign= . */ + if (float32_is_any_nan(a)) { + return float32_is_neg(a) ? INT32_MIN : INT32_MAX; + } + return float32_to_int32_round_to_zero(a, fp_status); +} + +int16_t conv_h_hf(float16 a, float_status *fp_status) +{ + /* float16_to_int16 converts any NaN to MAX, hexagon looks at the sign= . */ + if (float16_is_any_nan(a)) { + return float16_is_neg(a) ? INT16_MIN : INT16_MAX; + } + return float16_to_int16_round_to_zero(a, fp_status); +} diff --git a/target/hexagon/imported/mmvec/encode_ext.def b/target/hexagon/= imported/mmvec/encode_ext.def index 72daf8724c..c1ed1b6c23 100644 --- a/target/hexagon/imported/mmvec/encode_ext.def +++ b/target/hexagon/imported/mmvec/encode_ext.def @@ -840,4 +840,22 @@ DEF_ENC(V6_vfneg_sf,"00011110--0-0110PP1uuuuu011ddddd") DEF_ENC(V6_vabs_hf,"00011110--0-0110PP1uuuuu100ddddd") DEF_ENC(V6_vabs_sf,"00011110--0-0110PP1uuuuu101ddddd") =20 +/* IEEE FP vcvt instructions */ +DEF_ENC(V6_vcvt_sf_hf,"00011110--0-0100PP1uuuuu100ddddd") +DEF_ENC(V6_vcvt_hf_sf,"00011111011vvvvvPP1uuuuu001ddddd") +DEF_ENC(V6_vcvt_hf_ub,"00011110--0-0100PP1uuuuu001ddddd") +DEF_ENC(V6_vcvt_hf_b,"00011110--0-0100PP1uuuuu010ddddd") +DEF_ENC(V6_vcvt_hf_uh,"00011110--0-0100PP1uuuuu101ddddd") +DEF_ENC(V6_vcvt_hf_h,"00011110--0-0100PP1uuuuu111ddddd") +DEF_ENC(V6_vcvt_uh_hf,"00011110--0--101PP1uuuuu000ddddd") +DEF_ENC(V6_vcvt_h_hf,"00011110--0-0110PP1uuuuu000ddddd") +DEF_ENC(V6_vcvt_ub_hf,"00011111110vvvvvPP1uuuuu101ddddd") +DEF_ENC(V6_vcvt_b_hf,"00011111110vvvvvPP1uuuuu110ddddd") + +/* IEEE FP vconv instructions */ +DEF_ENC(V6_vconv_sf_w,"00011110--0--101PP1uuuuu011ddddd") +DEF_ENC(V6_vconv_w_sf,"00011110--0--101PP1uuuuu001ddddd") +DEF_ENC(V6_vconv_hf_h,"00011110--0--101PP1uuuuu100ddddd") +DEF_ENC(V6_vconv_h_hf,"00011110--0--101PP1uuuuu010ddddd") + #endif /* NO MMVEC */ diff --git a/target/hexagon/imported/mmvec/ext.idef b/target/hexagon/import= ed/mmvec/ext.idef index 1b16ed0628..788ce1d2ae 100644 --- a/target/hexagon/imported/mmvec/ext.idef +++ b/target/hexagon/imported/mmvec/ext.idef @@ -63,6 +63,9 @@ ITERATOR_INSN_ANY_SLOT_DOUBLE_VEC(WIDTH,TAG,SYNTAX2,DESCR= ,CODE) EXTINSN(V6_##TAG, SYNTAX, ATTRIBS(A_EXTENSION,A_CVI,A_CVI_VS), \ DESCR, DO_FOR_EACH_CODE(WIDTH, CODE)) =20 +#define ITERATOR_INSN_SHIFT_SLOT_FLT(WIDTH,TAG,SYNTAX,DESCR,CODE) \ +EXTINSN(V6_##TAG, SYNTAX, ATTRIBS(A_EXTENSION,A_CVI,A_CVI_VS,A_HVX_FLT), \ +DESCR, DO_FOR_EACH_CODE(WIDTH, CODE)) =20 #define ITERATOR_INSN_SHIFT3_SLOT(WIDTH,TAG,SYNTAX,DESCR,CODE) \ EXTINSN(V6_##TAG, SYNTAX, ATTRIBS(A_EXTENSION,A_CVI,A_CVI_VS,A_CVI_VS_3SRC= ,A_NOTE_SHIFT_RESOURCE,A_NOTE_NOVP,A_NOTE_VA_UNARY), \ @@ -3046,6 +3049,100 @@ ITERATOR_INSN_IEEE_FP_16_32_LATE(16, vabs_hf, "Vd3= 2.hf=3Dvabs(Vu32.hf)", \ ITERATOR_INSN_IEEE_FP_16_32_LATE(32, vabs_sf, "Vd32.sf=3Dvabs(Vu32.sf)", \ "Vector IEEE abs: sf", VdV.sf[i] =3D float32_abs(VuV.sf[i])) =20 +/* Two pipes: P2 & P3, two outputs, 16-bit */ +#define ITERATOR_INSN_IEEE_FP_DOUBLE_16(WIDTH,TAG,SYNTAX,DESCR,CODE) \ +EXTINSN(V6_##TAG, SYNTAX, \ +ATTRIBS(A_EXTENSION,A_HVX_IEEE_FP,A_CVI,A_CVI_VX_DV,A_HVX_IEEE_FP_OUT_16),= \ +DESCR, DO_FOR_EACH_CODE(WIDTH, CODE)) + +/* Two pipes: P2 & P3, two outputs, 32-bit output */ +#define ITERATOR_INSN_IEEE_FP_DOUBLE_32(WIDTH,TAG,SYNTAX,DESCR,CODE) \ +EXTINSN(V6_##TAG, SYNTAX, \ + ATTRIBS(A_EXTENSION,A_HVX_IEEE_FP,A_CVI,A_CVI_VX_DV,A_HVX_IEEE_FP_OUT_= 32), \ + DESCR, DO_FOR_EACH_CODE(WIDTH, CODE)) + +/* Single pipe, 16-bit output */ +#define ITERATOR_INSN_IEEE_FP_16(WIDTH,TAG,SYNTAX,DESCR,CODE) \ +EXTINSN(V6_##TAG, SYNTAX, \ + ATTRIBS(A_EXTENSION,A_HVX_IEEE_FP,A_CVI,A_CVI_VX,A_HVX_IEEE_FP_OUT_16)= , \ + DESCR, DO_FOR_EACH_CODE(WIDTH, CODE)) + +/* single pipe, output can feed 16- or 32-bit accumulate */ +#define ITERATOR_INSN_IEEE_FP_16_32(WIDTH,TAG,SYNTAX,DESCR,CODE) \ +EXTINSN(V6_##TAG, SYNTAX, \ + ATTRIBS(A_EXTENSION,A_HVX_IEEE_FP,A_CVI,A_CVI_VX,A_HVX_IEEE_FP_OUT_16,= A_HVX_IEEE_FP_OUT_32), \ + DESCR, DO_FOR_EACH_CODE(WIDTH, CODE)) + +/*************************************************************************= ***** + * IEEE FP convert instructions + *************************************************************************= *****/ + +ITERATOR_INSN_IEEE_FP_DOUBLE_16(32, vcvt_hf_ub, "Vdd32.hf=3Dvcvt(Vu32.ub)= ", + "Vector IEEE cvt from int: ub widen to hf", + VddV.v[0].hf[2*i] =3D uint64_to_float16_scalbn(VuV.ub[4*i], float_ro= und_nearest_even, 0); + VddV.v[0].hf[2*i+1] =3D uint64_to_float16_scalbn(VuV.ub[4*i+1], float_= round_nearest_even, 0); + VddV.v[1].hf[2*i] =3D uint64_to_float16_scalbn(VuV.ub[4*i+2], float_= round_nearest_even, 0); + VddV.v[1].hf[2*i+1] =3D uint64_to_float16_scalbn(VuV.ub[4*i+3], float_= round_nearest_even, 0)) + +ITERATOR_INSN_IEEE_FP_DOUBLE_16(32, vcvt_hf_b, "Vdd32.hf=3Dvcvt(Vu32.b)", + "Vector IEEE cvt from int: b widen to hf", + VddV.v[0].hf[2*i] =3D int64_to_float16_scalbn(VuV.b[4*i], float_roun= d_nearest_even, 0); + VddV.v[0].hf[2*i+1] =3D int64_to_float16_scalbn(VuV.b[4*i+1], float_ro= und_nearest_even, 0); + VddV.v[1].hf[2*i] =3D int64_to_float16_scalbn(VuV.b[4*i+2], float_ro= und_nearest_even, 0); + VddV.v[1].hf[2*i+1] =3D int64_to_float16_scalbn(VuV.b[4*i+3], float_ro= und_nearest_even, 0)) + +ITERATOR_INSN_IEEE_FP_DOUBLE_32(32, vcvt_sf_hf, "Vdd32.sf=3Dvcvt(Vu32.hf)", + "Vector IEEE cvt: hf widen to sf", + VddV.v[0].sf[i] =3D f16_to_f32(VuV.hf[2*i]); + VddV.v[1].sf[i] =3D f16_to_f32(VuV.hf[2*i+1])) + +ITERATOR_INSN_IEEE_FP_16(16, vcvt_hf_uh, "Vd32.hf=3Dvcvt(Vu32.uh)", + "Vector IEEE cvt from int: uh to hf", + VdV.hf[i] =3D uint64_to_float16_scalbn(VuV.uh[i], float_round_nearest_= even, 0)) +ITERATOR_INSN_IEEE_FP_16(16, vcvt_hf_h, "Vd32.hf=3Dvcvt(Vu32.h)", + "Vector IEEE cvt from int: h to hf", + VdV.hf[i] =3D int64_to_float16_scalbn(VuV.h[i], float_round_nearest_ev= en, 0)) +ITERATOR_INSN_IEEE_FP_16_32(16, vcvt_uh_hf, "Vd32.uh=3Dvcvt(Vu32.hf)", + "Vector IEEE cvt to int: hf to uh", + VdV.uh[i] =3D float16_to_uint16_scalbn(VuV.hf[i], float_round_nearest_= even, 0, &env->hvx_fp_status)) +ITERATOR_INSN_IEEE_FP_16_32(16, vcvt_h_hf, "Vd32.h=3Dvcvt(Vu32.hf)", + "Vector IEEE cvt to int: hf to h", + VdV.h[i] =3D float16_to_int16_scalbn(VuV.hf[i], float_round_nearest_e= ven, 0, &env->hvx_fp_status)) + +ITERATOR_INSN_IEEE_FP_16(32, vcvt_hf_sf, "Vd32.hf=3Dvcvt(Vu32.sf,Vv32.sf)", + "Vector IEEE cvt: sf to hf", + VdV.hf[2*i] =3D f32_to_f16(VuV.sf[i]); + VdV.hf[2*i+1] =3D f32_to_f16(VvV.sf[i])) + +ITERATOR_INSN_IEEE_FP_16_32(32, vcvt_ub_hf, "Vd32.ub=3Dvcvt(Vu32.hf,Vv32.h= f)", "Vector cvt to int: hf narrow to ub", + VdV.ub[4*i] =3D float16_to_uint8_scalbn(VuV.hf[2*i], float_round_nea= rest_even, 0, &env->hvx_fp_status); + VdV.ub[4*i+1] =3D float16_to_uint8_scalbn(VuV.hf[2*i+1], float_round_n= earest_even, 0, &env->hvx_fp_status); + VdV.ub[4*i+2] =3D float16_to_uint8_scalbn(VvV.hf[2*i], float_round_nea= rest_even, 0, &env->hvx_fp_status); + VdV.ub[4*i+3] =3D float16_to_uint8_scalbn(VvV.hf[2*i+1], float_round_n= earest_even, 0, &env->hvx_fp_status)) + +ITERATOR_INSN_IEEE_FP_16_32(32, vcvt_b_hf, "Vd32.b=3Dvcvt(Vu32.hf,Vv32.hf= )", + "Vector cvt to int: hf narrow to b", + VdV.b[4*i] =3D float16_to_int8_scalbn(VuV.hf[2*i], float_round_neare= st_even, 0, &env->hvx_fp_status); + VdV.b[4*i+1] =3D float16_to_int8_scalbn(VuV.hf[2*i+1], float_round_nea= rest_even, 0, &env->hvx_fp_status); + VdV.b[4*i+2] =3D float16_to_int8_scalbn(VvV.hf[2*i], float_round_neare= st_even, 0, &env->hvx_fp_status); + VdV.b[4*i+3] =3D float16_to_int8_scalbn(VvV.hf[2*i+1], float_round_nea= rest_even, 0, &env->hvx_fp_status)) + +ITERATOR_INSN_SHIFT_SLOT_FLT(32, vconv_w_sf,"Vd32.w=3DVu32.sf", + "Vector conversion of sf32 format to int w", + VdV.w[i] =3D conv_w_sf(VuV.sf[i], &env->hvx_fp_status)) + +ITERATOR_INSN_SHIFT_SLOT_FLT(16, vconv_h_hf,"Vd32.h=3DVu32.hf", + "Vector conversion of hf16 format to int hw", + VdV.h[i] =3D conv_h_hf(VuV.hf[i], &env->hvx_fp_status)) + +ITERATOR_INSN_SHIFT_SLOT_FLT(32, vconv_sf_w,"Vd32.sf=3DVu32.w", + "Vector conversion of int w format to sf32", + VdV.sf[i] =3D int32_to_float32(VuV.w[i], &env->hvx_fp_status)) + +ITERATOR_INSN_SHIFT_SLOT_FLT(16, vconv_hf_h,"Vd32.hf=3DVu32.h", + "Vector conversion of int hw format to hf16", + VdV.hf[i] =3D float16_val(int16_to_float16(VuV.h[i], &env->hvx_fp_stat= us))) + /*************************************************************************= ***** DEBUG Vector/Register Printing *************************************************************************= *****/ --=20 2.37.2 From nobody Sat May 30 20:11:22 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1776339700; cv=none; d=zohomail.com; s=zohoarc; b=c69keJE8bhqQ9jUshSGjv6qr0ie/sRwPu75LqivJ3t//0DJDN40Kp7FZE8R71blv/GSZcmygXdYkvk/mby0a3DJKy5Vg2gSfu39GfJOMZpfVux0hTR4/zVG14y2FDtryCAgkCfAxcqjATvqeLuKhV5xQQBENKq9K2BqwN8i0WI4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776339700; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=2OUE2BZvCkhP3m2KzBqhz4prBprubJMeMyYTeAjRTI8=; b=GfDzpS2Klc1CQpJcqBpWgmIgksKGeVN/ugZQuSh8jitQJj1RHzogzngUrLx7OWrlQvaf7PoEeqaXLKER6zRjLi2hfSEjj31ydGeX7h8QCmElLqWj48r9tERMZe51yC5COxS06ZTCBGV/v3XEoAvPVDiZ7vNgNMyZRee33nNwvAQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776339700611543.6384553011221; Thu, 16 Apr 2026 04:41:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wDL4X-0005Jz-8c; Thu, 16 Apr 2026 07:39:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wDL4I-00058Q-8a for qemu-devel@nongnu.org; Thu, 16 Apr 2026 07:39:36 -0400 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wDL4G-0003BN-4d for qemu-devel@nongnu.org; Thu, 16 Apr 2026 07:39:34 -0400 Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 63G7uwDX3733606 for ; Thu, 16 Apr 2026 11:39:20 GMT Received: from mail-dy1-f198.google.com (mail-dy1-f198.google.com [74.125.82.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4djcqwktx3-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 16 Apr 2026 11:39:20 +0000 (GMT) Received: by mail-dy1-f198.google.com with SMTP id 5a478bee46e88-2c0ba59a830so10021035eec.0 for ; Thu, 16 Apr 2026 04:39:20 -0700 (PDT) Received: from hu-mathbern-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2de8c10a65asm6845391eec.6.2026.04.16.04.39.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Apr 2026 04:39:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=2OUE2BZvCkh P3m2KzBqhz4prBprubJMeMyYTeAjRTI8=; b=BkpuZxFR/I3tZhPzRdOyywi4XiO 7rGVC2c388CwPo/zb780Kzym8h+u5y8hK1jvWLEWoarH/lhIx4Nz7EV1Jj4e+z8Z OTZ+au8NVsfGwK1LIjALrhlPqURedEH2l/GFNhzVUo3er9xgmacAtuainiaRqexE bGudWT1mcl9z6SZc4BxvQH9ptDj5IIwbz7m47SJnAKmXkbgt/GZWswdBaXypKbtZ lvh1AqKfjuIE4pV6Vxv//T5vhVMNTzAQYdRjlVAJrJxYSupdfHQ5cWzCvcKjvqvN /nymZP3ZW7eT0Wlcuj6BNXKBzzt7ScAYHba9eY3Ob+74i9T6zFO3fG/AFSQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1776339560; x=1776944360; darn=nongnu.org; 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=2OUE2BZvCkhP3m2KzBqhz4prBprubJMeMyYTeAjRTI8=; b=eNaN/+C1FKP9GX1R5ePeEYfjYxxUKJloDawXxk4NzFdEWL3Vt84Sfp26klVvFUkMZ4 q75axDR6LmeCC1jchvVZOpHBg8LYPq6cQvUFXaP2MNth7GbSkeOobmqRgvs2pf5k6DYH zUvri3WBTntC8wSjqzCs+pJRqj6ZCdNPT2Klsg9ntxNrI+Hn7foQ6V71mxjpFBBnLs0x hS7ajcTB4s/u3ySpJd0lwOJrPf7FFx0uLVogNT15yvenIgjqnEzB2HHEtX0ogo5rQaoe OcxXNE897JeudA4XQqip7e55WNK4PAd3GiABMQNQv1A5Ys3M+LeXJocY1PyseLLrCPQT UN/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776339560; x=1776944360; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=2OUE2BZvCkhP3m2KzBqhz4prBprubJMeMyYTeAjRTI8=; b=AVLhBHxnWiJiGxQwfFPunA/glexcUg4wiH7MovnttrfkVUHQeMP1tw+VsIQM2KHrCw lJc4g8VsaFuVVY7IwTZSGPZfRcmhgfnCq6q20pbA/ANohQlxr5vyf1eVeXNbxGMc4Omn vNNmkNULj3wRxWNqw1QmQ8sbFqgKy6OZ2V9ylT5UH1n5VwxyFMZcXkeUoJUopKcRlXR+ sXqG+zMZozBvC2vzMqiryjERYemfPb/B8c7vhoFgRcWeVE9pnFSRyKMTZdD0Sdiw1Oym b5aAZD/LylqugZNiNXoem0wGHb60Q9HPgp5+LmzxXfE2DSFa/eV3ZpUII3dNTaS1OmtT pB6A== X-Gm-Message-State: AOJu0Yx561DQCg9D3Bg1M/0iAa36LL8uyS0kltyPMD3UdrWSAMTxNegA CnzVPfG2GVyb/KiadC5G2+2TKgP5dTQbNpXTb1eDPW2I0rP7TLMYy60Z15BFa7d9FE3QfaKPrHw z2gDVExPUUbxmVfNvvqnopv4FMyFRC039QYisQPf2xSf56u6Bt/g0HYwFcng1btNW6qxe X-Gm-Gg: AeBDietzI1PxYxLCsjH6VLhKPbVm8fNuLnDolHX8r6O5DDW86Of3Wl5dvWn8KRTs8BI VyaFF/eYicTkIKj/UHcfl1TwQzhrI+7PMpMaX9O3YusBUS5BO5Un7YXyRYIfIELOrueQto45wLm b/yI4bYQd95tNO6eGEwlECQ9oKCnQtyVsPHsWaJUnL/t1BL15+KKili4jv2rR31DizTM+ZVkdRP 0wtxzPxB6v/HgGmw4Rg5xpMGf+/R/gGfncvW1q4JyQ+BDk8KnFE0I9hXqpiGi8rS6fJQ/zHR4Fd dA4sEgLSelPVy3IEYh5JlUvU6V6MLzENLbERBjK9CmAGD9LVWfpeXxZa2H45fYVMv/x/GtyK7BL vwcn5e5sdcmrHkFPTTuGhR6aOyC56OJ56Z6Q8SYwR61lwyJVlxMj76+jMAKDy/X8OYFdpGZizMy EMjzDwkZaRTjTuHRP/TC8= X-Received: by 2002:a05:7022:609d:b0:12a:6f8b:36a3 with SMTP id a92af1059eb24-12c34e71d4bmr13039043c88.6.1776339559706; Thu, 16 Apr 2026 04:39:19 -0700 (PDT) X-Received: by 2002:a05:7022:609d:b0:12a:6f8b:36a3 with SMTP id a92af1059eb24-12c34e71d4bmr13039011c88.6.1776339559070; Thu, 16 Apr 2026 04:39:19 -0700 (PDT) From: Matheus Tavares Bernardino To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, ale@rev.ng, anjo@rev.ng, brian.cain@oss.qualcomm.com, ltaylorsimpson@gmail.com, marco.liebel@oss.qualcomm.com, philmd@linaro.org, quic_mburton@quicinc.com, sid.manning@oss.qualcomm.com Subject: [PATCH v5 10/16] target/hexagon: add v68 HVX IEEE float compare insns Date: Thu, 16 Apr 2026 04:38:59 -0700 Message-Id: <96e27588ad5a7d47ba9f56f1d547729a19b691c5.1776339451.git.matheus.bernardino@oss.qualcomm.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: jNu58ZhU7SuXSwTeKwN0X2a4KxrYqz_y X-Proofpoint-GUID: jNu58ZhU7SuXSwTeKwN0X2a4KxrYqz_y X-Authority-Analysis: v=2.4 cv=XOIAjwhE c=1 sm=1 tr=0 ts=69e0ca68 cx=c_pps a=wEP8DlPgTf/vqF+yE6f9lg==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=eoimf2acIAo5FJnRuUoq:22 a=pGLkceISAAAA:8 a=EUspDBNiAAAA:8 a=kUWl_rcrYXyUEKLnQikA:9 a=bBxd6f-gb0O0v-kibOvt:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDE2MDExMCBTYWx0ZWRfX9Fr6u7/1T5oT BBY/VycPX1GppPOnZrr3XaG9y4aSZa/IMGewW5Eq3n7EPHvYzsGF3jpy2xetG3yd6oQIXJFrrEQ lV4Wns78TMDTkI1KrIbIFoaNAq/4rW6ZZf32z8AKShOx+xLVQczeCuZFLvvQ+1XjkHOJx1KPyui tSI1gC0UtrdqljBfuHGxnZOY6ZDbDMm9vwapd3fqILRAxitE4gRKCNFqVHgj0iSmqLKA+CSzE73 vyKtZo+GHPWu+UhgWQUlFTATiUa85PI6aeJFFHp3KzIUWwGOxEZ4kE7TPQ53RrtSp7NoIQZLdAm AsLSS97fzsrdc6NyDmezbpAw0RKiZPvlmsK00yi1rR/WpIQMQxqDn7imb6KJbrQPsHjSiZZjCw5 ZA1POZo7RR3ZTmrurd3ZarT7VUC/Kvtm/ffMqT86D9rS931q30mbfpSvxeP7FAy9KbGuiSJ+9Jp 6ETwZcyFhGJfuULNEJA== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-16_03,2026-04-13_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 adultscore=0 suspectscore=0 spamscore=0 malwarescore=0 bulkscore=0 impostorscore=0 phishscore=0 clxscore=1015 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604070000 definitions=main-2604160110 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=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.168.131; envelope-from=matheus.bernardino@oss.qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1776339702478158500 Content-Type: text/plain; charset="utf-8" Add HVX IEEE floating-point compare instructions: - V6_vgthf, V6_vgtsf: greater-than compare - V6_vgthf_and, V6_vgtsf_and: greater-than with predicate-and - V6_vgthf_or, V6_vgtsf_or: greater-than with predicate-or - V6_vgthf_xor, V6_vgtsf_xor: greater-than with predicate-xor Reviewed-by: Taylor Simpson Signed-off-by: Matheus Tavares Bernardino --- target/hexagon/mmvec/hvx_ieee_fp.h | 4 ++ target/hexagon/mmvec/macros.h | 3 + target/hexagon/mmvec/hvx_ieee_fp.c | 48 +++++++++++++++ target/hexagon/imported/mmvec/encode_ext.def | 10 ++++ target/hexagon/imported/mmvec/ext.idef | 61 ++++++++++++++++++++ 5 files changed, 126 insertions(+) diff --git a/target/hexagon/mmvec/hvx_ieee_fp.h b/target/hexagon/mmvec/hvx_= ieee_fp.h index bdc21e08f0..01728121eb 100644 --- a/target/hexagon/mmvec/hvx_ieee_fp.h +++ b/target/hexagon/mmvec/hvx_ieee_fp.h @@ -25,4 +25,8 @@ float16 qf_min_hf(float16 a1, float16 a2, float_status *f= p_status); int32_t conv_w_sf(float32 a, float_status *fp_status); int16_t conv_h_hf(float16 a, float_status *fp_status); =20 +/* IEEE - FP compare instructions */ +uint32_t cmpgt_sf(float32 a1, float32 a2, float_status *fp_status); +uint16_t cmpgt_hf(float16 a1, float16 a2, float_status *fp_status); + #endif diff --git a/target/hexagon/mmvec/macros.h b/target/hexagon/mmvec/macros.h index ac709d8993..318d44efb7 100644 --- a/target/hexagon/mmvec/macros.h +++ b/target/hexagon/mmvec/macros.h @@ -356,4 +356,7 @@ extract32(VAL, POS * 8, 8); \ } while (0); =20 +#define fCMPGT_SF(A, B) cmpgt_sf(A, B, &env->hvx_fp_status) +#define fCMPGT_HF(A, B) cmpgt_hf(A, B, &env->hvx_fp_status) + #endif diff --git a/target/hexagon/mmvec/hvx_ieee_fp.c b/target/hexagon/mmvec/hvx_= ieee_fp.c index 697f35b5ed..d7751adbe2 100644 --- a/target/hexagon/mmvec/hvx_ieee_fp.c +++ b/target/hexagon/mmvec/hvx_ieee_fp.c @@ -87,3 +87,51 @@ int16_t conv_h_hf(float16 a, float_status *fp_status) } return float16_to_int16_round_to_zero(a, fp_status); } + +/* + * Returns true if f1 > f2, where at least one of the elements is guarante= ed + * to be NaN. + * Up to v73, Hexagon HVX IEEE FP follows this order: + * QNaN > SNaN > +Inf > numbers > -Inf > SNaN_neg > QNaN_neg + */ +static bool float32_nan_compare(float32 f1, float32 f2, float_status *fp_s= tatus) +{ + /* opposite signs case */ + if (float32_is_neg(f1) !=3D float32_is_neg(f2)) { + return !float32_is_neg(f1); + } + + /* same sign case */ + bool result =3D (float32_is_any_nan(f1) && !float32_is_any_nan(f2)) || + (float32_is_quiet_nan(f1, fp_status) && !float32_is_quiet_nan(f2, = fp_status)); + return float32_is_neg(f1) ? !result : result; +} + +static bool float16_nan_compare(float16 f1, float16 f2, float_status *fp_s= tatus) +{ + /* opposite signs case */ + if (float16_is_neg(f1) !=3D float16_is_neg(f2)) { + return !float16_is_neg(f1); + } + + /* same sign case */ + bool result =3D (float16_is_any_nan(f1) && !float16_is_any_nan(f2)) || + (float16_is_quiet_nan(f1, fp_status) && !float16_is_quiet_nan(f2, = fp_status)); + return float16_is_neg(f1) ? !result : result; +} + +uint32_t cmpgt_sf(float32 a1, float32 a2, float_status *fp_status) +{ + if (float32_is_any_nan(a1) || float32_is_any_nan(a2)) { + return float32_nan_compare(a1, a2, fp_status); + } + return float32_compare(a1, a2, fp_status) =3D=3D float_relation_greate= r; +} + +uint16_t cmpgt_hf(float16 a1, float16 a2, float_status *fp_status) +{ + if (float16_is_any_nan(a1) || float16_is_any_nan(a2)) { + return float16_nan_compare(a1, a2, fp_status); + } + return float16_compare(a1, a2, fp_status) =3D=3D float_relation_greate= r; +} diff --git a/target/hexagon/imported/mmvec/encode_ext.def b/target/hexagon/= imported/mmvec/encode_ext.def index c1ed1b6c23..3572e4de4c 100644 --- a/target/hexagon/imported/mmvec/encode_ext.def +++ b/target/hexagon/imported/mmvec/encode_ext.def @@ -858,4 +858,14 @@ DEF_ENC(V6_vconv_w_sf,"00011110--0--101PP1uuuuu001dddd= d") DEF_ENC(V6_vconv_hf_h,"00011110--0--101PP1uuuuu100ddddd") DEF_ENC(V6_vconv_h_hf,"00011110--0--101PP1uuuuu010ddddd") =20 +/* IEEE FP compare instructions */ +DEF_ENC(V6_vgtsf,"00011100100vvvvvPP1uuuuu011100dd") +DEF_ENC(V6_vgthf,"00011100100vvvvvPP1uuuuu011101dd") +DEF_ENC(V6_vgtsf_and,"00011100100vvvvvPP1uuuuu110010xx") +DEF_ENC(V6_vgthf_and,"00011100100vvvvvPP1uuuuu110011xx") +DEF_ENC(V6_vgtsf_or,"00011100100vvvvvPP1uuuuu001100xx") +DEF_ENC(V6_vgthf_or,"00011100100vvvvvPP1uuuuu001101xx") +DEF_ENC(V6_vgtsf_xor,"00011100100vvvvvPP1uuuuu111010xx") +DEF_ENC(V6_vgthf_xor,"00011100100vvvvvPP1uuuuu111011xx") + #endif /* NO MMVEC */ diff --git a/target/hexagon/imported/mmvec/ext.idef b/target/hexagon/import= ed/mmvec/ext.idef index 788ce1d2ae..a7043d598c 100644 --- a/target/hexagon/imported/mmvec/ext.idef +++ b/target/hexagon/imported/mmvec/ext.idef @@ -3143,6 +3143,67 @@ ITERATOR_INSN_SHIFT_SLOT_FLT(16, vconv_hf_h,"Vd32.hf= =3DVu32.h", "Vector conversion of int hw format to hf16", VdV.hf[i] =3D float16_val(int16_to_float16(VuV.h[i], &env->hvx_fp_stat= us))) =20 +/*************************************************************************= ***** + * IEEE FP compare instructions + *************************************************************************= *****/ + +#define VCMPGT_SF(DEST, ASRC, ASRCOP, CMP, N, SRC, MASK, WIDTH) \ +{ \ + for (fHIDE(int) i =3D 0; i < fVBYTES(); i +=3D WIDTH) { \ + fHIDE(int) VAL =3D fCMPGT_SF(VuV.SRC[i/WIDTH],VvV.SRC[i/WIDTH]) ? = MASK : 0; \ + fSETQBITS(DEST,WIDTH,MASK,i,ASRC ASRCOP VAL); \ + } \ +} + +#define VCMPGT_HF(DEST, ASRC, ASRCOP, CMP, N, SRC, MASK, WIDTH) \ +{ \ + for (fHIDE(int) i =3D 0; i < fVBYTES(); i +=3D WIDTH) { \ + fHIDE(int) VAL =3D fCMPGT_HF(VuV.SRC[i/WIDTH],VvV.SRC[i/WIDTH]) ? = MASK : 0; \ + fSETQBITS(DEST,WIDTH,MASK,i,ASRC ASRCOP VAL); \ + } \ +} + +/* Vector SF compare */ +#define MMVEC_CMPGT_SF(TYPE,TYPE2,DESCR,N,MASK,WIDTH,SRC) \ + EXTINSN(V6_vgt##TYPE##_and, "Qx4&=3Dvcmp.gt(Vu32." TYPE2 ",Vv32." TYPE= 2 ")", \ + ATTRIBS(A_EXTENSION,A_CVI,A_CVI_VA,A_CVI_VA_2SRC,A_HVX_FLT), \ + DESCR" greater than with predicate-and", \ + VCMPGT_SF(QxV, fGETQBITS(QxV,WIDTH,MASK,i), &, ">", N, SRC, MASK, = WIDTH)) \ + EXTINSN(V6_vgt##TYPE##_xor, "Qx4^=3Dvcmp.gt(Vu32." TYPE2 ",Vv32." TYPE= 2 ")", \ + ATTRIBS(A_EXTENSION,A_CVI,A_CVI_VA,A_CVI_VA_2SRC,A_HVX_FLT), \ + DESCR" greater than with predicate-xor", \ + VCMPGT_SF(QxV, fGETQBITS(QxV,WIDTH,MASK,i), ^, ">", N, SRC, MASK, = WIDTH)) \ + EXTINSN(V6_vgt##TYPE##_or, "Qx4|=3Dvcmp.gt(Vu32." TYPE2 ",Vv32." TYPE2= ")", \ + ATTRIBS(A_EXTENSION,A_CVI,A_CVI_VA,A_CVI_VA_2SRC,A_HVX_FLT), \ + DESCR" greater than with predicate-or", \ + VCMPGT_SF(QxV, fGETQBITS(QxV,WIDTH,MASK,i), |, ">", N, SRC, MASK, = WIDTH)) \ + EXTINSN(V6_vgt##TYPE, "Qd4=3Dvcmp.gt(Vu32." TYPE2 ",Vv32." TYPE2 ")", \ + ATTRIBS(A_EXTENSION,A_CVI,A_CVI_VA,A_CVI_VA_2SRC,A_HVX_FLT), \ + DESCR" greater than", \ + VCMPGT_SF(QdV, , , ">", N, SRC, MASK, WIDTH)) + +/* Vector HF compare */ +#define MMVEC_CMPGT_HF(TYPE,TYPE2,DESCR,N,MASK,WIDTH,SRC) \ + EXTINSN(V6_vgt##TYPE##_and, "Qx4&=3Dvcmp.gt(Vu32." TYPE2 ",Vv32." TYPE= 2 ")", \ + ATTRIBS(A_EXTENSION,A_CVI,A_CVI_VA,A_CVI_VA_2SRC,A_HVX_FLT), \ + DESCR" greater than with predicate-and", \ + VCMPGT_HF(QxV, fGETQBITS(QxV,WIDTH,MASK,i), &, ">", N, SRC, MASK, = WIDTH)) \ + EXTINSN(V6_vgt##TYPE##_xor, "Qx4^=3Dvcmp.gt(Vu32." TYPE2 ",Vv32." TYPE= 2 ")", \ + ATTRIBS(A_EXTENSION,A_CVI,A_CVI_VA,A_CVI_VA_2SRC,A_HVX_FLT), \ + DESCR" greater than with predicate-xor", \ + VCMPGT_HF(QxV, fGETQBITS(QxV,WIDTH,MASK,i), ^, ">", N, SRC, MASK, = WIDTH)) \ + EXTINSN(V6_vgt##TYPE##_or, "Qx4|=3Dvcmp.gt(Vu32." TYPE2 ",Vv32." TYPE2= ")", \ + ATTRIBS(A_EXTENSION,A_CVI,A_CVI_VA,A_CVI_VA_2SRC,A_HVX_FLT), \ + DESCR" greater than with predicate-or", \ + VCMPGT_HF(QxV, fGETQBITS(QxV,WIDTH,MASK,i), |, ">", N, SRC, MASK, = WIDTH)) \ + EXTINSN(V6_vgt##TYPE, "Qd4=3Dvcmp.gt(Vu32." TYPE2 ",Vv32." TYPE2 ")", \ + ATTRIBS(A_EXTENSION,A_CVI,A_CVI_VA,A_CVI_VA_2SRC,A_HVX_FLT), \ + DESCR" greater than", \ + VCMPGT_HF(QdV, , , ">", N, SRC, MASK, WIDTH)) + +MMVEC_CMPGT_SF(sf,"sf","Vector sf Compare ", fVELEM(32), 0xF, 4, sf) +MMVEC_CMPGT_HF(hf,"hf","Vector hf Compare ", fVELEM(16), 0x3, 2, hf) + /*************************************************************************= ***** DEBUG Vector/Register Printing *************************************************************************= *****/ --=20 2.37.2 From nobody Sat May 30 20:11:22 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1776339624; cv=none; d=zohomail.com; s=zohoarc; b=XguFNkdQxfOFXS0sfx3Ccq5yAMBZG052V0MHDerDR4BIqUj3Wr8CWSlf5eyd2MnedGLHbqZFlAX6JdczHOwmlQKD9FoCWYnuVTQo8a/zeMH0H3e+dXEGkIZbQPxhZY7yQ6Nk7fxGl5/7MLl4WbCYVFeVCreZyEulP+R/Xijg7us= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776339624; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Bg1UFBpl/g/grPN4mrUk1QpMFLxFYUiGmyxRz34H1ss=; b=RN5WRTdtnAWp0MXqALmERc7PRNKuJaWSHXEi+9vnmIvIIm3jdGw4w4FX797I1L/plTnkhDdGA3L+meCB87oWEjTPRVclt4/8HwM2SzRSWHp+ZcxjaXzjhNQs/ECTfIFNLoQOe5xcA1VkDr7QpmHTnOlWSTOyfMT2uBKmgHd0r+8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776339624674716.3024059194045; Thu, 16 Apr 2026 04:40:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wDL4S-0005Fv-IG; Thu, 16 Apr 2026 07:39:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wDL4J-00058e-80 for qemu-devel@nongnu.org; Thu, 16 Apr 2026 07:39:36 -0400 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wDL4G-0003Bh-Uj for qemu-devel@nongnu.org; Thu, 16 Apr 2026 07:39:35 -0400 Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 63G7ks1C3734203 for ; Thu, 16 Apr 2026 11:39:21 GMT Received: from mail-dy1-f199.google.com (mail-dy1-f199.google.com [74.125.82.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4djcqwktx6-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 16 Apr 2026 11:39:21 +0000 (GMT) Received: by mail-dy1-f199.google.com with SMTP id 5a478bee46e88-2bdf6fe90a9so11502678eec.1 for ; Thu, 16 Apr 2026 04:39:21 -0700 (PDT) Received: from hu-mathbern-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2de8c10a65asm6845391eec.6.2026.04.16.04.39.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Apr 2026 04:39:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=Bg1UFBpl/g/ grPN4mrUk1QpMFLxFYUiGmyxRz34H1ss=; b=XNHuF1/by/s7ilw0e67H5g5AcVy QiZlO5FO7hW8Pu08Diworf0HZ0bHXuUsqbafseNPzFAPFl1BE0hq7Ht5jAQSyDBc 0DhRU94X9M3lfU9yIleFnyYEWaWFWwuNnqx5t7+p57TLPQZD7HBxeCnzQrw6oNdK S8Kj4jyiV4yemU0VJ6PKAwYA3j6ap/3mcj/oo2FRZ3kt+fiEZRrhHbdn40wtjs4A ANiKX0SGyMX9fVblBNYiWLWcCfxRMxeJEs2Ukg+kfsG+G3gTy37tULSijANqUo1s ZvLzUY/iqj60lVYnVcA7oehi0nDcztcX4WUYbx1W6DpCqVrvEsi01ZeJCtg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1776339561; x=1776944361; darn=nongnu.org; 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=Bg1UFBpl/g/grPN4mrUk1QpMFLxFYUiGmyxRz34H1ss=; b=ZqJsvypT7ZQCVwNOaWSPBobCJAsfT7C49CZqmFwsn1M1h0iVHQDizYmwlIAFqOfLGl SA7rpilFdjaJnzMHSvV2PXwjYNJVSeRX35I0xP4L90FFNuezyZcCr1SmA/Zz7ocGqYS9 SEUVMp6eTnW6MLTYWrDLrnJxzFFE4qyg+svN6rGSGYo9H7UEZMqdPrDZM1bKK9RO63Xj +lhuuS3F+hzr3BmK+zDd99Cp66sMXoxv7vG8SvhySY1RPa/Wwym6b7gnICmgg28Ztr8o ztFpS4fdaCtVeppAN1EZ/OJ/EgsF9/u+RR468T9O57zkXBuqSKRVs6mjjC37vLOf5ofM UCcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776339561; x=1776944361; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Bg1UFBpl/g/grPN4mrUk1QpMFLxFYUiGmyxRz34H1ss=; b=qLY2Qqt9m+TZr5ZYCs3zNCj1Qy00xoAvmQRHxjipQ6ysg/YdnVnv51+H/2XjgQpFJg SR6ZSFzyPSgaAsoI39JefeSio5qbXO3Uzio5rtIRhoC4pTOj8fHO8xWhnGzP02raE/op 5x1KzKPBjQrby6KFiVfNd4kUxJ+gWQqS8/OS4jZXLV7wc+eE3rfsEU8trKfLfcRvDkjX MR6sOTJpusBQqnNSUj6X5kXfJnD38wx5lp8QolCgCfyvyO05Yi4jd+qf7DQG5i2rApez FVxECR0tQMna+xhVYbEP/HjimRZhBKovJtOHxHTCP768daYGpY+smtRSQAob0OpD5+bb fylw== X-Gm-Message-State: AOJu0YwqE9ucEcWCxZWsjiizPrWLeKL61jIL3DQVG7/bHLcqx/s15say wktRYRSzEA3VNWfy6jPnHte7vn1NKS/RQgHIG49PsYNo6DrZc8PgJJiGDnA85TeHfGphm9cnZcE LEI2NC8cQcOgJg+hheIIj93TgItDQDIKYxZYDlzoSYv5ljVPyfFzU397Mg2Ze4f+7egI2 X-Gm-Gg: AeBDievHMMDlq79eWkVd6/t5GkTGZPM4fOhhtj/w94/IArQiEWzwMmbu85E/qyOW5Du x0epzUa1SDWFyOHb6r6CVSVHAVw9yLArbVrpN9ajPR4aXUIFy/73+cAlL0CZk1e6puKeoUKZhmq slTb+pB4zjCHM6Fp0NDS33IASdvwRDS3h+XNPT8Gp6xvcPR6NddnSvi2xuvr97EH5S+2x3LGwMo CyBTOuJw0r0dTbCX+lfCpvB/IY4t+5Pxk9haizH1CgzTGnxquinjbcFqFYXzAAjft0hpPQ490Cr YGnjxE9hlmHCSghECZeY32OQO7vNVttX0St/Iz3JbmEW/yN61dZNwx/Gb0sCdKb9dToIHccX2iJ aMDqFr2acuCM48pGKddAplFRNe+fiexM9Fd6fkcGMbEJFdJLM55Yt8XteUBUiIJYvFNCcB93soJ E69m2bu8rafVCdvjjneEM= X-Received: by 2002:a05:7300:7313:b0:2d8:b2e1:20cf with SMTP id 5a478bee46e88-2d8b2e122fbmr9977190eec.10.1776339560578; Thu, 16 Apr 2026 04:39:20 -0700 (PDT) X-Received: by 2002:a05:7300:7313:b0:2d8:b2e1:20cf with SMTP id 5a478bee46e88-2d8b2e122fbmr9977162eec.10.1776339559953; Thu, 16 Apr 2026 04:39:19 -0700 (PDT) From: Matheus Tavares Bernardino To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, ale@rev.ng, anjo@rev.ng, brian.cain@oss.qualcomm.com, ltaylorsimpson@gmail.com, marco.liebel@oss.qualcomm.com, philmd@linaro.org, quic_mburton@quicinc.com, sid.manning@oss.qualcomm.com Subject: [PATCH v5 11/16] target/hexagon: add v73 HVX IEEE bfloat16 insns Date: Thu, 16 Apr 2026 04:39:00 -0700 Message-Id: <1a253373567781e0e141c34b41eaffad4789a493.1776339451.git.matheus.bernardino@oss.qualcomm.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: rh4KWNM-Sralvu7FqobG5CB5uerhOsk3 X-Proofpoint-GUID: rh4KWNM-Sralvu7FqobG5CB5uerhOsk3 X-Authority-Analysis: v=2.4 cv=XOIAjwhE c=1 sm=1 tr=0 ts=69e0ca69 cx=c_pps a=cFYjgdjTJScbgFmBucgdfQ==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=eoimf2acIAo5FJnRuUoq:22 a=pGLkceISAAAA:8 a=EUspDBNiAAAA:8 a=Gs5wSyFCHfQ05zcHo-UA:9 a=scEy_gLbYbu1JhEsrz4S:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDE2MDExMCBTYWx0ZWRfX4kkIWMS8YgfS cy9BGFlNlOWE6QYolFwpRACeVMRrakf3gWZxFZ6hIC8Iexb7V9XkV97vCv6bllkRmpJY01iKDck 6/CDgDXm2hKaaBhTqmUEk2R9wE/a4/y+35nK+QOd7kAC8BFRz7XmyNkEzW5PoOzbCcr3Ab5+6Wg Nvzu1+al6c7FpG7iXoIbaayjkR0MKGQ1dxmv4ZIIFCWNmbEVrdz3aJsp/G1k9O9bstPzpdUAddC yPzh2ohKfdzGauJnqTZmiuIIQidSzm4PujgS1mGaIpIo11kIjeN9NjTGs+5a4bQB8uv8I+UDm8B W/RvQpq5EdLT9mzyUmzo9fiM6Ji+470M9H2AczvAmJS+zP7nnGqVYJghTGSBMJnj6ysqRR4cvL6 rw/Frv+O79633/xXZjZPGSwbnhY6aI9jjvcJByKhi7IUQwxLpfKzQKDeol+Cq70ZDkd1TnHKQ4f hPJa81b0g4P0ye0Z02w== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-16_03,2026-04-13_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 adultscore=0 suspectscore=0 spamscore=0 malwarescore=0 bulkscore=0 impostorscore=0 phishscore=0 clxscore=1015 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604070000 definitions=main-2604160110 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=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.168.131; envelope-from=matheus.bernardino@oss.qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1776339626723154100 Content-Type: text/plain; charset="utf-8" Add HVX IEEE bfloat16 (bf16) instructions: Arithmetic operations: - V6_vadd_sf_bf, V6_vsub_sf_bf: add/sub bf16 widening to sf output - V6_vmpy_sf_bf: multiply bf16 widening to sf output - V6_vmpy_sf_bf_acc: multiply-accumulate bf16 widening to sf output Min/Max operations: - V6_vmin_bf, V6_vmax_bf: bf16 min/max Comparison operations: - V6_vgtbf: greater-than compare - V6_vgtbf_and, V6_vgtbf_or, V6_vgtbf_xor: predicate variants Conversion operations: - V6_vcvt_bf_sf: convert sf to bf16 Reviewed-by: Taylor Simpson Signed-off-by: Matheus Tavares Bernardino --- target/hexagon/mmvec/hvx_ieee_fp.h | 37 ++++++++++++ target/hexagon/mmvec/macros.h | 4 ++ target/hexagon/mmvec/mmvec.h | 1 + target/hexagon/imported/mmvec/encode_ext.def | 15 +++++ target/hexagon/imported/mmvec/ext.idef | 62 ++++++++++++++++++++ 5 files changed, 119 insertions(+) diff --git a/target/hexagon/mmvec/hvx_ieee_fp.h b/target/hexagon/mmvec/hvx_= ieee_fp.h index 01728121eb..b7e379b089 100644 --- a/target/hexagon/mmvec/hvx_ieee_fp.h +++ b/target/hexagon/mmvec/hvx_ieee_fp.h @@ -9,8 +9,11 @@ =20 #include "fpu/softfloat.h" =20 +#define FP32_DEF_NAN 0x7FFFFFFF + #define f16_to_f32(A) float16_to_float32((A), true, &env->hvx_fp_status) #define f32_to_f16(A) float32_to_float16((A), true, &env->hvx_fp_status) +#define bf16_to_f32(A) bfloat16_to_float32(A, &env->hvx_fp_status) =20 float32 fp_mult_sf_hf(float16 a1, float16 a2, float_status *fp_status); float32 fp_vdmpy(float16 a1, float16 a2, float16 a3, float16 a4, @@ -29,4 +32,38 @@ int16_t conv_h_hf(float16 a, float_status *fp_status); uint32_t cmpgt_sf(float32 a1, float32 a2, float_status *fp_status); uint16_t cmpgt_hf(float16 a1, float16 a2, float_status *fp_status); =20 +/* IEEE BFloat instructions */ + +#define fp_mult_sf_bf(A, B) \ + float32_mul(bf16_to_f32(A), bf16_to_f32(B), &env->hvx_fp_status) + +#define fp_add_sf_bf(A, B) \ + float32_add(bf16_to_f32(A), bf16_to_f32(B), &env->hvx_fp_status) + +#define fp_sub_sf_bf(A, B) \ + float32_sub(bf16_to_f32(A), bf16_to_f32(B), &env->hvx_fp_status) + +#define fp_mult_sf_bf_acc(f1, f2, f3) \ + float32_muladd(bf16_to_f32(f1), bf16_to_f32(f2), f3, 0, &env->hvx_fp_s= tatus) + +static inline bfloat16 f32_to_bf16(float32 A, float_status *fp_status) +{ + uint32_t rslt =3D A; + if ((rslt & 0x1FFFF) =3D=3D 0x08000) { + /* do not round up if exactly .5 and even already */ + } else if ((rslt & 0x8000) =3D=3D 0x8000) { + rslt +=3D 0x8000; /* rounding to nearest number */ + } + rslt =3D float32_is_any_nan(A) ? FP32_DEF_NAN : rslt; + return float32_to_bfloat16(rslt, fp_status); +} + +#define fp_min_bf(A, B) \ + f32_to_bf16(float32_min(bf16_to_f32(A), bf16_to_f32(B), &env->hvx_fp_s= tatus), \ + &env->hvx_fp_status); + +#define fp_max_bf(A, B) \ + f32_to_bf16(float32_max(bf16_to_f32(A), bf16_to_f32(B), &env->hvx_fp_s= tatus), \ + &env->hvx_fp_status); + #endif diff --git a/target/hexagon/mmvec/macros.h b/target/hexagon/mmvec/macros.h index 318d44efb7..4945a61194 100644 --- a/target/hexagon/mmvec/macros.h +++ b/target/hexagon/mmvec/macros.h @@ -25,6 +25,9 @@ #include "accel/tcg/probe.h" #include "mmvec/hvx_ieee_fp.h" =20 +#define fBFLOAT() +#define fCVI_VX_NO_TMP_LD() + #ifndef QEMU_GENERATE #define VdV (*(MMVector *restrict)(VdV_void)) #define VsV (*(MMVector *restrict)(VsV_void)) @@ -358,5 +361,6 @@ =20 #define fCMPGT_SF(A, B) cmpgt_sf(A, B, &env->hvx_fp_status) #define fCMPGT_HF(A, B) cmpgt_hf(A, B, &env->hvx_fp_status) +#define fCMPGT_BF(A, B) fCMPGT_SF((uint32_t)(A) << 16, (uint32_t)(B) << 16) =20 #endif diff --git a/target/hexagon/mmvec/mmvec.h b/target/hexagon/mmvec/mmvec.h index 31909303b5..ab991471b1 100644 --- a/target/hexagon/mmvec/mmvec.h +++ b/target/hexagon/mmvec/mmvec.h @@ -40,6 +40,7 @@ typedef union { int8_t b[MAX_VEC_SIZE_BYTES / 1]; float32 sf[MAX_VEC_SIZE_BYTES / 4]; float16 hf[MAX_VEC_SIZE_BYTES / 2]; + bfloat16 bf[MAX_VEC_SIZE_BYTES / 2]; } MMVector; =20 typedef union { diff --git a/target/hexagon/imported/mmvec/encode_ext.def b/target/hexagon/= imported/mmvec/encode_ext.def index 3572e4de4c..16f043b77d 100644 --- a/target/hexagon/imported/mmvec/encode_ext.def +++ b/target/hexagon/imported/mmvec/encode_ext.def @@ -868,4 +868,19 @@ DEF_ENC(V6_vgthf_or,"00011100100vvvvvPP1uuuuu001101xx") DEF_ENC(V6_vgtsf_xor,"00011100100vvvvvPP1uuuuu111010xx") DEF_ENC(V6_vgthf_xor,"00011100100vvvvvPP1uuuuu111011xx") =20 +/* BFLOAT instructions */ +DEF_ENC(V6_vmpy_sf_bf,"00011101010vvvvvPP1uuuuu100ddddd") +DEF_ENC(V6_vmpy_sf_bf_acc,"00011101000vvvvvPP1uuuuu000xxxxx") +DEF_ENC(V6_vadd_sf_bf,"00011101010vvvvvPP1uuuuu110ddddd") +DEF_ENC(V6_vsub_sf_bf,"00011101010vvvvvPP1uuuuu101ddddd") +DEF_ENC(V6_vmax_bf,"00011101010vvvvvPP1uuuuu111ddddd") +DEF_ENC(V6_vmin_bf,"00011101010vvvvvPP1uuuuu000ddddd") +DEF_ENC(V6_vcvt_bf_sf,"00011101010vvvvvPP1uuuuu011ddddd") + +/* BFLOAT compare instructions */ +DEF_ENC(V6_vgtbf,"00011100100vvvvvPP1uuuuu011110dd") +DEF_ENC(V6_vgtbf_and,"00011100100vvvvvPP1uuuuu110100xx") +DEF_ENC(V6_vgtbf_or,"00011100100vvvvvPP1uuuuu001110xx") +DEF_ENC(V6_vgtbf_xor,"00011100100vvvvvPP1uuuuu111100xx") + #endif /* NO MMVEC */ diff --git a/target/hexagon/imported/mmvec/ext.idef b/target/hexagon/import= ed/mmvec/ext.idef index a7043d598c..857aa6133f 100644 --- a/target/hexagon/imported/mmvec/ext.idef +++ b/target/hexagon/imported/mmvec/ext.idef @@ -3163,6 +3163,15 @@ ITERATOR_INSN_SHIFT_SLOT_FLT(16, vconv_hf_h,"Vd32.hf= =3DVu32.h", } \ } =20 +#define VCMPGT_BF(DEST, ASRC, ASRCOP, CMP, N, SRC, MASK, WIDTH) \ +{ \ + fBFLOAT(); \ + for (fHIDE(int) i =3D 0; i < fVBYTES(); i +=3D WIDTH) { \ + fHIDE(int) VAL =3D fCMPGT_BF(VuV.SRC[i/WIDTH],VvV.SRC[i/WIDTH]) ? = MASK : 0; \ + fSETQBITS(DEST,WIDTH,MASK,i,ASRC ASRCOP VAL); \ + } \ +} + /* Vector SF compare */ #define MMVEC_CMPGT_SF(TYPE,TYPE2,DESCR,N,MASK,WIDTH,SRC) \ EXTINSN(V6_vgt##TYPE##_and, "Qx4&=3Dvcmp.gt(Vu32." TYPE2 ",Vv32." TYPE= 2 ")", \ @@ -3201,8 +3210,61 @@ ITERATOR_INSN_SHIFT_SLOT_FLT(16, vconv_hf_h,"Vd32.hf= =3DVu32.h", DESCR" greater than", \ VCMPGT_HF(QdV, , , ">", N, SRC, MASK, WIDTH)) =20 +/* Vector BF compare */ +#define MMVEC_CMPGT_BF(TYPE,TYPE2,DESCR,N,MASK,WIDTH,SRC) \ + EXTINSN(V6_vgt##TYPE##_and, "Qx4&=3Dvcmp.gt(Vu32." TYPE2 ",Vv32." TYPE= 2 ")",\ + ATTRIBS(A_EXTENSION,A_CVI,A_CVI_VA,A_CVI_VA_2SRC,A_HVX_FLT), \ + DESCR" greater than with predicate-and", \ + VCMPGT_BF(QxV, fGETQBITS(QxV,WIDTH,MASK,i), &, ">", N, SRC, MASK, = WIDTH)) \ + EXTINSN(V6_vgt##TYPE##_xor, "Qx4^=3Dvcmp.gt(Vu32." TYPE2 ",Vv32." TYPE= 2 ")", \ + ATTRIBS(A_EXTENSION,A_CVI,A_CVI_VA,A_CVI_VA_2SRC,A_HVX_FLT), \ + DESCR" greater than with predicate-xor", \ + VCMPGT_BF(QxV, fGETQBITS(QxV,WIDTH,MASK,i), ^, ">", N, SRC, MASK, = WIDTH)) \ + EXTINSN(V6_vgt##TYPE##_or, "Qx4|=3Dvcmp.gt(Vu32." TYPE2 ",Vv32." TYPE2= ")", \ + ATTRIBS(A_EXTENSION,A_CVI,A_CVI_VA,A_CVI_VA_2SRC,A_HVX_FLT), \ + DESCR" greater than with predicate-or", \ + VCMPGT_BF(QxV, fGETQBITS(QxV,WIDTH,MASK,i), |, ">", N, SRC, MASK, = WIDTH)) \ + EXTINSN(V6_vgt##TYPE, "Qd4=3Dvcmp.gt(Vu32." TYPE2 ",Vv32." TYPE2 ")", \ + ATTRIBS(A_EXTENSION,A_CVI,A_CVI_VA,A_CVI_VA_2SRC,A_HVX_FLT), \ + DESCR" greater than", \ + VCMPGT_BF(QdV, , , ">", N, SRC, MASK, WIDTH)) + MMVEC_CMPGT_SF(sf,"sf","Vector sf Compare ", fVELEM(32), 0xF, 4, sf) MMVEC_CMPGT_HF(hf,"hf","Vector hf Compare ", fVELEM(16), 0x3, 2, hf) +MMVEC_CMPGT_BF(bf,"bf","Vector bf Compare ", fVELEM(16), 0x3, 2, bf) + +/*************************************************************************= ***** + BFloat arithmetic and max/min instructions + *************************************************************************= *****/ + +ITERATOR_INSN_IEEE_FP_DOUBLE_32(32, vadd_sf_bf, + "Vdd32.sf=3Dvadd(Vu32.bf,Vv32.bf)", "Vector IEEE add: bf widen to sf", + VddV.v[0].sf[i] =3D fp_add_sf_bf(VuV.bf[2*i], VvV.bf[2*i]); + VddV.v[1].sf[i] =3D fp_add_sf_bf(VuV.bf[2*i+1], VvV.bf[2*i+1]); fBFLOA= T()) +ITERATOR_INSN_IEEE_FP_DOUBLE_32(32, vsub_sf_bf, + "Vdd32.sf=3Dvsub(Vu32.bf,Vv32.bf)", "Vector IEEE sub: bf widen to sf", + VddV.v[0].sf[i] =3D fp_sub_sf_bf(VuV.bf[2*i], VvV.bf[2*i]); + VddV.v[1].sf[i] =3D fp_sub_sf_bf(VuV.bf[2*i+1], VvV.bf[2*i+1]); fBFLOA= T()) +ITERATOR_INSN_IEEE_FP_DOUBLE_32(32, vmpy_sf_bf, + "Vdd32.sf=3Dvmpy(Vu32.bf,Vv32.bf)", "Vector IEEE mul: hf widen to sf", + VddV.v[0].sf[i] =3D fp_mult_sf_bf(VuV.bf[2*i], VvV.bf[2*i]); + VddV.v[1].sf[i] =3D fp_mult_sf_bf(VuV.bf[2*i+1], VvV.bf[2*i+1]); fBFLO= AT()) +ITERATOR_INSN_IEEE_FP_DOUBLE_32(32, vmpy_sf_bf_acc, + "Vxx32.sf+=3Dvmpy(Vu32.bf,Vv32.bf)", "Vector IEEE fma: hf widen to sf", + VxxV.v[0].sf[i] =3D fp_mult_sf_bf_acc(VuV.bf[2*i], VvV.bf[2*i], VxxV.v= [0].sf[i]); + VxxV.v[1].sf[i] =3D fp_mult_sf_bf_acc(VuV.bf[2*i+1], VvV.bf[2*i+1], Vx= xV.v[1].sf[i]); + fCVI_VX_NO_TMP_LD(); fBFLOAT()) +ITERATOR_INSN_IEEE_FP_16(32, vcvt_bf_sf, + "Vd32.bf=3Dvcvt(Vu32.sf,Vv32.sf)", "Vector IEEE cvt: sf to bf", + VdV.bf[2*i] =3D f32_to_bf16(VuV.sf[i], &env->hvx_fp_status); + VdV.bf[2*i+1] =3D f32_to_bf16(VvV.sf[i], &env->hvx_fp_status); fBFLOAT= ()) + +ITERATOR_INSN_IEEE_FP_16_32_LATE(16, vmax_bf, "Vd32.bf=3Dvmax(Vu32.bf,Vv32= .bf)", + "Vector IEEE max: bf", VdV.bf[i] =3D fp_max_bf(VuV.bf[i], VvV.bf[i]); + fBFLOAT()) +ITERATOR_INSN_IEEE_FP_16_32_LATE(16, vmin_bf, "Vd32.bf=3Dvmin(Vu32.bf,Vv32= .bf)", + "Vector IEEE min: bf", VdV.bf[i] =3D fp_min_bf(VuV.bf[i], VvV.bf[i]); + fBFLOAT()) =20 /*************************************************************************= ***** DEBUG Vector/Register Printing --=20 2.37.2 From nobody Sat May 30 20:11:22 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1776339694; cv=none; d=zohomail.com; s=zohoarc; b=epYHKljPnIqGXPpnCjsNj16fIBBJsb0xwm+1E0tu8JxGY4C16aTBShJKI+5jzInbokgfrX4mMPHVmRx/TXlmDsPCUaoTn1LabIFG1iqg63X6FYgBWbQQ7JOi/c8lYn5esCBqjQ2UrEjEmKKodk3ynjmINYvvm2vsvSVnRIKmg5s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776339694; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=uJr3Gr7KYqMD1GbUrDqXbuYTqiUZbXBU2TT7eZ+R0bU=; b=SmgEUGQAfRI/AtDagWISPZ+SrmTXkYxU1rkBSNcVQglK7f5N+d/1m7waYQsjPWt6WaKVEYoxkTBD25rG53fLo+RWzuNNadI8pPoAk/APRhmr8xnmhbPHht8heIozdD+kEHHWMwk0CSvP8JcVKTnrTNWxILEhOCzVgmes2ysCBXM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776339694742642.5071546370345; Thu, 16 Apr 2026 04:41:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wDL4T-0005GS-4b; Thu, 16 Apr 2026 07:39:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wDL4L-00059D-W2 for qemu-devel@nongnu.org; Thu, 16 Apr 2026 07:39:38 -0400 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wDL4J-0003Bw-Al for qemu-devel@nongnu.org; Thu, 16 Apr 2026 07:39:37 -0400 Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 63G9MsGX1553030 for ; Thu, 16 Apr 2026 11:39:22 GMT Received: from mail-dy1-f198.google.com (mail-dy1-f198.google.com [74.125.82.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4djrsn9g98-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 16 Apr 2026 11:39:22 +0000 (GMT) Received: by mail-dy1-f198.google.com with SMTP id 5a478bee46e88-2d889997495so17865505eec.0 for ; Thu, 16 Apr 2026 04:39:22 -0700 (PDT) Received: from hu-mathbern-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2de8c10a65asm6845391eec.6.2026.04.16.04.39.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Apr 2026 04:39:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=uJr3Gr7KYqM D1GbUrDqXbuYTqiUZbXBU2TT7eZ+R0bU=; b=AHgoMIIP0Io61zDT4XtO9yCzFF+ ja0LNC41if+MltEK8a/seqJTiMAhjfGM0vdLGBbAh5ndcSqk28EDIA7iWKFbRC5l otqlfZbUooa7quLPyOHmoZ0NRj0Fz6lGyJcVqrSVEneHJmx64nP0pgNEUa98nTe2 zW/dD2HRrqZrmgW54c6TtXcUpjOWY2ocFwlHLfN1OzEPTp28EQMlxNS7F7Wa4A5e BdbXR/pZ5itg3Y0QMSV/h6tsrxQ9LDSY1xevd5jt1PlsPmZYv5tlxZ+ZcD8Yf6ul bX7JwhCADDyfg7xX+0ne2PQxZTVCeCo+NjQRBXkZBWCO+OYaqOiR+BR8hwQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1776339562; x=1776944362; darn=nongnu.org; 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=uJr3Gr7KYqMD1GbUrDqXbuYTqiUZbXBU2TT7eZ+R0bU=; b=X1/uZJgGFxBGNViCLmAovEJ3lyKcab7DVhi3VNBrg1TxvuBHsRznKwZsimut8Owhtn BE3RpKfVH2b0jDbxf/413UuJRgO0/dcK0+orXJaBQQFL4zvsk+tyK+oE/1rhKNyU30+8 vvZcvfpLCDr+UAenEI4730/ATraS/R5SHKkgM8hLi15IJSrbRP+NhozFsUl3nqyywy6F 9a2g2gxYFNaC6+yhg80FsvkNyrYMeptr3fp6qDxzv/g16J32M44Uv463PTC5AmfOssm2 Evf+bSEuRABbC58G8ZJLMAlhGjByBbMne2sk9oGCgf77aJNJByGzqs+rBvxZ4rYmRSEG c5tA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776339562; x=1776944362; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=uJr3Gr7KYqMD1GbUrDqXbuYTqiUZbXBU2TT7eZ+R0bU=; b=B79eY7vLm3aWAAYgKWKiR74YH1VO//KuDvCtIrwgeQhcnlygfl3/euNIn51yOwBsSX nwc+tuv6quX4MpIlQfbB0zYt3k0Tc5X2Tpy55Pf/iL1eMIgxfbMP9awtHrw8Z1B6+KgS ICIAgq0vAgW4OodI8gstPhZix0EmS5ZGRilogfwaXO90CN/kp08T9M+SQXz9CUsEp0NN BkzlhsDQjIRzkp3wkyHZWt3rO+KFkize+2pSIIXLD3mB9jyrVc83WwstuJobw7R6YzxW rTFXPTfuOeQAHTqsIXk2yhIZMSj/b8Kly8eELW2lwH8q1+7pvPsdv2QES5mMJKkGlAKo 5RlA== X-Gm-Message-State: AOJu0YwCAsalVcHMjG8QAkS1/GIZNolw4Fz3K1PZ7ecmr59k22AXmNYw 1EmPIebBzdHsCwz3uejTjv+h65CpFpGwomwmrtLz5g/cRQXyNVlmUg4Hza8frlEsz2mI0OWMUwl GWCKpK4iPdK9hmgM9wMay0Pgk6Nhbjn2hB0M6xyjflpBTYdBLPtdJzHfAtpvMgT4FWdjI X-Gm-Gg: AeBDietjOWbse7+yZL5vJYt1UAWkv6N84065BeYRiAPVxkaYoxld2c2e5rgetGbHyvx 9L4HRwub+PhQkV0ng2kfIjLB7asa+QwlLl4VETEzORbAsxvs58FiCCJg3eenKJsuFYs/MNJo10O CWyJNOsLqirzAx31myFB5VfaWLNc7S/WWaA3f99Tm4W0HunsqzrgofRsI4b6xRU6KHLydUSpnFu l3e0Vh0FGK6dCO2xrjrorPx9M6YS7NM6sJmvESFocwYsVQs986GG0BgVlx2Qdq6c9tSEdXFx0vK EwO9cCOQaYakz7a8tRtChALfplgvYJ2GuRJJm5c/wSbIqgNYI+QuVF8IZ+kA8aFVyZSaCHPE8sF TvwdaNjSn++mn+0KhiH8RnfGlb9E1YFrJFdIsXXzD1N0EqBM++VyYOSzQNdZJsibEzXRbBJ38rZ 0ZoSkjKvFbOZdq1Jdsr30= X-Received: by 2002:a05:7301:2b89:b0:2d3:f43c:d684 with SMTP id 5a478bee46e88-2d586384048mr14536644eec.2.1776339561676; Thu, 16 Apr 2026 04:39:21 -0700 (PDT) X-Received: by 2002:a05:7301:2b89:b0:2d3:f43c:d684 with SMTP id 5a478bee46e88-2d586384048mr14536614eec.2.1776339561010; Thu, 16 Apr 2026 04:39:21 -0700 (PDT) From: Matheus Tavares Bernardino To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, ale@rev.ng, anjo@rev.ng, brian.cain@oss.qualcomm.com, ltaylorsimpson@gmail.com, marco.liebel@oss.qualcomm.com, philmd@linaro.org, quic_mburton@quicinc.com, sid.manning@oss.qualcomm.com Subject: [PATCH v5 12/16] tests/hexagon: add tests for v68 HVX IEEE float arithmetics Date: Thu, 16 Apr 2026 04:39:01 -0700 Message-Id: <791f122bfd744a77177608b524d852fe826cd595.1776339451.git.matheus.bernardino@oss.qualcomm.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: ifgLuhE8HA2e3hse693Zdipa9vDVtkPB X-Proofpoint-GUID: ifgLuhE8HA2e3hse693Zdipa9vDVtkPB X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDE2MDExMCBTYWx0ZWRfXxTV9hW+/PbU+ x35TdKCPdPKM5k6VLdGFB0enzKzX3seeKTbzoQtEuPii+oLELw3Q/v7uHDrBtbKhQWMonTsO3WP mK1oqTAN+HJnvxCyC7TBgj4NhBxDmHVYhxF2x5EVgRTmSGRyZXY4pu7EJuv1rMx+NUdfvNXUP0q oK1kXSzmhAIxtP0vC9Dqm5DwERBXi4UIE8A7PliBRW1eh7/adaNwBeaSRvdBYlLnekZusum0H0x tX64vZPJPiGIXFV2Reabn+Xgi0HPBy1WntAFxFKS1c766BND8ekvoV5fM/9rNwVMz76F51AnJY5 i04M/fxG7t4ns5Mx9DdxC5FJFQpAjMifSAkEgRe9sdsiKzj+K6Nc+90W58pD023ALx/vXTOMKIB EKGxIniyjo2Zk88rm/8dzzjCbZsa+ZIpaRIjmUXq/vLAFJ+N4eo1gc8D7za6OVSrClLB/hx509F zSNyIgwt2C6xaAGlnGg== X-Authority-Analysis: v=2.4 cv=EojiaycA c=1 sm=1 tr=0 ts=69e0ca6a cx=c_pps a=wEP8DlPgTf/vqF+yE6f9lg==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yOCtJkima9RkubShWh1s:22 a=pGLkceISAAAA:8 a=EUspDBNiAAAA:8 a=p626gilfWeCCYUnsPZkA:9 a=bBxd6f-gb0O0v-kibOvt:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-16_03,2026-04-13_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 bulkscore=0 adultscore=0 spamscore=0 phishscore=0 impostorscore=0 suspectscore=0 lowpriorityscore=0 malwarescore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604070000 definitions=main-2604160110 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=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.168.131; envelope-from=matheus.bernardino@oss.qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1776339696143158500 Content-Type: text/plain; charset="utf-8" Reviewed-by: Taylor Simpson Signed-off-by: Matheus Tavares Bernardino --- tests/tcg/hexagon/hex_test.h | 4 + tests/tcg/hexagon/hvx_misc.h | 41 ++++++++ tests/tcg/hexagon/fp_hvx.c | 155 ++++++++++++++++++++++++++++ tests/tcg/hexagon/fp_hvx_disabled.c | 57 ++++++++++ tests/tcg/hexagon/Makefile.target | 8 ++ 5 files changed, 265 insertions(+) create mode 100644 tests/tcg/hexagon/fp_hvx.c create mode 100644 tests/tcg/hexagon/fp_hvx_disabled.c diff --git a/tests/tcg/hexagon/hex_test.h b/tests/tcg/hexagon/hex_test.h index cfed06a58b..e7a6644d41 100644 --- a/tests/tcg/hexagon/hex_test.h +++ b/tests/tcg/hexagon/hex_test.h @@ -19,6 +19,8 @@ #ifndef HEX_TEST_H #define HEX_TEST_H =20 +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) + static inline void __check32(int line, uint32_t val, uint32_t expect) { if (val !=3D expect) { @@ -110,6 +112,7 @@ static inline void __check64_ne(int line, uint64_t val,= uint64_t expect) =20 /* Some useful floating point values */ const uint32_t SF_INF =3D 0x7f800000; +const uint32_t SF_INF_neg =3D 0xff800000; const uint32_t SF_QNaN =3D 0x7fc00000; const uint32_t SF_QNaN_special =3D 0x7f800001; const uint32_t SF_SNaN =3D 0x7fb00000; @@ -128,6 +131,7 @@ const uint32_t SF_large_pos =3D 0x5afa572e; const uint32_t SF_any =3D 0x3f800000; const uint32_t SF_denorm =3D 0x00000001; const uint32_t SF_random =3D 0x346001d6; +const uint32_t SF_neg_two =3D 0xc0000000; =20 const uint64_t DF_QNaN =3D 0x7ff8000000000000ULL; const uint64_t DF_SNaN =3D 0x7ff7000000000000ULL; diff --git a/tests/tcg/hexagon/hvx_misc.h b/tests/tcg/hexagon/hvx_misc.h index 2e868340fd..0330cb289d 100644 --- a/tests/tcg/hexagon/hvx_misc.h +++ b/tests/tcg/hexagon/hvx_misc.h @@ -18,6 +18,8 @@ #ifndef HVX_MISC_H #define HVX_MISC_H =20 +#include "hex_test.h" + static inline void check(int line, int i, int j, uint64_t result, uint64_t expect) { @@ -34,8 +36,10 @@ typedef union { uint64_t ud[MAX_VEC_SIZE_BYTES / 8]; int64_t d[MAX_VEC_SIZE_BYTES / 8]; uint32_t uw[MAX_VEC_SIZE_BYTES / 4]; + uint32_t sf[MAX_VEC_SIZE_BYTES / 4]; /* convenience alias */ int32_t w[MAX_VEC_SIZE_BYTES / 4]; uint16_t uh[MAX_VEC_SIZE_BYTES / 2]; + uint16_t hf[MAX_VEC_SIZE_BYTES / 2]; /* convenience alias */ int16_t h[MAX_VEC_SIZE_BYTES / 2]; uint8_t ub[MAX_VEC_SIZE_BYTES / 1]; int8_t b[MAX_VEC_SIZE_BYTES / 1]; @@ -63,7 +67,9 @@ static inline void check_output_##FIELD(int line, size_t = num_vectors) \ =20 CHECK_OUTPUT_FUNC(d, 8) CHECK_OUTPUT_FUNC(w, 4) +CHECK_OUTPUT_FUNC(sf, 4) CHECK_OUTPUT_FUNC(h, 2) +CHECK_OUTPUT_FUNC(hf, 2) CHECK_OUTPUT_FUNC(b, 1) =20 static inline void init_buffers(void) @@ -81,6 +87,33 @@ static inline void init_buffers(void) } } =20 +static const uint32_t FP_VALUES[] =3D { + SF_INF, SF_INF_neg, SF_QNaN, SF_QNaN_special, SF_SNaN, SF_QNaN_neg, + SF_SNaN_neg, SF_HEX_NaN, SF_zero, SF_zero_neg, SF_one, SF_one_recip, + SF_one_invsqrta, SF_two, SF_four, SF_small_neg, SF_large_pos, SF_any, + SF_denorm, SF_random, SF_neg_two, +}; +#define FP_VALUES_MAX ARRAY_SIZE(FP_VALUES) + +static inline void init_buffers_fp(void) +{ + _Static_assert(BUFSIZE * (MAX_VEC_SIZE_BYTES / 4) > + FP_VALUES_MAX * FP_VALUES_MAX, + "test arrays can't fit all FP_VALUES combinations"); + int counter1 =3D 0, counter2 =3D 0; + for (int i =3D 0; i < BUFSIZE; i++) { + for (int j =3D 0; j < MAX_VEC_SIZE_BYTES / 4; j++) { + buffer0[i].sf[j] =3D FP_VALUES[counter1]; + buffer1[i].sf[j] =3D FP_VALUES[counter2]; + counter2++; + if (counter2 =3D=3D FP_VALUES_MAX) { + counter2 =3D 0; + counter1 =3D (counter1 + 1) % FP_VALUES_MAX; + } + } + } +} + #define VEC_OP1(ASM, EL, IN, OUT) \ asm("v2 =3D vmem(%0 + #0)\n\t" \ "v2" #EL " =3D " #ASM "(v2" #EL ")\n\t" \ @@ -175,4 +208,12 @@ static inline void test_##NAME(bool invert) \ check_output_b(__LINE__, BUFSIZE); \ } =20 +#define float_sf(x) ({ typeof(x) _x =3D (x); *((float *)&(_x)); }) +#define float_hf(x) ({ typeof(x) _x =3D (x); *((_Float16 *) &(_x)); }) +#define raw_sf(x) ({ typeof(x) _x =3D (x); *((uint32_t *)&(_x)); }) +#define raw_hf(x) ({ typeof(x) _x =3D (x); *((uint16_t *)&(_x)); }) +#define float_hf_to_sf(x) ((float)x) +#define bytes_hf 2 +#define bytes_sf 4 + #endif diff --git a/tests/tcg/hexagon/fp_hvx.c b/tests/tcg/hexagon/fp_hvx.c new file mode 100644 index 0000000000..a309654ed7 --- /dev/null +++ b/tests/tcg/hexagon/fp_hvx.c @@ -0,0 +1,155 @@ +/* + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include +#include +#include +#include +#include +#include + +int err; +#include "hvx_misc.h" + +#if __HEXAGON_ARCH__ > 75 +#error "After v75, compiler will replace some FP HVX instructions." +#endif + +/*************************************************************************= ***** + * NAN handling + *************************************************************************= ****/ + +#define isnan(X) \ + (sizeof(X) =3D=3D bytes_hf ? ((raw_hf(X) & ~0x8000) > 0x7c00) : \ + ((raw_sf(X) & ~(1 << 31)) > 0x7f800000UL)) + +#define CHECK_NAN(A, DEF_NAN) (isnan(A) ? DEF_NAN : (A)) +#define NAN_SF float_sf(0x7FFFFFFF) +#define NAN_HF float_hf(0x7FFF) + +/*************************************************************************= ***** + * Binary operations + *************************************************************************= ****/ + +#define DEF_TEST_OP_2(vop, op, type_res, type_arg) \ + static void test_##vop##_##type_res##_##type_arg(void) \ + { \ + memset(expect, 0xff, sizeof(expect)); \ + memset(output, 0xff, sizeof(output)); \ + for (int i =3D 0; i < BUFSIZE; i++) { \ + HVX_Vector *hvx_output =3D (HVX_Vector *)&output[i]; \ + HVX_Vector hvx_buffer0 =3D *(HVX_Vector *)&buffer0[i]; \ + HVX_Vector hvx_buffer1 =3D *(HVX_Vector *)&buffer1[i]; \ + *hvx_output =3D \ + Q6_V##type_res##_##vop##_V##type_arg##V##type_arg(hvx_buff= er0, \ + hvx_buff= er1); \ + for (int j =3D 0; j < MAX_VEC_SIZE_BYTES / bytes_##type_res; j= ++) { \ + expect[i].type_res[j] =3D \ + raw_##type_res(op(float_##type_arg(buffer0[i].type_arg= [j]), \ + float_##type_arg(buffer1[i].type_arg= [j]))); \ + } \ + } \ + check_output_##type_res(__LINE__, BUFSIZE); \ + } + +#define SUM(X, Y, DEF_NAN) CHECK_NAN((X) + (Y), DEF_NAN) +#define SUB(X, Y, DEF_NAN) CHECK_NAN((X) - (Y), DEF_NAN) +#define MULT(X, Y, DEF_NAN) CHECK_NAN((X) * (Y), DEF_NAN) + +#define SUM_SF(X, Y) SUM(X, Y, NAN_SF) +#define SUM_HF(X, Y) SUM(X, Y, NAN_HF) +#define SUB_SF(X, Y) SUB(X, Y, NAN_SF) +#define SUB_HF(X, Y) SUB(X, Y, NAN_HF) +#define MULT_SF(X, Y) MULT(X, Y, NAN_SF) +#define MULT_HF(X, Y) MULT(X, Y, NAN_HF) + +DEF_TEST_OP_2(vadd, SUM_SF, sf, sf); +DEF_TEST_OP_2(vadd, SUM_HF, hf, hf); +DEF_TEST_OP_2(vsub, SUB_SF, sf, sf); +DEF_TEST_OP_2(vsub, SUB_HF, hf, hf); +DEF_TEST_OP_2(vmpy, MULT_SF, sf, sf); +DEF_TEST_OP_2(vmpy, MULT_HF, hf, hf); + +/*************************************************************************= ***** + * Other tests + *************************************************************************= ****/ + +static void test_vdmpy_sf_hf(bool acc) +{ + memset(expect, 0xff, sizeof(expect)); + + for (int i =3D 0; i < BUFSIZE; i++) { + HVX_Vector hvx_buffer0 =3D *(HVX_Vector *)&buffer0[i]; + HVX_Vector hvx_buffer1 =3D *(HVX_Vector *)&buffer1[i]; + HVX_Vector *hvx_output =3D (HVX_Vector *)&output[i]; + + uint32_t PREFIL_VAL =3D 0x111222; + *hvx_output =3D Q6_V_vsplat_R(PREFIL_VAL); + + if (!acc) { + *hvx_output =3D Q6_Vsf_vdmpy_VhfVhf(hvx_buffer0, hvx_buffer1); + } else { + *hvx_output =3D Q6_Vsf_vdmpyacc_VsfVhfVhf(*hvx_output, hvx_buf= fer0, + hvx_buffer1); + } + + for (int j =3D 0; j < MAX_VEC_SIZE_BYTES / 4; j++) { + float a1 =3D float_hf_to_sf(float_hf(buffer0[i].hf[2 * j + 1])= ); + float a2 =3D float_hf_to_sf(float_hf(buffer0[i].hf[2 * j])); + float a3 =3D float_hf_to_sf(float_hf(buffer1[i].hf[2 * j + 1])= ); + float a4 =3D float_hf_to_sf(float_hf(buffer1[i].hf[2 * j])); + /* + * Note, IEEE FP specifies +0.0 + -0.0 =3D=3D +0.0. So we use = -0.0 in + * the default case to preserve the zero sign. + */ + float prev =3D acc ? float_sf(PREFIL_VAL) : -0.0; + expect[i].sf[j] =3D raw_sf(CHECK_NAN((a1 * a3) + (a2 * a4) + p= rev, NAN_SF)); + } + } + check_output_sf(__LINE__, BUFSIZE); +} + +static void test_new(void) +{ + asm volatile("r0 =3D #%2\n" + "v0 =3D vsplat(r0)\n" + "vmem(%1 + #0) =3D v0\n" + "r1 =3D #%3\n" + "v1 =3D vsplat(r1)\n" + "v2 =3D vsplat(r1)\n" + "{\n" + " v0.sf =3D vadd(v1.sf, v2.sf)\n" + " vmem(%0 + #0) =3D v0.new\n" + "}\n" + : + : "r"(output), "r"(expect), "i"(SF_two), "i"(SF_one) + : "r0", "r1", "v0", "v1", "v2", "memory"); + check_output_w(__LINE__, 1); +} + +int main(void) +{ + init_buffers_fp(); + + /* add/sub */ + test_vadd_sf_sf(); + test_vadd_hf_hf(); + test_vsub_sf_sf(); + test_vsub_hf_hf(); + + /* multiply */ + test_vmpy_sf_sf(); + test_vmpy_hf_hf(); + + /* dot product */ + test_vdmpy_sf_hf(false); + test_vdmpy_sf_hf(true); + + test_new(); + + puts(err ? "FAIL" : "PASS"); + return err ? 1 : 0; +} diff --git a/tests/tcg/hexagon/fp_hvx_disabled.c b/tests/tcg/hexagon/fp_hvx= _disabled.c new file mode 100644 index 0000000000..388a42e2b7 --- /dev/null +++ b/tests/tcg/hexagon/fp_hvx_disabled.c @@ -0,0 +1,57 @@ +/* + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include +#include +#include +#include + +int err; +#include "hvx_misc.h" + +static void test_disabled(void) +{ + memset(output, 0xAA, sizeof(output)); + memset(expect, 0, sizeof(expect)); + asm volatile("r0 =3D #0xff\n" + "v0 =3D vsplat(r0)\n" + "r1 =3D #0x1\n" + "v1 =3D vsplat(r1)\n" + "v2 =3D vsplat(r1)\n" + "v0.sf =3D vadd(v1.sf, v2.sf)\n" + "vmem(%0 + #0) =3D v0\n" + : + : "r"(output) + : "r0", "r1", "v0", "v1", "v2", "memory"); + check_output_w(__LINE__, 1); +} + +static void test_disabled_with_new(void) +{ + memset(output, 0xAA, sizeof(output)); + memset(expect, 0, sizeof(expect)); + asm volatile("r0 =3D #0xff\n" + "v0 =3D vsplat(r0)\n" + "r1 =3D #0x1\n" + "v1 =3D vsplat(r1)\n" + "v2 =3D vsplat(r1)\n" + "{\n" + " v0.sf =3D vadd(v1.sf, v2.sf)\n" + " vmem(%0 + #0) =3D v0.new\n" + "}\n" + : + : "r"(output) + : "r0", "r1", "v0", "v1", "v2", "memory"); + check_output_w(__LINE__, 1); +} + +int main(void) +{ + test_disabled(); + test_disabled_with_new(); + puts(err ? "FAIL" : "PASS"); + return err ? 1 : 0; +} diff --git a/tests/tcg/hexagon/Makefile.target b/tests/tcg/hexagon/Makefile= .target index 549c95082f..afd3dd6d19 100644 --- a/tests/tcg/hexagon/Makefile.target +++ b/tests/tcg/hexagon/Makefile.target @@ -50,6 +50,8 @@ HEX_TESTS +=3D vector_add_int HEX_TESTS +=3D scatter_gather HEX_TESTS +=3D hvx_misc HEX_TESTS +=3D hvx_histogram +HEX_TESTS +=3D fp_hvx +HEX_TESTS +=3D fp_hvx_disabled HEX_TESTS +=3D invalid-slots HEX_TESTS +=3D invalid-encoding HEX_TESTS +=3D multiple-writes @@ -126,6 +128,12 @@ v68_hvx: CFLAGS +=3D -mhvx -Wno-unused-function v69_hvx: v69_hvx.c hvx_misc.h v69_hvx: CFLAGS +=3D -mhvx -Wno-unused-function v73_scalar: CFLAGS +=3D -Wno-unused-function +fp_hvx: fp_hvx.c hvx_misc.h hex_test.h +fp_hvx: CFLAGS +=3D -mhvx -mhvx-ieee-fp +fp_hvx_disabled: fp_hvx_disabled.c hvx_misc.h hex_test.h +fp_hvx_disabled: CFLAGS +=3D -mhvx -mhvx-ieee-fp + +run-fp_hvx_disabled: QEMU_OPTS +=3D -cpu v73,ieee-fp=3Dfalse =20 hvx_histogram: hvx_histogram.c hvx_histogram_row.S $(CC) $(CFLAGS) $(CROSS_CC_GUEST_CFLAGS) $^ -o $@ $(LDFLAGS) --=20 2.37.2 From nobody Sat May 30 20:11:22 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1776339594; cv=none; d=zohomail.com; s=zohoarc; b=C7DZIpEaootA/+KZ+Ra95XXmeEUz2yNZs8iyKXTEyB026oyPDFQp173FYBm6ctvKLXf7TT6O7EhDQNL0d5j510ODsMEAz7oDAIlXGa5r2qep4fz88n/ytGPlVVQs27f27ru6KcEBvBvzvb74FW1R0hntW89hgGpZpfBACqEUt24= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776339594; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=6rsaGe+qyX7aGhkX5jlvph/v3y8P3SaLT96OgXBeU9M=; b=fKUcpIKRJvDGUgFRpN4a2wIxeAeGjd0oMzRs5QAdXNN/rwjxdifji6jBJWYTobeWI+E7bAAnaRfirxGKkcslKzKS2FPViwAvihKFNHtvqFpQTZk2u1IYiyeIHmWmOTypQkxsqt/f+71YKqTmLTnJvg9Jx5iXFvnWj+tSpMOEPp8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776339594253988.6851354979317; Thu, 16 Apr 2026 04:39:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wDL4S-0005Fb-DF; Thu, 16 Apr 2026 07:39:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wDL4M-00059E-0D for qemu-devel@nongnu.org; Thu, 16 Apr 2026 07:39:38 -0400 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wDL4J-0003CA-J7 for qemu-devel@nongnu.org; Thu, 16 Apr 2026 07:39:37 -0400 Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 63G7uwDZ3733606 for ; Thu, 16 Apr 2026 11:39:23 GMT Received: from mail-dy1-f197.google.com (mail-dy1-f197.google.com [74.125.82.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4djcqwktxd-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 16 Apr 2026 11:39:23 +0000 (GMT) Received: by mail-dy1-f197.google.com with SMTP id 5a478bee46e88-2bda35eab74so506881eec.0 for ; Thu, 16 Apr 2026 04:39:23 -0700 (PDT) Received: from hu-mathbern-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2de8c10a65asm6845391eec.6.2026.04.16.04.39.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Apr 2026 04:39:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=6rsaGe+qyX7 aGhkX5jlvph/v3y8P3SaLT96OgXBeU9M=; b=ienhukkvG3Nntrb8JY9uofDWyts WFJyYN6f+XK1bGb0v40/Yx+1Ug4+BsLEE4VJo1tQkNtutQVYvUfYYRcjyrNU013v ix/4mQwqruKwdSlfNRRbG/uns42+Q4amREA1vw6U42GwW8v3X530fI4GE4klgs3g q0K7gpDse6lEKSJ4CCLQl8E/fCBfNEykcO6b19gK2kP/DIuYjtUaOL8zRkiv8a05 c1un0S647GhTsLV0nCHh0jtKBnEi63CJvVE0SJoKMUhTTwtPwT3eLsGKktnMMaX+ lwC4KNkNpuXqdjAjqLd0sjTyYa5saS6/Iufew3h6GO3tWmBXoFA5OIrFkZw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1776339563; x=1776944363; darn=nongnu.org; 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=6rsaGe+qyX7aGhkX5jlvph/v3y8P3SaLT96OgXBeU9M=; b=INaUl/g8XrMv3nZLDhyvcShiX08N7ZBMndUlxp6rPP7KHdAOMbRKXtcYqgLJWSOC3S JCzx3wcgMStSX119FbYdRuqNVq8NE59gdziZiasl6vDweRUdGpAmGKbyJ9TxHAqkArt+ 6O+AjlVtWcw2RYjmI3qtAtFvTlC+qWQi8y52GkEI6wZSh57egB2Loa1J1Ize4nhifkhO TAZkiznQkyeub171MiFkopno4dmKwk8uYE8WFCSDQlr6bdInKybahQ5AglJkclbVBszf k5u+eHs8Dmd5tiP2TsOnmBkmYkI+qWkOCdsws5RIED29r5icxxl3S8vuGwCZPp2nHgEG m+YA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776339563; x=1776944363; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=6rsaGe+qyX7aGhkX5jlvph/v3y8P3SaLT96OgXBeU9M=; b=KyM6bTLXWC2YGvg0A4oqhiXNhALPn4Ew+srWAMKBefSd8Ny+7Az9vN5+KDwSzKC/4l f3Wt45TWfVzG3lPjHUIw0moZNUNrkfwFEWhoiam77vmrAT9coF98omjq7R3XOqGevKQh +UszPPF64IaJkwcwEPpas8XVMMxCkHN4EIq2jVUjaM/d5N29+I9yF5A9TYKsF2r2V8Mw 1tSODlXD9HuzT5YB/RDkPWhf3FASi9HFcvfnoV0f7pmcdTEcUukAVMs2yeYXdjvtcCGD P/lTSfP6/Uc02VZ/7f/VW4K7BhSoPcs51ZGzY5P1WcJGzW8Pjg3Se4L6GRFFqTbPq0+G TfzA== X-Gm-Message-State: AOJu0Yw44/0yz2oc7sph05Oz8bpCjTruXIBscPF0ZWB4FfIHtdgJbBbV uN4s+IlzRAVoX7X7/BWuVliixvg3X2vImKA9gU6gwN/4rFNThaqRte5wa6tx5sQxQY23RcGS86a X9p/l50QTsOOIzgNS4sql1R2G6n0DdkpBfZcTkZ0UIZxjcW69vAswN4sKuEx4KP1QYzYH X-Gm-Gg: AeBDievhqEGGPdS/lmichx+TiuNuawTUiKZCzU4h9HGDUjPsKta7dLp5HxQypPdIPLd gEJOcXbLe1y+REyoaIegaml793TwBw7zUXeBMCwP3zAXEb3dEfbVG8+pagfKJn7gRUTlmhRtHs2 Uz4GiOQsmVFrmBKOLIze5+hh73aaSIC7z1Et2WqwJ2Hdi7nGYBeNimHADCkkH+WsPDexF3dIoH2 JNCBcA3/+F+/iZz/IDe7Wqo93Jj3a+2pMba1O+S5XrkpjdHjpE0mLcPqboz95ycSJeeyySVNQ3p azFiK4gv8HgP0qcUbY7zDmENgt0F5jOlqrKoJzJ21laOHVrZIyCUvp2Fqjk+Ye7Hiz9EGoaWMMg JtQcjq0PWqfXhRsWQliEc7w53jzdE0q+1mCd+QKaYXAHA01AMU/Us75INpxFgL7Vwjcsrt9eqhF y/1OeBF6evIv4JMI5NvO8= X-Received: by 2002:a05:693c:2b10:b0:2d8:4dee:6ad0 with SMTP id 5a478bee46e88-2df7f467535mr1329135eec.16.1776339562577; Thu, 16 Apr 2026 04:39:22 -0700 (PDT) X-Received: by 2002:a05:693c:2b10:b0:2d8:4dee:6ad0 with SMTP id 5a478bee46e88-2df7f467535mr1329118eec.16.1776339561885; Thu, 16 Apr 2026 04:39:21 -0700 (PDT) From: Matheus Tavares Bernardino To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, ale@rev.ng, anjo@rev.ng, brian.cain@oss.qualcomm.com, ltaylorsimpson@gmail.com, marco.liebel@oss.qualcomm.com, philmd@linaro.org, quic_mburton@quicinc.com, sid.manning@oss.qualcomm.com Subject: [PATCH v5 13/16] tests/hexagon: add tests for v68 HVX IEEE float min/max Date: Thu, 16 Apr 2026 04:39:02 -0700 Message-Id: <7fdbc12ed4c62a16068c380a85ee2356051e61ea.1776339451.git.matheus.bernardino@oss.qualcomm.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: -9z_b2wqDTIyBL2asYbTX_BTImhQLCrn X-Proofpoint-GUID: -9z_b2wqDTIyBL2asYbTX_BTImhQLCrn X-Authority-Analysis: v=2.4 cv=XOIAjwhE c=1 sm=1 tr=0 ts=69e0ca6b cx=c_pps a=Uww141gWH0fZj/3QKPojxA==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=eoimf2acIAo5FJnRuUoq:22 a=pGLkceISAAAA:8 a=EUspDBNiAAAA:8 a=gVZ7t9wPRZXE4v3XZ3MA:9 a=PxkB5W3o20Ba91AHUih5:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDE2MDExMCBTYWx0ZWRfX3W9NkzOGGsUx GBl+tYdIwe2lt/k8jSwjRAmCptctHhPfqlOsUPk4+/kR0eP/GKfy/mdVYdUS6rhKEFnvJ+I8w25 ZjBeitg6Gp+05LO4f744jURIIxEHPp/PV6x56v3SDLbdAZ9Tl8KDW+g+CIGBnTF9mW5uhNQ0Njv XwyTVJrAoArzm6csXAEYAVnOLimzw4Cn8gLIeWuQDCESxUyJ8Lf8iByLNgkAtPCjhZjwq2uG0vg jgnu4Xpv70S6KZeDXsiD6+E5IYAK6M3xsMcm2lc2AAeOg041agkuqxddnjESrwP8ijt0GF5dvz5 ilNzA8oorH2TqnXcsNzhh72B3mI6s2HOIBwKSxcGNe3ttYal8phdPMmbJSe3eXwi3fm/pca/2// NywGkh7sOt4co4L4Vd6ZlHOWXBgmcZYdQqZcpkoecsesj2v4MuzU0Y+GcaMxeWlEHFXRSwYHyUF HULY9FLNNKDRXk3yDXg== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-16_03,2026-04-13_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 adultscore=0 suspectscore=0 spamscore=0 malwarescore=0 bulkscore=0 impostorscore=0 phishscore=0 clxscore=1015 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604070000 definitions=main-2604160110 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=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.168.131; envelope-from=matheus.bernardino@oss.qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1776339596753154100 Content-Type: text/plain; charset="utf-8" Reviewed-by: Taylor Simpson Signed-off-by: Matheus Tavares Bernardino --- tests/tcg/hexagon/fp_hvx.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/tcg/hexagon/fp_hvx.c b/tests/tcg/hexagon/fp_hvx.c index a309654ed7..dee0781bd7 100644 --- a/tests/tcg/hexagon/fp_hvx.c +++ b/tests/tcg/hexagon/fp_hvx.c @@ -73,6 +73,30 @@ DEF_TEST_OP_2(vsub, SUB_HF, hf, hf); DEF_TEST_OP_2(vmpy, MULT_SF, sf, sf); DEF_TEST_OP_2(vmpy, MULT_HF, hf, hf); =20 +#define signbit_fp(X) \ + (sizeof(X) =3D=3D bytes_hf ? ((raw_hf(X) & 0x8000) !=3D 0) : \ + ((raw_sf(X) & 0x80000000) !=3D 0)) + +#define STD_MIN(X, Y) ((X) < (Y) ? (X) : (Y)) +#define STD_MAX(X, Y) ((X) > (Y) ? (X) : (Y)) + +#define MIN(X, Y, DEF_NAN) \ + ((isnan(X) || isnan(Y)) ? DEF_NAN : \ + ((X) !=3D (Y)) ? STD_MIN(X, Y) : (signbit_fp(X) ? (X) : (Y))) /* -0 <= +0 */ +#define MAX(X, Y, DEF_NAN) \ + ((isnan(X) || isnan(Y)) ? DEF_NAN : \ + ((X) !=3D (Y)) ? STD_MAX(X, Y) : (signbit_fp(X) ? (Y) : (X))) /* -0 <= +0 */ + +#define MIN_HF(X, Y) MIN(X, Y, NAN_HF) +#define MAX_HF(X, Y) MAX(X, Y, NAN_HF) +#define MIN_SF(X, Y) MIN(X, Y, NAN_SF) +#define MAX_SF(X, Y) MAX(X, Y, NAN_SF) + +DEF_TEST_OP_2(vfmin, MIN_SF, sf, sf); +DEF_TEST_OP_2(vfmax, MAX_SF, sf, sf); +DEF_TEST_OP_2(vfmin, MIN_HF, hf, hf); +DEF_TEST_OP_2(vfmax, MAX_HF, hf, hf); + /*************************************************************************= ***** * Other tests *************************************************************************= ****/ @@ -150,6 +174,12 @@ int main(void) =20 test_new(); =20 + /* min/max */ + test_vfmin_sf_sf(); + test_vfmin_hf_hf(); + test_vfmax_sf_sf(); + test_vfmax_hf_hf(); + puts(err ? "FAIL" : "PASS"); return err ? 1 : 0; } --=20 2.37.2 From nobody Sat May 30 20:11:22 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1776339671; cv=none; d=zohomail.com; s=zohoarc; b=Wt5rGnaFtITr7GwAlJ2a1jaS1LoGPHd4w+aUNp6RWe4y7XVgw0+/bl+E/mS7yBtZOXUOrtc71I68ZMWGsO4R0UIX8L4+8dPZK68K7iZj5rT+OnBgbnQJ9+sq0fUmMuvjcP+JaKN+YiwuW5G9jIAYlgEHrGSGoWtZ8waVuTez1GQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776339671; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=V6nVKixGSjRGXMplnHG6wHz1J9IW5gbrlupSNq0KwoE=; b=Z5KrYYb+81vAaOTpmp5QvalKUOm1GNFwyXGWufgKQs0zzA5+yTb2lUBPmpDmw6UcPET/3TMvajzdHJd7/nhxpQf6bwtz5cY8zNduHO7SoctGuEgCgT5gD/c5y3cH071zZeEH95jzaUt79nCc9w0fEnreL/HruXpLD8Cps2XUE3U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776339671171505.2027165712054; Thu, 16 Apr 2026 04:41:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wDL4T-0005H1-Sd; Thu, 16 Apr 2026 07:39:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wDL4M-0005CM-LL for qemu-devel@nongnu.org; Thu, 16 Apr 2026 07:39:38 -0400 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wDL4J-0003CN-Ox for qemu-devel@nongnu.org; Thu, 16 Apr 2026 07:39:38 -0400 Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 63G6PGcY2653725 for ; Thu, 16 Apr 2026 11:39:24 GMT Received: from mail-dl1-f71.google.com (mail-dl1-f71.google.com [74.125.82.71]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4djtfuh3xs-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 16 Apr 2026 11:39:24 +0000 (GMT) Received: by mail-dl1-f71.google.com with SMTP id a92af1059eb24-12c56ad1a90so19502486c88.0 for ; Thu, 16 Apr 2026 04:39:24 -0700 (PDT) Received: from hu-mathbern-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2de8c10a65asm6845391eec.6.2026.04.16.04.39.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Apr 2026 04:39:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=V6nVKixGSjR GXMplnHG6wHz1J9IW5gbrlupSNq0KwoE=; b=GJeeOqT/iTy2PGcqOBG01znj8OX I/wCKrqZHwHEtilivqvly7ZZCCiVy0puSgxCc4KyCbjjwqfxJYzsJhQb1GCWNq03 TflHvuOrGAWHeLOlrz3hWf5/+SJS56zPoVQJXuCGRxaDxQhX1UBNUIagi8aePAdv CAOeES4eo3S4m0Za7lRoAipZK7K+p/kEplfZWiCJ2zf28wTyRXudM+d9meKDq8eb y3XXj5eJlIIaDK8M9O/9Vg/EHNxB842lgelEnjUTTKHL8Hlw7w2/Ltbfpa6tXmFD i3pB1Va6QM9R51eG+2MMPtd/yKqFvOoWGfatpVV/tN7m/0g0d+muLt0Iiuw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1776339564; x=1776944364; darn=nongnu.org; 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=V6nVKixGSjRGXMplnHG6wHz1J9IW5gbrlupSNq0KwoE=; b=FGeDEbvjHmNh2nililq2Y203+szBCC5/83zjPEdDBeGVlmzih5KPzDs6TugkwgVRDv pf3a75ZEeKz/bd+TJEeOYWceWXiZ5NRQDjnlqeVp+lAgSKriqmkpHIHlp/w9UFcy/HXs 7UMJG0QnXQOj2L9X/H5pxCK+ygdjAn+sJ07p6QyQwliRMP6y6eNRZOkqtqXv5wzXUJXC SiMJYNyXW+n8oEigyOpe0TZVK99bPCChdZXM+WYzM7A13Hkgv3uQm1R8NdJlkSxI+wec +nq9BokzWQWvxbszA3PUOnQoC38EJqUmGUNa2Py7Gwr78agoQ1lwjO6UK+94gLzhUSrT uvxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776339564; x=1776944364; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=V6nVKixGSjRGXMplnHG6wHz1J9IW5gbrlupSNq0KwoE=; b=kl1Ex+teb6lhFtxdN7vUaif/GYK+2MP4qhzVGq5R4xlPju0WFGASVbCYqoiLRhgEcr Gt7i3a7nD3RGGSHQL0d+M1oUs+6B6mDJPSIp9ZHCbaDtNNiE7K/WbaU9BPMV7x1MwC2g WcQKadFcRr5Bcql6TCGlt6RZ4DZ3gRm45UZM3vjY/saKNr+QlDyNUTjblJLrgiTJlSew dMxRwOM+vzddOG1wLmIh02GkmGVElJqD0aAycCCIKzRmMLR7PWz2cycz0+QadVLQ1IIT pIm1wcVxVDbdvSFV+BzcB0qB7enC9JoAD/bBRMP6MOe8thrCgpngNlZaH3BJ5GmVVgvy yhCw== X-Gm-Message-State: AOJu0YxzDL4WyQ29xblxlImCbCTlsLYhTSy8ACQjEYbI1jWrbUiTJzn/ JpuZCIOdk45LK89q8piQyhBmiQ0Q2KcyFYhC5Pzca7aywayE4koB3zstu1KMPVoc+iLw/QkGqVO kU3NF37549nDFTmSqXKA4qRnrqFttCNBT78CLYWzQ9E+y65LYILJCXV/TolEOXYzXV93+ X-Gm-Gg: AeBDieu+rjzjaK4aQELVAen3hHa9sHGgfGAiTTEaNDLWRBGO3z93xihkSppXuGvFTkC Y/JZDHFiClR8VdFyPqmPaLneaN5W6MDx5uqCnO7eeqlRJAYepoJM8+5AnhdNmQzDaSJOU1ZdnX1 qUG9PT/Usli0CCiDkpj07t9XYwAie28k0jYLvOsZWbLF4jS5SBPj06gjnUNe/zC+pCaoSg2SWcH PvGfBG50IZruH3QKrT5v6EDu8ffUHU17bBDtrydxJeEqAMlrb09Js2vA+/iVSY61hBMdvLYa6WC a+ZIFi4U1a+9Oobkj3b0/6FthtmsvM1jo78sLA9nS+sV7eMREdZ29SSfIsUrZ5W7lGRB75ZY+kU kfPCLzekZu2RSs2rnI+BtSszZOVSZ07unToOrtvhPE9956xkqMij4a2346NAcMtkqYB1a+f8JeO yL82+k9dzsEwZBeWBL9ps= X-Received: by 2002:a05:7022:b97:b0:121:dea2:d54d with SMTP id a92af1059eb24-12c34ececbfmr17166671c88.20.1776339563438; Thu, 16 Apr 2026 04:39:23 -0700 (PDT) X-Received: by 2002:a05:7022:b97:b0:121:dea2:d54d with SMTP id a92af1059eb24-12c34ececbfmr17166642c88.20.1776339562825; Thu, 16 Apr 2026 04:39:22 -0700 (PDT) From: Matheus Tavares Bernardino To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, ale@rev.ng, anjo@rev.ng, brian.cain@oss.qualcomm.com, ltaylorsimpson@gmail.com, marco.liebel@oss.qualcomm.com, philmd@linaro.org, quic_mburton@quicinc.com, sid.manning@oss.qualcomm.com Subject: [PATCH v5 14/16] tests/hexagon: add tests for v68 HVX IEEE float conversions Date: Thu, 16 Apr 2026 04:39:03 -0700 Message-Id: X-Mailer: git-send-email 2.37.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: FNR-y0AW0HWKuiCxy08pYUmYTWfHkHNb X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDE2MDExMCBTYWx0ZWRfX/zti/MtrLYch PVov8f7cSlqdyT7EMfweVtJ7ai81Ee9eh0U+/pSEeCLSeqaMkTKpAlSTWdAAknCq7/0t/mAdWhi 9bx5OBEWfVyzaeh5jXgPVrQHtfSNJ8mj+neV9kU4EzmAII7NO0moXRVmIxE5e6WTMSyz4zDoYkC ZpiJ+XO2LfJLQouHx/JooEPoJXPnMkk3aJXKS4yexj8ds0MRYCp/bssK1vig1Usqswlv/oANEfG ruPnndgdBdn2xZdQa6OXh8n3AjTCD0SNtgIqjNcYHXzDMjzrIqw0ovvz84Ui3LuufBjZTHfkoWi 75+SIGnOrnIWlWn4MTgiQVxsNLJKaMa8WfzMbqUmXUC7B8ejT5G59FxokCRD9dvCg/eqDG2aeYE DCIyKiuRzKdHAQJJGWiMnVNuTXpRkIb/qnknbO7IW7XOtoiP23K4lz5YOyzxzrgBWYuCjj1BYm2 oUXQbIzX+xE+qtDudgA== X-Proofpoint-GUID: FNR-y0AW0HWKuiCxy08pYUmYTWfHkHNb X-Authority-Analysis: v=2.4 cv=KrF9H2WN c=1 sm=1 tr=0 ts=69e0ca6c cx=c_pps a=JYo30EpNSr/tUYqK9jHPoA==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=DJpcGTmdVt4CTyJn9g5Z:22 a=pGLkceISAAAA:8 a=EUspDBNiAAAA:8 a=OZRFAO6Uk6ULta4fWVgA:9 a=Fk4IpSoW4aLDllm1B1p-:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-16_03,2026-04-13_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 spamscore=0 clxscore=1015 priorityscore=1501 phishscore=0 impostorscore=0 malwarescore=0 adultscore=0 lowpriorityscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604070000 definitions=main-2604160110 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=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.168.131; envelope-from=matheus.bernardino@oss.qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1776339672010158500 Content-Type: text/plain; charset="utf-8" Reviewed-by: Taylor Simpson Signed-off-by: Matheus Tavares Bernardino --- tests/tcg/hexagon/hex_test.h | 14 +++ tests/tcg/hexagon/hvx_misc.h | 2 + tests/tcg/hexagon/fp_hvx_cvt.c | 188 ++++++++++++++++++++++++++++++ tests/tcg/hexagon/Makefile.target | 3 + 4 files changed, 207 insertions(+) create mode 100644 tests/tcg/hexagon/fp_hvx_cvt.c diff --git a/tests/tcg/hexagon/hex_test.h b/tests/tcg/hexagon/hex_test.h index e7a6644d41..d5da8ad240 100644 --- a/tests/tcg/hexagon/hex_test.h +++ b/tests/tcg/hexagon/hex_test.h @@ -111,6 +111,20 @@ static inline void __check64_ne(int line, uint64_t val= , uint64_t expect) "usr =3D r2\n\t" =20 /* Some useful floating point values */ +const uint16_t HF_INF =3D 0x7c00; +const uint16_t HF_INF_neg =3D 0xfc00; +const uint16_t HF_QNaN =3D 0x7e00; +const uint16_t HF_SNaN =3D 0x7d00; +const uint16_t HF_QNaN_neg =3D 0xfe00; +const uint16_t HF_zero =3D 0x0000; +const uint16_t HF_zero_neg =3D 0x8000; +const uint16_t HF_one =3D 0x3c00; +const uint16_t HF_one_recip =3D 0x3bf9; +const uint16_t HF_two =3D 0x4000; +const uint16_t HF_small_neg =3D 0x8010; +const uint16_t HF_any =3D 0x3c00; +const uint16_t HF_neg_two =3D 0xc000; + const uint32_t SF_INF =3D 0x7f800000; const uint32_t SF_INF_neg =3D 0xff800000; const uint32_t SF_QNaN =3D 0x7fc00000; diff --git a/tests/tcg/hexagon/hvx_misc.h b/tests/tcg/hexagon/hvx_misc.h index 0330cb289d..43de20da6a 100644 --- a/tests/tcg/hexagon/hvx_misc.h +++ b/tests/tcg/hexagon/hvx_misc.h @@ -69,7 +69,9 @@ CHECK_OUTPUT_FUNC(d, 8) CHECK_OUTPUT_FUNC(w, 4) CHECK_OUTPUT_FUNC(sf, 4) CHECK_OUTPUT_FUNC(h, 2) +CHECK_OUTPUT_FUNC(uh, 2) CHECK_OUTPUT_FUNC(hf, 2) +CHECK_OUTPUT_FUNC(ub, 1) CHECK_OUTPUT_FUNC(b, 1) =20 static inline void init_buffers(void) diff --git a/tests/tcg/hexagon/fp_hvx_cvt.c b/tests/tcg/hexagon/fp_hvx_cvt.c new file mode 100644 index 0000000000..71c3f0fd4f --- /dev/null +++ b/tests/tcg/hexagon/fp_hvx_cvt.c @@ -0,0 +1,188 @@ +/* + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include +#include +#include +#include +#include +#include + +#if __HEXAGON_ARCH__ > 75 +#error "After v75, compiler will replace some FP HVX instructions." +#endif + +int err; +#include "hvx_misc.h" +#include "hex_test.h" + +#define TEST_EXP(TO, FROM, VAL, EXP) do { \ + ((MMVector *)&buffer)->FROM[index] =3D VAL; \ + expect[0].TO[index] =3D EXP; \ + index++; \ +} while (0) + +#define DEF_TEST_CVT(TO, FROM, TESTS) \ + static void test_vcvt_##TO##_##FROM(void) \ + { \ + HVX_Vector *hvx_output =3D (HVX_Vector *)&output[0]; \ + HVX_Vector buffer; \ + int index =3D 0; \ + memset(&buffer, 0, sizeof(buffer)); \ + memset(expect, 0, sizeof(expect)); \ + TESTS \ + *hvx_output =3D Q6_V##TO##_vcvt_V##FROM(buffer); \ + check_output_##TO(__LINE__, 1); \ + } + +DEF_TEST_CVT(uh, hf, { \ + TEST_EXP(uh, hf, HF_QNaN, UINT16_MAX); \ + TEST_EXP(uh, hf, HF_SNaN, UINT16_MAX); \ + TEST_EXP(uh, hf, HF_QNaN_neg, UINT16_MAX); \ + TEST_EXP(uh, hf, HF_INF, UINT16_MAX); \ + TEST_EXP(uh, hf, HF_INF_neg, 0); \ + TEST_EXP(uh, hf, HF_neg_two, 0); \ + TEST_EXP(uh, hf, HF_zero_neg, 0); \ + TEST_EXP(uh, hf, raw_hf((_Float16)2.1), 2); \ + TEST_EXP(uh, hf, HF_one_recip, 1); \ +}) + +DEF_TEST_CVT(h, hf, { \ + TEST_EXP(h, hf, HF_QNaN, INT16_MAX); \ + TEST_EXP(h, hf, HF_SNaN, INT16_MAX); \ + TEST_EXP(h, hf, HF_QNaN_neg, INT16_MAX); \ + TEST_EXP(h, hf, HF_INF, INT16_MAX); \ + TEST_EXP(h, hf, HF_INF_neg, INT16_MIN); \ + TEST_EXP(h, hf, HF_neg_two, -2); \ + TEST_EXP(h, hf, HF_zero_neg, 0); \ + TEST_EXP(h, hf, raw_hf((_Float16)2.1), 2); \ + TEST_EXP(h, hf, HF_one_recip, 1); \ +}) + +/* + * Some cvt operations take two vectors as input and perform the following: + * VdV.TO[4*i] =3D OP(VuV.FROM[2*i]); + * VdV.TO[4*i+1] =3D OP(VuV.FROM[2*i+1]); + * VdV.TO[4*i+2] =3D OP(VvV.FROM[2*i]); + * VdV.TO[4*i+3] =3D OP(VvV.FROM[2*i+1])) + * We use bf_index and index in a way that the tests are always done either + * using the first or third line of the above snippet. + */ +#define TEST_EXP_2(TO, FROM, VAL, EXP) do { \ + ((MMVector *)&buffers[bf_index])->FROM[2 * index] =3D VAL; \ + expect[0].TO[(4 * index) + (2 * bf_index)] =3D EXP; \ + index++; \ + bf_index =3D (bf_index + 1) % 2; \ +} while (0) + +#define DEF_TEST_CVT_2(TO, FROM, TESTS) \ + static void test_vcvt_##TO##_##FROM(void) \ + { \ + HVX_Vector *hvx_output =3D (HVX_Vector *)&output[0]; \ + HVX_Vector buffers[2]; \ + int index =3D 0, bf_index =3D 0; \ + memset(&buffers, 0, sizeof(buffers)); \ + memset(expect, 0, sizeof(expect)); \ + TESTS \ + *hvx_output =3D Q6_V##TO##_vcvt_V##FROM##V##FROM(buffers[0], buffe= rs[1]); \ + check_output_##TO(__LINE__, 1); \ + } + +DEF_TEST_CVT_2(ub, hf, { \ + TEST_EXP_2(ub, hf, HF_QNaN, UINT8_MAX); \ + TEST_EXP_2(ub, hf, HF_SNaN, UINT8_MAX); \ + TEST_EXP_2(ub, hf, HF_QNaN_neg, UINT8_MAX); \ + TEST_EXP_2(ub, hf, HF_INF, UINT8_MAX); \ + TEST_EXP_2(ub, hf, HF_INF_neg, 0); \ + TEST_EXP_2(ub, hf, HF_small_neg, 0); \ + TEST_EXP_2(ub, hf, HF_neg_two, 0); \ + TEST_EXP_2(ub, hf, HF_zero_neg, 0); \ + TEST_EXP_2(ub, hf, raw_hf((_Float16)2.1), 2); \ + TEST_EXP_2(ub, hf, HF_one_recip, 1); \ +}) + +DEF_TEST_CVT_2(b, hf, { \ + TEST_EXP_2(b, hf, HF_QNaN, INT8_MAX); \ + TEST_EXP_2(b, hf, HF_SNaN, INT8_MAX); \ + TEST_EXP_2(b, hf, HF_QNaN_neg, INT8_MAX); \ + TEST_EXP_2(b, hf, HF_INF, INT8_MAX); \ + TEST_EXP_2(b, hf, HF_INF_neg, INT8_MIN); \ + TEST_EXP_2(b, hf, HF_small_neg, 0); \ + TEST_EXP_2(b, hf, HF_neg_two, -2); \ + TEST_EXP_2(b, hf, HF_zero_neg, 0); \ + TEST_EXP_2(b, hf, raw_hf((_Float16)2.1), 2); \ + TEST_EXP_2(b, hf, HF_one_recip, 1); \ +}) + +#define DEF_TEST_VCONV(TO, FROM, TESTS) \ + static void test_vconv_##TO##_##FROM(void) \ + { \ + HVX_Vector *hvx_output =3D (HVX_Vector *)&output[0]; \ + HVX_Vector buffer; \ + int index =3D 0; \ + memset(&buffer, 0, sizeof(buffer)); \ + memset(expect, 0, sizeof(expect)); \ + TESTS \ + *hvx_output =3D Q6_V##TO##_equals_V##FROM(buffer); \ + check_output_##TO(__LINE__, 1); \ + } + +DEF_TEST_VCONV(w, sf, { \ + TEST_EXP(w, sf, SF_QNaN, INT32_MAX); \ + TEST_EXP(w, sf, SF_SNaN, INT32_MAX); \ + TEST_EXP(w, sf, SF_QNaN_neg, INT32_MIN); \ + TEST_EXP(w, sf, SF_INF, INT32_MAX); \ + TEST_EXP(w, sf, SF_INF_neg, INT32_MIN); \ + TEST_EXP(w, sf, SF_small_neg, 0); \ + TEST_EXP(w, sf, SF_neg_two, -2); \ + TEST_EXP(w, sf, SF_zero_neg, 0); \ + TEST_EXP(w, sf, raw_sf(2.1f), 2); \ + TEST_EXP(w, sf, raw_sf(2.8f), 2); \ +}) + +DEF_TEST_VCONV(h, hf, { \ + TEST_EXP(h, hf, HF_QNaN, INT16_MAX); \ + TEST_EXP(h, hf, HF_SNaN, INT16_MAX); \ + TEST_EXP(h, hf, HF_QNaN_neg, INT16_MIN); \ + TEST_EXP(h, hf, HF_INF, INT16_MAX); \ + TEST_EXP(h, hf, HF_INF_neg, INT16_MIN); \ + TEST_EXP(h, hf, HF_small_neg, 0); \ + TEST_EXP(h, hf, HF_neg_two, -2); \ + TEST_EXP(h, hf, HF_zero_neg, 0); \ + TEST_EXP(h, hf, raw_hf((_Float16)2.1), 2); \ + TEST_EXP(h, hf, raw_hf((_Float16)2.8), 2); \ +}) + +DEF_TEST_VCONV(hf, h, { \ + TEST_EXP(hf, h, 0, HF_zero); \ + TEST_EXP(hf, h, 2, HF_two); \ + TEST_EXP(hf, h, -2, HF_neg_two); \ + TEST_EXP(hf, h, 2049, raw_hf((_Float16)2048)); /* rounds DOWN */ \ + TEST_EXP(hf, h, 2051, raw_hf((_Float16)2052)); /* rounds UP */ \ +}) + +DEF_TEST_VCONV(sf, w, { \ + TEST_EXP(sf, w, 0, SF_zero); \ + TEST_EXP(sf, w, 2, SF_two); \ + TEST_EXP(sf, w, -2, SF_neg_two); \ + TEST_EXP(sf, w, 16777217, raw_sf((float)16777216)); /* rounds DOWN */ \ + TEST_EXP(sf, w, 16777219, raw_sf((float)16777220)); /* rounds UP */ \ +}) + +int main(void) +{ + test_vcvt_uh_hf(); + test_vcvt_h_hf(); + test_vcvt_ub_hf(); + test_vcvt_b_hf(); + test_vconv_w_sf(); + test_vconv_sf_w(); + test_vconv_h_hf(); + test_vconv_hf_h(); + + puts(err ? "FAIL" : "PASS"); + return err ? 1 : 0; +} diff --git a/tests/tcg/hexagon/Makefile.target b/tests/tcg/hexagon/Makefile= .target index afd3dd6d19..1abc5f2124 100644 --- a/tests/tcg/hexagon/Makefile.target +++ b/tests/tcg/hexagon/Makefile.target @@ -51,6 +51,7 @@ HEX_TESTS +=3D scatter_gather HEX_TESTS +=3D hvx_misc HEX_TESTS +=3D hvx_histogram HEX_TESTS +=3D fp_hvx +HEX_TESTS +=3D fp_hvx_cvt HEX_TESTS +=3D fp_hvx_disabled HEX_TESTS +=3D invalid-slots HEX_TESTS +=3D invalid-encoding @@ -132,6 +133,8 @@ fp_hvx: fp_hvx.c hvx_misc.h hex_test.h fp_hvx: CFLAGS +=3D -mhvx -mhvx-ieee-fp fp_hvx_disabled: fp_hvx_disabled.c hvx_misc.h hex_test.h fp_hvx_disabled: CFLAGS +=3D -mhvx -mhvx-ieee-fp +fp_hvx_cvt: fp_hvx_cvt.c hvx_misc.h hex_test.h +fp_hvx_cvt: CFLAGS +=3D -mhvx -mhvx-ieee-fp =20 run-fp_hvx_disabled: QEMU_OPTS +=3D -cpu v73,ieee-fp=3Dfalse =20 --=20 2.37.2 From nobody Sat May 30 20:11:22 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1776339710; cv=none; d=zohomail.com; s=zohoarc; b=EVnha991CHDdVSfbb447Z/bdToSnVZZ5cKNZdEuVK/RDBFRhmqt/qbCzUOIV1JzzbXwXR8/jLye/dxT01CFAVJLrjL35UFyQcRBrhbbAp60kJB4Vv15OLLTc0Ozo4a3c0wrGrEz+0lNnKDsIkFIXp6V1e0v/Az/UJ2mdREPVWpE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776339710; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=LeO91WsaGzVObVyI9P5c+YuXc4EOnwbcwp3Fwl89AnQ=; b=WZ/RwZguPHFCNMTxUBTQK9JXheoNGvLWix4qWtS9H5CUh5CxHlP2RKaJP1jWs2AO+l6wyfPlfiUDwfYRQrpps9Ei3gYHezR8nKBwFcVGVjdGkLViY3Dm79oKSHPaFYJCF4GrDgujuRkI0I+GX+Os3bo8rq86vdkXR/v0sDHSH3s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 177633971043252.122989236262015; Thu, 16 Apr 2026 04:41:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wDL4T-0005GZ-Gx; Thu, 16 Apr 2026 07:39:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wDL4N-0005DJ-De for qemu-devel@nongnu.org; Thu, 16 Apr 2026 07:39:39 -0400 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wDL4L-0003Ce-1L for qemu-devel@nongnu.org; Thu, 16 Apr 2026 07:39:39 -0400 Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 63G9Jk201553312 for ; Thu, 16 Apr 2026 11:39:25 GMT Received: from mail-dy1-f200.google.com (mail-dy1-f200.google.com [74.125.82.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4djrsn9g9g-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 16 Apr 2026 11:39:25 +0000 (GMT) Received: by mail-dy1-f200.google.com with SMTP id 5a478bee46e88-2bdd327d970so391619eec.1 for ; Thu, 16 Apr 2026 04:39:25 -0700 (PDT) Received: from hu-mathbern-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2de8c10a65asm6845391eec.6.2026.04.16.04.39.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Apr 2026 04:39:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=LeO91WsaGzV ObVyI9P5c+YuXc4EOnwbcwp3Fwl89AnQ=; b=SMexECvgeYkpxgEdl0bujeTgoX6 EL/q2xqiuqN+TrvW7baHYYonO6kSCY4uFVbUuFz04GZrX33/syLfJI4nXj8jG8zs kkxE0hw0QxxZQ+ad7MY4pAgiJk/0+GwbKSp2X9N/oF55kSS0SwuIBPU5me+/duQI MCsACcljd2wzs7olRGkPp6p6D+RCznu0bbbnxfC73el8m0ECfpM7rP36YBHZy5Cl /6IF7jD7QwrUNgEEMbkBhEvOVKS6jI1KX6vmZvAmWMEOle9mVYznP5JMaY81V9bi MkARLHBBh8edFdCBCWNbGJ7NGPA5bVAUtWVULiHUZxduXrDsMXW73xp2StA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1776339565; x=1776944365; darn=nongnu.org; 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=LeO91WsaGzVObVyI9P5c+YuXc4EOnwbcwp3Fwl89AnQ=; b=gyD7MFdTxGmS89JdQMzO1JqHZrxoSGhH7I9jpd5T2YrnFgFgfqOgkfXJPrUXMK1n24 QC4fsbKte+tLr6refyCrLA0q50+9AWZBllrxgZV2mFcRNpvJuWO0e4wO7DSYS37TpqLc 32NTbg8jbxmHRN2IcQGXfd8v0+vugGgBGe/vqriXSCO1OCdHEfhuHMSfebv7K9mgYF9U gWvaQhZIi0TbgtUtsbVb89PLd64ukkQT1kaV4I/fHxncguYSoBqDadKxllPAc/xxeVww pueoR64QnNxnPAp4B35iQ/t2ANKkkmZI3j4lnehLdiOt8fdGRCRfp9Jm6rrrTHxRXB1h cdqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776339565; x=1776944365; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=LeO91WsaGzVObVyI9P5c+YuXc4EOnwbcwp3Fwl89AnQ=; b=fwDeQDXYLiI3pwuDML8VKopiurgelL7tNd0KRJrUDwTVCI6RgwxE09l9/pdadXLDU8 xSCa06oDzLxJMZbt5OKrLNjAo6jcw+W938xTlq573AOYW7IF5UMaYScZ1S/0VufIe3en ZFMuUg3caN7Z8AON1zTZTPn9Ss99qv/vdDhNLIRG3HRoQD0+n2u1VQZThwdwrti4rPEJ uY4cIxmhIGWIJMwnMxF/f72v24gtu+tKxwjPuEiS4qkBvql0Gh0i/gqHdaqMsXjNEwby lfItx9eeqck999rohqzEvJweOKKQyyQuVKvIJ5lna9ApXX5NY5tfRVFq4vvJYr8ZMv4G Ik1w== X-Gm-Message-State: AOJu0YyYIainJEbKaKIURJgMhO8XJgrYvKar4r1vpRCmm4Fr8xVHK6d3 5+xVRO1TQrslAfqZIksstmI6a4iSgEQLZ0KF3dtP4T022mThN5o/fmYRhODjE7D9s0MNL+Mehnj GwESQTwz0zX7Mc4cOelDsX0Klzu0OF/60IzT5yhW7+cwrI6EsrLtHDisOTDvNd/AMa1ah X-Gm-Gg: AeBDiethNca5vXzBHDkZo3XVB4izJ/DxCc1UiQC++tfCR30BGOjb/AsnkDpp/DsOnpB wfqb5Hv1UuQV3GzRg+epozp7iMlh2qbNs523wYMM6WHyFCKaWO0Ujk0LOcLzyYoGkQIbh1ig2eL FE9ny4wexXL9w6Sd7GVDj63o1Emo7rwvOeIm/nD5e39VcB6cYT+247j/Ul7O1d6K5BN0q6A0ZRO wgDMn5UhZnKxbgH7GK3Y0FV8i39FuaZe+rqu9W6pY5aJHL7RqV/feIfzHddX1jcGYo/P8Fa9pke CMBELiIkPT5a0h3nvHUJ/J44yGM2bqr5pbhRfBaxugk2vrjDYfLkPgA5PWshMSpyf+GCGvbxWs/ kxgSKVGKryYW6afaog6MuBh9/1aoIEJ6I5ZDQKFr13MxCZKz+SrfOACQRZCeMUkzo7lQvYGsNxX EE5tX+9C/DlSNzakpoZrQ= X-Received: by 2002:a05:7300:2216:b0:2c0:beb1:8507 with SMTP id 5a478bee46e88-2df7a2f5608mr1310345eec.0.1776339564381; Thu, 16 Apr 2026 04:39:24 -0700 (PDT) X-Received: by 2002:a05:7300:2216:b0:2c0:beb1:8507 with SMTP id 5a478bee46e88-2df7a2f5608mr1310317eec.0.1776339563661; Thu, 16 Apr 2026 04:39:23 -0700 (PDT) From: Matheus Tavares Bernardino To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, ale@rev.ng, anjo@rev.ng, brian.cain@oss.qualcomm.com, ltaylorsimpson@gmail.com, marco.liebel@oss.qualcomm.com, philmd@linaro.org, quic_mburton@quicinc.com, sid.manning@oss.qualcomm.com Subject: [PATCH v5 15/16] tests/hexagon: add tests for v68 HVX IEEE float comparisons Date: Thu, 16 Apr 2026 04:39:04 -0700 Message-Id: <53e73707092d31bcde6ed8189c5496b00345f8fa.1776339451.git.matheus.bernardino@oss.qualcomm.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: Z-1J9_b77Ri9rO-7bDqpR9J4GECY-o4O X-Proofpoint-GUID: Z-1J9_b77Ri9rO-7bDqpR9J4GECY-o4O X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDE2MDExMCBTYWx0ZWRfX6puhuMzoJ6Us qky2ly6P0uQtmK9JFjyMM+V4/6KK8GrJVyuauaV5J+nddUf97+9ebFlWgK6rxx+NYZ2037OdHIY e9VBfx5sjFvwAtVB+WOHcRdg2S6VBNInQIt0NQLs0C/sqHoTi9DhH3aa3eEZ2Mri+Ll4da4RrZ6 AuGNFJvgTH7eH5W2EEwOABi+v5Kl0gSgqBywsFW5eEOqwVNY+M1Lm51nn3ZcJ4PI2gkE2eabWj3 +p5pyWl3DT5p+c5JRmGU0NPTgZ1XihFMMhXdDItevmw+hntHbNcgRsyehxRkb1nGdyjeO4uEJGP 3abR9RbuvMHnttyBVl+R3Y/ruUxp58XzoxJenM+oJtxotzFfZURjk0+cNLnEtYBQJF2o8Gg2HBq 5wTi/UJtL7yAzjAYTkj9NviMZ8DX5cO6RA6Qg2NYG0Qfpi2jZWWrKtcb0zb7MZCLNMX82V1/plr wHF0mbbZ5l7BQ+qOdYA== X-Authority-Analysis: v=2.4 cv=EojiaycA c=1 sm=1 tr=0 ts=69e0ca6d cx=c_pps a=PfFC4Oe2JQzmKTvty2cRDw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yOCtJkima9RkubShWh1s:22 a=pGLkceISAAAA:8 a=EUspDBNiAAAA:8 a=fI0TtrDCX9pHJ6FobWMA:9 a=6Ab_bkdmUrQuMsNx7PHu:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-16_03,2026-04-13_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 bulkscore=0 adultscore=0 spamscore=0 phishscore=0 impostorscore=0 suspectscore=0 lowpriorityscore=0 malwarescore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604070000 definitions=main-2604160110 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=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.168.131; envelope-from=matheus.bernardino@oss.qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1776339712340158500 Content-Type: text/plain; charset="utf-8" Reviewed-by: Taylor Simpson Signed-off-by: Matheus Tavares Bernardino --- tests/tcg/hexagon/hex_test.h | 1 + tests/tcg/hexagon/fp_hvx_cmp.c | 224 ++++++++++++++++++++++++++++++ tests/tcg/hexagon/Makefile.target | 3 + 3 files changed, 228 insertions(+) create mode 100644 tests/tcg/hexagon/fp_hvx_cmp.c diff --git a/tests/tcg/hexagon/hex_test.h b/tests/tcg/hexagon/hex_test.h index d5da8ad240..79d30ec61c 100644 --- a/tests/tcg/hexagon/hex_test.h +++ b/tests/tcg/hexagon/hex_test.h @@ -115,6 +115,7 @@ const uint16_t HF_INF =3D 0x7c00; const uint16_t HF_INF_neg =3D 0xfc00; const uint16_t HF_QNaN =3D 0x7e00; const uint16_t HF_SNaN =3D 0x7d00; +const uint16_t HF_SNaN_neg =3D 0xfd00; const uint16_t HF_QNaN_neg =3D 0xfe00; const uint16_t HF_zero =3D 0x0000; const uint16_t HF_zero_neg =3D 0x8000; diff --git a/tests/tcg/hexagon/fp_hvx_cmp.c b/tests/tcg/hexagon/fp_hvx_cmp.c new file mode 100644 index 0000000000..b1352c786a --- /dev/null +++ b/tests/tcg/hexagon/fp_hvx_cmp.c @@ -0,0 +1,224 @@ +/* + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include +#include +#include +#include +#include +#include +#include + +#if __HEXAGON_ARCH__ > 75 +#error "After v75, compiler will replace some FP HVX instructions." +#endif + +int err; +#include "hvx_misc.h" +#include "hex_test.h" + +#define MAX_TESTS_hf (MAX_VEC_SIZE_BYTES / 2) +#define MAX_TESTS_sf (MAX_VEC_SIZE_BYTES / 4) + +#define TRUE_MASK_sf 0xffffffff +#define TRUE_MASK_hf 0xffff + +static const char *comparisons[MAX_TESTS_sf][2]; +static HVX_Vector *hvx_output =3D (HVX_Vector *)&output[0]; +static HVX_Vector buffers[2], true_vec, false_vec; +static int exp_index; + +#define ADD_TEST_CMP(TYPE, VAL1, VAL2, EXP) do { \ + ((MMVector *)&buffers[0])->TYPE[exp_index] =3D VAL1; \ + ((MMVector *)&buffers[1])->TYPE[exp_index] =3D VAL2; \ + expect[0].TYPE[exp_index] =3D EXP ? TRUE_MASK_##TYPE : 0; \ + comparisons[exp_index][0] =3D #VAL1; \ + comparisons[exp_index][1] =3D #VAL2; \ + assert(exp_index < MAX_TESTS_##TYPE); \ + exp_index++; \ +} while (0) + +#define TEST_CMP_GT(TYPE, VAL1, VAL2) do { \ + ADD_TEST_CMP(TYPE, VAL1, VAL2, true); \ + ADD_TEST_CMP(TYPE, VAL2, VAL1, false); \ +} while (0) + +#define PREP_TEST() do { \ + memset(&buffers, 0, sizeof(buffers)); \ + memset(expect, 0, sizeof(expect)); \ + exp_index =3D 0; \ +} while (0) + +#define CHECK(TYPE, TYPESZ) do { \ + HVX_VectorPred pred =3D Q6_Q_vcmp_gt_V##TYPE##V##TYPE(buffers[0], buff= ers[1]); \ + *hvx_output =3D Q6_V_vmux_QVV(pred, true_vec, false_vec); \ + for (int j =3D 0; j < MAX_VEC_SIZE_BYTES / TYPESZ; j++) { \ + if (output[0].TYPE[j] !=3D expect[0].TYPE[j]) { \ + printf("ERROR: expected %s %s %s\n", comparisons[j][0], \ + (expect[0].TYPE[j] !=3D 0 ? ">" : "<=3D"), comparisons[= j][1]); \ + err++; \ + } \ + } \ +} while (0) + +static void test_cmp_sf(void) +{ + /* + * General ordering for sf: + * QNaN > SNaN > +Inf > numbers > -Inf > SNaN_neg > QNaN_neg + */ + + /* Test equality */ + PREP_TEST(); + ADD_TEST_CMP(sf, raw_sf(2.2), raw_sf(2.2), false); + ADD_TEST_CMP(sf, SF_SNaN, SF_SNaN, false); + CHECK(sf, 4); + + /* Common numbers */ + PREP_TEST(); + TEST_CMP_GT(sf, raw_sf(2.2), raw_sf(2.1)); + TEST_CMP_GT(sf, raw_sf(0), raw_sf(-2.2)); + CHECK(sf, 4); + + /* Infinity vs Infinity/NaN */ + PREP_TEST(); + TEST_CMP_GT(sf, SF_QNaN, SF_INF); + TEST_CMP_GT(sf, SF_SNaN, SF_INF); + TEST_CMP_GT(sf, SF_INF, SF_INF_neg); + TEST_CMP_GT(sf, SF_INF, SF_SNaN_neg); + TEST_CMP_GT(sf, SF_INF, SF_QNaN_neg); + TEST_CMP_GT(sf, SF_INF_neg, SF_SNaN_neg); + TEST_CMP_GT(sf, SF_INF_neg, SF_QNaN_neg); + TEST_CMP_GT(sf, SF_SNaN, SF_INF_neg); + TEST_CMP_GT(sf, SF_QNaN, SF_INF_neg); + CHECK(sf, 4); + + /* NaN vs NaN */ + PREP_TEST(); + TEST_CMP_GT(sf, SF_QNaN, SF_SNaN); + TEST_CMP_GT(sf, SF_SNaN, SF_SNaN_neg); + TEST_CMP_GT(sf, SF_SNaN_neg, SF_QNaN_neg); + CHECK(sf, 4); + + /* NaN vs non-NaN */ + PREP_TEST(); + TEST_CMP_GT(sf, SF_QNaN, SF_one); + TEST_CMP_GT(sf, SF_SNaN, SF_one); + TEST_CMP_GT(sf, SF_one, SF_QNaN_neg); + TEST_CMP_GT(sf, SF_one, SF_SNaN_neg); + CHECK(sf, 4); +} + +static void test_cmp_hf(void) +{ + /* + * General ordering for hf: + * QNaN > SNaN > +Inf > numbers > -Inf > QSNaN_neg > QNaN_neg + */ + + /* Test equality */ + PREP_TEST(); + ADD_TEST_CMP(hf, raw_hf((_Float16)2.2), raw_hf((_Float16)2.2), false= ); + ADD_TEST_CMP(hf, HF_SNaN, HF_SNaN, false); + CHECK(hf, 2); + + /* Common numbers */ + PREP_TEST(); + TEST_CMP_GT(hf, raw_hf((_Float16)2.2), raw_hf((_Float16)2.1)); + TEST_CMP_GT(hf, raw_hf((_Float16)0), raw_hf((_Float16)-2.2)); + CHECK(hf, 2); + + /* Infinity vs Infinity/NaN */ + PREP_TEST(); + TEST_CMP_GT(hf, HF_QNaN, HF_INF); + TEST_CMP_GT(hf, HF_SNaN, HF_INF); + TEST_CMP_GT(hf, HF_INF, HF_INF_neg); + TEST_CMP_GT(hf, HF_INF, HF_SNaN_neg); + TEST_CMP_GT(hf, HF_INF, HF_QNaN_neg); + TEST_CMP_GT(hf, HF_INF_neg, HF_SNaN_neg); + TEST_CMP_GT(hf, HF_INF_neg, HF_QNaN_neg); + TEST_CMP_GT(hf, HF_SNaN, HF_INF_neg); + TEST_CMP_GT(hf, HF_QNaN, HF_INF_neg); + CHECK(hf, 2); + + /* NaN vs NaN */ + PREP_TEST(); + TEST_CMP_GT(hf, HF_QNaN, HF_SNaN); + TEST_CMP_GT(hf, HF_SNaN, HF_SNaN_neg); + TEST_CMP_GT(hf, HF_SNaN_neg, HF_QNaN_neg); + CHECK(hf, 2); + + /* NaN vs non-NaN */ + PREP_TEST(); + TEST_CMP_GT(hf, HF_QNaN, HF_one); + TEST_CMP_GT(hf, HF_SNaN, HF_one); + TEST_CMP_GT(hf, HF_one, HF_QNaN_neg); + TEST_CMP_GT(hf, HF_one, HF_SNaN_neg); + CHECK(hf, 2); +} + +static void check_byte_pred(HVX_VectorPred pred, int byte_idx, uint8_t exp= _mask, + int line) +{ + /* + * Note: ((uint8_t *)&pred)[N] returns the expanded value of bit N: + * 0xFF if bit is set, 0x00 if clear. + */ + for (int i =3D 0; i < 8; i++) { + int idx =3D byte_idx * 8 + i; + int val =3D ((uint8_t *)&pred)[idx]; + int exp =3D (exp_mask >> i) & 1 ? 0xff : 0x00; + if (exp !=3D val) { + printf("ERROR line %d: pred bit %d is 0x%x, should be 0x%x\n", + line, idx, val, exp); + err++; + } + } +} + +#define CHECK_BYTE_PRED(PRED, BYTE, EXP) check_byte_pred(PRED, BYTE, EXP, = __LINE__) + +static void test_cmp_variants(void) +{ + HVX_VectorPred pred; + + /* + * Setup: comparison result will have bits 4-7 set (0xF0 in pred byte = 0) + * - sf[0]: SF_zero > SF_one =3D false -> bits 0-3 =3D 0 + * - sf[1]: SF_one > SF_zero =3D true -> bits 4-7 =3D 1 + */ + PREP_TEST(); + ADD_TEST_CMP(sf, SF_zero, SF_one, false); + ADD_TEST_CMP(sf, SF_one, SF_zero, true); + + /* greater and: 0xF0 & 0xF0 =3D 0xF0 */ + memset(&pred, 0xF0, sizeof(pred)); + pred =3D Q6_Q_vcmp_gtand_QVsfVsf(pred, buffers[0], buffers[1]); + CHECK_BYTE_PRED(pred, 0, 0xF0); + + /* greater or: 0x0F | 0xF0 =3D 0xFF */ + memset(&pred, 0x0F, sizeof(pred)); + pred =3D Q6_Q_vcmp_gtor_QVsfVsf(pred, buffers[0], buffers[1]); + CHECK_BYTE_PRED(pred, 0, 0xFF); + + /* greater xor: 0xFF ^ 0xF0 =3D 0x0F */ + memset(&pred, 0xFF, sizeof(pred)); + pred =3D Q6_Q_vcmp_gtxacc_QVsfVsf(pred, buffers[0], buffers[1]); + CHECK_BYTE_PRED(pred, 0, 0x0F); +} + +int main(void) +{ + memset(&true_vec, 0xff, sizeof(true_vec)); + memset(&false_vec, 0, sizeof(false_vec)); + + test_cmp_sf(); + test_cmp_hf(); + test_cmp_variants(); + + puts(err ? "FAIL" : "PASS"); + return err ? 1 : 0; +} diff --git a/tests/tcg/hexagon/Makefile.target b/tests/tcg/hexagon/Makefile= .target index 1abc5f2124..92bdedf661 100644 --- a/tests/tcg/hexagon/Makefile.target +++ b/tests/tcg/hexagon/Makefile.target @@ -52,6 +52,7 @@ HEX_TESTS +=3D hvx_misc HEX_TESTS +=3D hvx_histogram HEX_TESTS +=3D fp_hvx HEX_TESTS +=3D fp_hvx_cvt +HEX_TESTS +=3D fp_hvx_cmp HEX_TESTS +=3D fp_hvx_disabled HEX_TESTS +=3D invalid-slots HEX_TESTS +=3D invalid-encoding @@ -135,6 +136,8 @@ fp_hvx_disabled: fp_hvx_disabled.c hvx_misc.h hex_test.h fp_hvx_disabled: CFLAGS +=3D -mhvx -mhvx-ieee-fp fp_hvx_cvt: fp_hvx_cvt.c hvx_misc.h hex_test.h fp_hvx_cvt: CFLAGS +=3D -mhvx -mhvx-ieee-fp +fp_hvx_cmp: fp_hvx_cmp.c hvx_misc.h hex_test.h +fp_hvx_cmp: CFLAGS +=3D -mhvx -mhvx-ieee-fp =20 run-fp_hvx_disabled: QEMU_OPTS +=3D -cpu v73,ieee-fp=3Dfalse =20 --=20 2.37.2 From nobody Sat May 30 20:11:22 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1776339692; cv=none; d=zohomail.com; s=zohoarc; b=T2Zh/zIzMj4Ov+MBbN1tZ57wsuCGXrwwePP/RJbV0RV4h+/yjIQMJEXP+FbSfKTVIgczMcul2JHc91j8BKtHQWgv8oF7Gpi/f1shSFnb7RDY8l8mHbZIzXbLLR1zR+bXEMsTpgD2bze8CM+Bh5J5gqW7v9+QaliW6nLHEt+xUw8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776339692; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=t7cO1H7aXN9dktq3T5szU3yCzc338Qo/uvSjR3ni21A=; b=jjE4jgDGBvrc/IwiOcQrd9fTUk8DW5f9Cm30uExPzu1HYZqs+Jim/sNyWmY+HyA8t8GEAlLtfqg7WdqqfcPqAevKvYmSGQtGnxxzumUMhjXrElHg3otGFXMtCEHQJTTRprI9wKKK//cgMbwab0KDMfEup4EjbFnJKFsC/upAat8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776339692082938.7997655578271; Thu, 16 Apr 2026 04:41:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wDL4U-0005H8-4b; Thu, 16 Apr 2026 07:39:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wDL4O-0005Dg-02 for qemu-devel@nongnu.org; Thu, 16 Apr 2026 07:39:40 -0400 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wDL4L-0003Ci-Nc for qemu-devel@nongnu.org; Thu, 16 Apr 2026 07:39:39 -0400 Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 63G8WtQ33089293 for ; Thu, 16 Apr 2026 11:39:26 GMT Received: from mail-dy1-f199.google.com (mail-dy1-f199.google.com [74.125.82.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4djp6a9xsf-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 16 Apr 2026 11:39:26 +0000 (GMT) Received: by mail-dy1-f199.google.com with SMTP id 5a478bee46e88-2dd1c74508cso6791031eec.0 for ; Thu, 16 Apr 2026 04:39:26 -0700 (PDT) Received: from hu-mathbern-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2de8c10a65asm6845391eec.6.2026.04.16.04.39.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Apr 2026 04:39:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=t7cO1H7aXN9 dktq3T5szU3yCzc338Qo/uvSjR3ni21A=; b=e2YKaBtQ+ubT39SJq1MI4iaNa1H JXhgauDdV5F/4qa0zSQUG9seAEozaWNN0ps78LPsrK1ryJhl8TQR1DQQFY6EPdJi qpYixk7GPYMy/vGVRpAYfkSvN5rpLsIkBQBs66ssfGl8s8TBBmP7k04lHo9Dnb4l vh5EL+naV+/680oaEfTGmTWbc1+VbWBTrUNdL6bvrSAJwLHRrWWe/NPOi5bjWQZR E+Y+yC5TDn2jYYX5hDMHkaXQeXyUOTkTXylSKrAhSvss1uUF5SIZg1ShR3B8mR2B sXH0e6psCzjMQC+KhMQ/szgSjoBxx7kbJvqrUflF422VjQWlITcbHxyuGKQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1776339565; x=1776944365; darn=nongnu.org; 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=t7cO1H7aXN9dktq3T5szU3yCzc338Qo/uvSjR3ni21A=; b=ICELYaPBCszW14BkM6W3hJhtWMfgNHyyQJTCr3j2idbwo2iFF9I3zigi7yXesFF0ca 0I55BuwayUKWiw/3FglG32RpB77izo8Q4J+6K4eCFwYBXBYuOp51kUBlZaiWS3F8sxwa ehCfd517ZYuIkoIm0tLx8MQSMJUAGkLtbP6sl1QqqItijbo5jG/XjL1aam3wwNgRQ+Vc 05hjfQRYTiU9Bc/gvxCOrnTox+reBXBVGL00oc3HGOiX/yMvJRTo+dzhPHfTE74f/8ah 2xH1nshNm3FR+Evf5+7XHzqgCRwB601h1dBwHQqa942iem8l9q1E/zdey3g33mpvm2GY itww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776339565; x=1776944365; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=t7cO1H7aXN9dktq3T5szU3yCzc338Qo/uvSjR3ni21A=; b=PWWxpIhzCj7i1BhMos1iam921OVsOTWiLIk1EDWEIanNdFhNMVA4hE+JTlOa1AVRXx NS5rczdQHVe4H6mXz0NDHgyx1KW0wVOBDrFFeW5VYoT4uEZWxkRYYIHPvAOnZHORJ4Kc +Jjjex9hw1CX1cOlXTd9x7jYsDzzIHaEBb6Vp6hiczesUkdvzdlylMzI2INSuG7SlG0s zemdnR3bfmT/EE9/pklhwhf4hoDQUrikkvKzmf3afb7uGKW0jV1cgetjEKAVCCnGNi9t dm4lzSDt2R3Hbg1Az78HioSk5sAgCNYn8PtH02Lc+bb8wdBb6oGlgGWkA0CqNCiOfzES F/yA== X-Gm-Message-State: AOJu0YylHKbaxc9e/TiYdIFshIhGWRjj+nmnBIH36jNCq0j28GfXyN1A gyA1NszbY1xZVAlQjCi/ZCVLoB8arA5gUiMoHy+7QnxXK4TMf+d3Y04x5Y22oE/yLdLRjhq8suL dKs2mtgkrSb2wlS+uqW/HSpfB4ib00pp/D8mI3WdGArzmZSoGSHAhXmTFAmRGs/1lQKsR X-Gm-Gg: AeBDieuQ+dZbHNnlU+sauxQZJ0z6KbSLqWNfYW0Pty9zVGnCy8uw1UqG2ly2PZMxK18 AjrxDUcI/Xr2zOlouaHgltOQXf5n99dAfv+t0AfHv3t4i4N5lmArJY2xeaMHxlLbRYfrf8rt1fU ROQ0JgTP5/KGkLtjB1VzEe9+TUshZZNvqkCst0Jzd3uaJuBIU1Tmt0D/nYPUhs6+Dtj/OHCo5lM YhtpQbo0+Ja+ds6595psdh6xNMp7PxVHOwgalejntFUpjL7zKpbXWR/dX1A5n8/Z9eX7GV28f3h AkU8ycGAmfmjdgosCI+MdJ1Za+6TAcI3fC6HnNc/j+KsJw5KiCb3bdIfVCMn42g3I7pyEqgbTan yUHXRgqoFRwATt6WVXLTlfXPWOvsVLljK36+5NGQF4n2noI6Ya0blyN89/LL9moZMsZV49fv078 OJEAch7erqJ0x7cSdnxxc= X-Received: by 2002:a05:7301:6706:b0:2c8:fe46:eeb6 with SMTP id 5a478bee46e88-2d5881a91e7mr14156971eec.16.1776339565250; Thu, 16 Apr 2026 04:39:25 -0700 (PDT) X-Received: by 2002:a05:7301:6706:b0:2c8:fe46:eeb6 with SMTP id 5a478bee46e88-2d5881a91e7mr14156951eec.16.1776339564682; Thu, 16 Apr 2026 04:39:24 -0700 (PDT) From: Matheus Tavares Bernardino To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, ale@rev.ng, anjo@rev.ng, brian.cain@oss.qualcomm.com, ltaylorsimpson@gmail.com, marco.liebel@oss.qualcomm.com, philmd@linaro.org, quic_mburton@quicinc.com, sid.manning@oss.qualcomm.com Subject: [PATCH v5 16/16] tests/hexagon: add tests for HVX bfloat Date: Thu, 16 Apr 2026 04:39:05 -0700 Message-Id: <392114c4c16e6f7f2835a6513987aafea82b565c.1776339451.git.matheus.bernardino@oss.qualcomm.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: 8NrTFjuL9g_wHb7BeQZcEsWeEiOS6Mda X-Authority-Analysis: v=2.4 cv=NuvhtcdJ c=1 sm=1 tr=0 ts=69e0ca6e cx=c_pps a=cFYjgdjTJScbgFmBucgdfQ==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_K5XuSEh1TEqbUxoQ0s3:22 a=pGLkceISAAAA:8 a=EUspDBNiAAAA:8 a=p2wTH1VsjY2anDiw4wEA:9 a=scEy_gLbYbu1JhEsrz4S:22 X-Proofpoint-GUID: 8NrTFjuL9g_wHb7BeQZcEsWeEiOS6Mda X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDE2MDExMCBTYWx0ZWRfX72qows9krwVG S0BdPNAQAy/zvDs4iSYkH0aEo1VC2IgApNOqpuLKERC3sXBQ1Rq8wLJrkBXJOXdcggJQ9kgaZrY i3XT7Jmqnjh1Vuq2U5xS8uaMJQkOgaVR/AdcQXrfTDT8d+UhKIDF3QX5HUi1jRMnNZRnpOuVGDt FCeJbBfS7ScnjT2d86fOHvIyNkF97U8o8Yn7mjXHaVyHUwh98IdSAr/x9gcaJwqhKEXz9SI5WSM FJmUoh9sRIYuu4PKQITAvp9VWyKXE5B+CYpzf7/+h8SfnSktydNEBVo02tWv+p9kEtaGGtwKgG3 dajNekLY0cGs9rks8w4210UiZsedsxyNUNFUFSxEjJA7EuPRDy9IbGvP8rVaiN09BXqFz0ycSAg 5KWmh4YXYt3Ke/np2WTlCHzV0O3EaNAvzVTLqSu8B/H37fZKmq6u3dzF0PzluilzEnbaiqwgNvv Nif64KP1HrIhuV/diQg== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-16_03,2026-04-13_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 bulkscore=0 suspectscore=0 spamscore=0 lowpriorityscore=0 priorityscore=1501 adultscore=0 impostorscore=0 phishscore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604070000 definitions=main-2604160110 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=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.168.131; envelope-from=matheus.bernardino@oss.qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1776339694410158500 Content-Type: text/plain; charset="utf-8" Reviewed-by: Taylor Simpson Signed-off-by: Matheus Tavares Bernardino --- tests/tcg/hexagon/hex_test.h | 13 +++++++++ tests/tcg/hexagon/hvx_misc.h | 30 ++++++++++++++++++++ tests/tcg/hexagon/fp_hvx.c | 41 +++++++++++++++++++++++++++ tests/tcg/hexagon/fp_hvx_cmp.c | 51 ++++++++++++++++++++++++++++++++++ tests/tcg/hexagon/fp_hvx_cvt.c | 31 +++++++++++++++++++++ 5 files changed, 166 insertions(+) diff --git a/tests/tcg/hexagon/hex_test.h b/tests/tcg/hexagon/hex_test.h index 79d30ec61c..f86e6e1a69 100644 --- a/tests/tcg/hexagon/hex_test.h +++ b/tests/tcg/hexagon/hex_test.h @@ -126,6 +126,19 @@ const uint16_t HF_small_neg =3D 0x8010; const uint16_t HF_any =3D 0x3c00; const uint16_t HF_neg_two =3D 0xc000; =20 +const uint16_t BF_INF =3D 0x7f80; +const uint16_t BF_INF_neg =3D 0xff80; +const uint16_t BF_QNaN =3D 0x7fc0; +const uint16_t BF_SNaN =3D 0x7f81; +const uint16_t BF_QNaN_neg =3D 0xffc0; +const uint16_t BF_SNaN_neg =3D 0xff81; +const uint16_t BF_HEX_NaN =3D 0x7fff; +const uint16_t BF_zero =3D 0x0000; +const uint16_t BF_zero_neg =3D 0x8000; +const uint16_t BF_one =3D 0x3f80; +const uint16_t BF_two =3D 0x4000; +const uint16_t BF_four =3D 0x4080; + const uint32_t SF_INF =3D 0x7f800000; const uint32_t SF_INF_neg =3D 0xff800000; const uint32_t SF_QNaN =3D 0x7fc00000; diff --git a/tests/tcg/hexagon/hvx_misc.h b/tests/tcg/hexagon/hvx_misc.h index 43de20da6a..c21ea975c1 100644 --- a/tests/tcg/hexagon/hvx_misc.h +++ b/tests/tcg/hexagon/hvx_misc.h @@ -41,6 +41,7 @@ typedef union { uint16_t uh[MAX_VEC_SIZE_BYTES / 2]; uint16_t hf[MAX_VEC_SIZE_BYTES / 2]; /* convenience alias */ int16_t h[MAX_VEC_SIZE_BYTES / 2]; + uint16_t bf[MAX_VEC_SIZE_BYTES / 2]; uint8_t ub[MAX_VEC_SIZE_BYTES / 1]; int8_t b[MAX_VEC_SIZE_BYTES / 1]; } MMVector; @@ -73,6 +74,7 @@ CHECK_OUTPUT_FUNC(uh, 2) CHECK_OUTPUT_FUNC(hf, 2) CHECK_OUTPUT_FUNC(ub, 1) CHECK_OUTPUT_FUNC(b, 1) +CHECK_OUTPUT_FUNC(bf, 2) =20 static inline void init_buffers(void) { @@ -97,6 +99,12 @@ static const uint32_t FP_VALUES[] =3D { }; #define FP_VALUES_MAX ARRAY_SIZE(FP_VALUES) =20 +static const uint16_t BF_VALUES[] =3D { + BF_INF, BF_INF_neg, BF_QNaN, BF_SNaN, BF_QNaN_neg, BF_SNaN_neg, + BF_HEX_NaN, BF_zero, BF_zero_neg, BF_one, BF_two, BF_four, +}; +#define BF_VALUES_MAX ARRAY_SIZE(BF_VALUES) + static inline void init_buffers_fp(void) { _Static_assert(BUFSIZE * (MAX_VEC_SIZE_BYTES / 4) > @@ -116,6 +124,25 @@ static inline void init_buffers_fp(void) } } =20 +static inline void init_buffers_bf(void) +{ + _Static_assert(BUFSIZE * (MAX_VEC_SIZE_BYTES / 2) > + BF_VALUES_MAX * BF_VALUES_MAX, + "test arrays can't fit all BF_VALUES combinations"); + int counter1 =3D 0, counter2 =3D 0; + for (int i =3D 0; i < BUFSIZE; i++) { + for (int j =3D 0; j < MAX_VEC_SIZE_BYTES / 2; j++) { + buffer0[i].bf[j] =3D BF_VALUES[counter1]; + buffer1[i].bf[j] =3D BF_VALUES[counter2]; + counter2++; + if (counter2 =3D=3D BF_VALUES_MAX) { + counter2 =3D 0; + counter1 =3D (counter1 + 1) % BF_VALUES_MAX; + } + } + } +} + #define VEC_OP1(ASM, EL, IN, OUT) \ asm("v2 =3D vmem(%0 + #0)\n\t" \ "v2" #EL " =3D " #ASM "(v2" #EL ")\n\t" \ @@ -212,10 +239,13 @@ static inline void test_##NAME(bool invert) \ =20 #define float_sf(x) ({ typeof(x) _x =3D (x); *((float *)&(_x)); }) #define float_hf(x) ({ typeof(x) _x =3D (x); *((_Float16 *) &(_x)); }) +#define float_bf(x) ({ uint32_t _u =3D ((uint32_t)(x)) << 16; *((float *)&= (_u)); }) #define raw_sf(x) ({ typeof(x) _x =3D (x); *((uint32_t *)&(_x)); }) #define raw_hf(x) ({ typeof(x) _x =3D (x); *((uint16_t *)&(_x)); }) +#define raw_bf(x) ({ typeof(x) _x =3D (x); (uint16_t)(*((uint32_t *)&(_x))= >> 16); }) #define float_hf_to_sf(x) ((float)x) #define bytes_hf 2 #define bytes_sf 4 +#define bytes_bf 2 =20 #endif diff --git a/tests/tcg/hexagon/fp_hvx.c b/tests/tcg/hexagon/fp_hvx.c index dee0781bd7..4543a0aa8c 100644 --- a/tests/tcg/hexagon/fp_hvx.c +++ b/tests/tcg/hexagon/fp_hvx.c @@ -29,6 +29,7 @@ int err; #define CHECK_NAN(A, DEF_NAN) (isnan(A) ? DEF_NAN : (A)) #define NAN_SF float_sf(0x7FFFFFFF) #define NAN_HF float_hf(0x7FFF) +#define NAN_BF float_hf(0x7FFF) =20 /*************************************************************************= ***** * Binary operations @@ -91,11 +92,43 @@ DEF_TEST_OP_2(vmpy, MULT_HF, hf, hf); #define MAX_HF(X, Y) MAX(X, Y, NAN_HF) #define MIN_SF(X, Y) MIN(X, Y, NAN_SF) #define MAX_SF(X, Y) MAX(X, Y, NAN_SF) +#define MIN_BF(X, Y) MIN(X, Y, NAN_BF) +#define MAX_BF(X, Y) MAX(X, Y, NAN_BF) =20 DEF_TEST_OP_2(vfmin, MIN_SF, sf, sf); DEF_TEST_OP_2(vfmax, MAX_SF, sf, sf); DEF_TEST_OP_2(vfmin, MIN_HF, hf, hf); DEF_TEST_OP_2(vfmax, MAX_HF, hf, hf); +DEF_TEST_OP_2(vmin, MIN_BF, bf, bf); +DEF_TEST_OP_2(vmax, MAX_BF, bf, bf); + +#define DEF_TEST_OP_2_INTERLEAVED(vop, op, type_res, type_arg) \ + static void test_##vop##_##type_res##_##type_arg(void) \ + { \ + memset(expect, 0xff, sizeof(expect)); \ + memset(output, 0xff, sizeof(output)); \ + for (int i =3D 0; i < BUFSIZE / 2; i++) { \ + HVX_VectorPair *hvx_output =3D (HVX_VectorPair *)&output[2 * i= ]; \ + HVX_Vector hvx_buffer0 =3D *(HVX_Vector *)&buffer0[i]; \ + HVX_Vector hvx_buffer1 =3D *(HVX_Vector *)&buffer1[i]; \ + *hvx_output =3D \ + Q6_W##type_res##_##vop##_V##type_arg##V##type_arg(hvx_buff= er0, \ + hvx_buff= er1); \ + for (int j =3D 0; j < MAX_VEC_SIZE_BYTES / bytes_##type_res; j= ++) { \ + expect[2 * i].type_res[j] =3D \ + raw_##type_res(op(float_##type_arg(buffer0[i].type_arg= [2 * j]), \ + float_##type_arg(buffer1[i].type_arg= [2 * j]))); \ + expect[2 * i + 1].type_res[j] =3D \ + raw_##type_res(op(float_##type_arg(buffer0[i].type_arg= [2 * j + 1]), \ + float_##type_arg(buffer1[i].type_arg[2= * j + 1]))); \ + } \ + } \ + check_output_##type_res(__LINE__, BUFSIZE); \ + } + +DEF_TEST_OP_2_INTERLEAVED(vadd, SUM_SF, sf, bf); +DEF_TEST_OP_2_INTERLEAVED(vsub, SUB_SF, sf, bf); +DEF_TEST_OP_2_INTERLEAVED(vmpy, MULT_SF, sf, bf); =20 /*************************************************************************= ***** * Other tests @@ -180,6 +213,14 @@ int main(void) test_vfmax_sf_sf(); test_vfmax_hf_hf(); =20 + /* bfloat */ + init_buffers_bf(); + test_vmin_bf_bf(); + test_vmax_bf_bf(); + test_vadd_sf_bf(); + test_vsub_sf_bf(); + test_vmpy_sf_bf(); + puts(err ? "FAIL" : "PASS"); return err ? 1 : 0; } diff --git a/tests/tcg/hexagon/fp_hvx_cmp.c b/tests/tcg/hexagon/fp_hvx_cmp.c index b1352c786a..5b3c842bd5 100644 --- a/tests/tcg/hexagon/fp_hvx_cmp.c +++ b/tests/tcg/hexagon/fp_hvx_cmp.c @@ -22,9 +22,11 @@ int err; =20 #define MAX_TESTS_hf (MAX_VEC_SIZE_BYTES / 2) #define MAX_TESTS_sf (MAX_VEC_SIZE_BYTES / 4) +#define MAX_TESTS_bf (MAX_VEC_SIZE_BYTES / 2) =20 #define TRUE_MASK_sf 0xffffffff #define TRUE_MASK_hf 0xffff +#define TRUE_MASK_bf 0xffff =20 static const char *comparisons[MAX_TESTS_sf][2]; static HVX_Vector *hvx_output =3D (HVX_Vector *)&output[0]; @@ -160,6 +162,54 @@ static void test_cmp_hf(void) CHECK(hf, 2); } =20 +static void test_cmp_bf(void) +{ + /* + * General ordering for bf: + * QNaN > SNaN > +Inf > numbers > -Inf > SNaN_neg > QNaN_neg + */ + + /* Test equality */ + PREP_TEST(); + ADD_TEST_CMP(bf, 0, 0, false); + ADD_TEST_CMP(bf, BF_SNaN, BF_SNaN, false); + CHECK(bf, 2); + + /* Common numbers */ + PREP_TEST(); + TEST_CMP_GT(bf, BF_two, BF_one); + TEST_CMP_GT(bf, BF_one, BF_zero); + CHECK(bf, 2); + + /* Infinity vs Infinity/NaN */ + PREP_TEST(); + TEST_CMP_GT(bf, BF_QNaN, BF_INF); + TEST_CMP_GT(bf, BF_SNaN, BF_INF); + TEST_CMP_GT(bf, BF_INF, BF_INF_neg); + TEST_CMP_GT(bf, BF_INF, BF_SNaN_neg); + TEST_CMP_GT(bf, BF_INF, BF_QNaN_neg); + TEST_CMP_GT(bf, BF_INF_neg, BF_SNaN_neg); + TEST_CMP_GT(bf, BF_INF_neg, BF_QNaN_neg); + TEST_CMP_GT(bf, BF_SNaN, BF_INF_neg); + TEST_CMP_GT(bf, BF_QNaN, BF_INF_neg); + CHECK(bf, 2); + + /* NaN vs NaN */ + PREP_TEST(); + TEST_CMP_GT(bf, BF_QNaN, BF_SNaN); + TEST_CMP_GT(bf, BF_SNaN, BF_SNaN_neg); + TEST_CMP_GT(bf, BF_SNaN_neg, BF_QNaN_neg); + CHECK(bf, 2); + + /* NaN vs non-NaN */ + PREP_TEST(); + TEST_CMP_GT(bf, BF_QNaN, BF_one); + TEST_CMP_GT(bf, BF_SNaN, BF_one); + TEST_CMP_GT(bf, BF_one, BF_QNaN_neg); + TEST_CMP_GT(bf, BF_one, BF_SNaN_neg); + CHECK(bf, 2); +} + static void check_byte_pred(HVX_VectorPred pred, int byte_idx, uint8_t exp= _mask, int line) { @@ -217,6 +267,7 @@ int main(void) =20 test_cmp_sf(); test_cmp_hf(); + test_cmp_bf(); test_cmp_variants(); =20 puts(err ? "FAIL" : "PASS"); diff --git a/tests/tcg/hexagon/fp_hvx_cvt.c b/tests/tcg/hexagon/fp_hvx_cvt.c index 71c3f0fd4f..bd8d39d6b6 100644 --- a/tests/tcg/hexagon/fp_hvx_cvt.c +++ b/tests/tcg/hexagon/fp_hvx_cvt.c @@ -19,6 +19,8 @@ int err; #include "hvx_misc.h" #include "hex_test.h" =20 +#define NAN_BF 0x7FFF + #define TEST_EXP(TO, FROM, VAL, EXP) do { \ ((MMVector *)&buffer)->FROM[index] =3D VAL; \ expect[0].TO[index] =3D EXP; \ @@ -172,6 +174,34 @@ DEF_TEST_VCONV(sf, w, { \ TEST_EXP(sf, w, 16777219, raw_sf((float)16777220)); /* rounds UP */ \ }) =20 +#define TEST_EXP_BF(VAL, EXP) do { \ + ((MMVector *)&buffers[1])->sf[index] =3D VAL; \ + ((MMVector *)&buffers[0])->sf[index] =3D VAL; \ + expect[0].bf[2 * index] =3D EXP; \ + expect[0].bf[2 * index + 1] =3D EXP; \ + index++; \ +} while (0) + +static void test_vconv_bf_sf(void) +{ + HVX_Vector *hvx_output =3D (HVX_Vector *)&output[0]; + HVX_Vector buffers[2]; + int index =3D 0; + memset(&buffers, 0, sizeof(buffers)); + memset(expect, 0, sizeof(expect)); + + TEST_EXP_BF(SF_QNaN, NAN_BF); + TEST_EXP_BF(SF_SNaN, NAN_BF); + TEST_EXP_BF(SF_QNaN_neg, NAN_BF); + TEST_EXP_BF(SF_INF, BF_INF); + TEST_EXP_BF(SF_INF_neg, BF_INF_neg); + TEST_EXP_BF(SF_one, BF_one); + TEST_EXP_BF(SF_zero_neg, BF_zero_neg); + + *hvx_output =3D Q6_Vbf_vcvt_VsfVsf(buffers[0], buffers[1]); + check_output_hf(__LINE__, 1); +} + int main(void) { test_vcvt_uh_hf(); @@ -182,6 +212,7 @@ int main(void) test_vconv_sf_w(); test_vconv_h_hf(); test_vconv_hf_h(); + test_vconv_bf_sf(); =20 puts(err ? "FAIL" : "PASS"); return err ? 1 : 0; --=20 2.37.2