From nobody Sat Sep 26 20:01:26 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=1789489980; cv=none; d=zohomail.com; s=zohoarc; b=fTV0XTXYWzbZDta7zykSP5NBveVGqYKvYZYp4PIFxAnYZPhOwFa44uhHs9PLCGQMIYv7Yw+8J4b8ZkUi0A9++xJumsan6skKKkm/fbZbJu9x9JNIN1AhFZLB7gqfDV6nsZTKeltzW0NRVOPSzcAQ6SGP7/gXCuJQg9DZgHR+lh0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789489980; h=Content-Type: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=/We6Oq3iZAEUwgNfTrkFRhUQjpmVek2fWNf2Goc+G1c=; b=iNGh26pwQcmtse6UBMGWZTyETq701Cp+wDm7ikoej8/T5/xXAlDrjOIXjntlBZ4XnfcTVQvV01IZL0axXotQIsqyNZCwgFPbEmrKAvWM5Zp9Aj13I1SrqI19p2upt6Ius7M3WtQDih0Y/f7/TEGv6VmXKFmMzbFzQEsCJK17Kdw= 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 1789489980232685.0812257818419; Tue, 15 Sep 2026 09:33:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x6W49-0005yr-Fa; Tue, 15 Sep 2026 12:31:29 -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 1x6W3e-0005u1-9r for qemu-devel@nongnu.org; Tue, 15 Sep 2026 12:31:01 -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 1x6W3b-0003m1-Lx for qemu-devel@nongnu.org; Tue, 15 Sep 2026 12:30:57 -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 68FFANUr813359 for ; Tue, 15 Sep 2026 16:30:54 GMT Received: from mail-pj1-f72.google.com (mail-pj1-f72.google.com [209.85.216.72]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4gq6kc170a-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 15 Sep 2026 16:30:53 +0000 (GMT) Received: by mail-pj1-f72.google.com with SMTP id 98e67ed59e1d1-39533bb224cso6034127a91.3 for ; Tue, 15 Sep 2026 09:30:53 -0700 (PDT) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-39dfdd0baaasm6068590a91.9.2026.09.15.09.30.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Sep 2026 09:30:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= /We6Oq3iZAEUwgNfTrkFRhUQjpmVek2fWNf2Goc+G1c=; b=fCKATV+JXzv6ey5E yfx4Yd3yJuzNtMeSgUdbhA4fYmlc3c7F4PVCdYZ6gkXWZJtYhksZr06wyYG+DK1g NUCuPC5qQj+aMFXcfxANIuZB3JciDWOdSATizgb1jyAHgrgx7ITvoh1M+qqqVV2a M6mZLmL4lWnrPt0WUuQst36OhIXXZs6Hp+np9AyEMRLPIuiRLziscz+6NohSU+qI RA0C8sDGizjJlyo6/dgT2Q0KZhjqD0/Qn8ezNrk0V7itgyOaAyKj7IBrY0e2s+ME zd2f/zOg4T8pE6ks0exnn3TSCn7nZdpLEw7TT8+V8pyQHxnxbyr/eU0KVzEgaeiq jRtNLQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1789489853; x=1790094653; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=/We6Oq3iZAEUwgNfTrkFRhUQjpmVek2fWNf2Goc+G1c=; b=QMC415MhZ3Ob/DP1VOiCAUehjC+MGyFEd27zFkHPTrsR/IV5830T8OrZNmMbPfsuQ9 j2UuhGFux9Gs4rG3pR8SWokvwjXkChfhdrc13TgZPUqlBO78gLB7NMxRBMbPfjPmbRO1 2nUHrVSUXH4Hb8uTZXtWA/sj8C7RuP6RDMRxIoEHl4QHt8hcqaEI/SGWlBnFJMTn9Xmj zluRTiCwxvuaNJiDW9bRlTiMK1kYum00wcpYrwHp0xIDrPx9TlftFTFhmnqm4JTWRZoX ECAGpPAuy8M0upUZTUb0A7MwCyHmRljp572HWhIlD3JTx/vFbkwC/ixg+PX4Ecn5yogi tzQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789489853; x=1790094653; h=content-transfer-encoding:content-type: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 :content-type; bh=/We6Oq3iZAEUwgNfTrkFRhUQjpmVek2fWNf2Goc+G1c=; b=PXbaRlkW/NSzx9gl2qBorUayVqfmA+I80tH5go1vdS9uhP3amGlQZ7WNAkHZ3VhWVc fOFnDOhrOppr8XxTv5tBREL9xMo11qRYezaYtP8Dr9K3tvvldyLgQo2aaJgBSmhl/Kv3 LcgoACr1+HfR634SFj6mXkVTae+EO43jYYpoEDDiKrMeSyH187q01lYtGhk5S/hMCLeq gASV/Znc/wXmqF9cMtBGEbGxOEgtvF4AQ4ipgXnWjJRqN/AhRwD7xHUts/RyJnGRUec0 9KIxz1pPFzItYkFL+evHiDQZt/WM/p+WnNNqmld7hCkM0N97HaLIwUYMTdqrmFACfB2C MRuw== X-Gm-Message-State: AFuF++kqCzJfJc5OaVgj+cqA3FTLYlZ69bVVp/zR/3TuWV2PAT+qWui+ pn8gKxCAIFeAUnFLElXmyeMgNqabZGYo8CfkmpAkTt0JRw/12ai52uI7sQPQPTTsHQqPQKCd6ei GHWfruoyNIhishabU2Eb2spEuKjYToBuFIkZXpXsIi4+PEP9x3D2mZuJ3vb9uJ0ceyw== X-Gm-Gg: AYBFou1yFTHjg7cQpCkFLyJOHBcaZfn9B0hPDrrGAHuux6KkTS0kS7fK3v0Qol/htAv s7qs3dHf0grdhvlcpNis+5LoqNM+z76GkrwAw8eEaYToi+v5ATkEayKE8fhZCZwlFpckjmJSUXk scpBbAgvGF+5jzLvnsRCKBIai5O4FFGORD7w+2EYhwdWTOmOihTAnhWwDx3UR3JBDgULDOymjnF 2rX77IQfaVsjhtQbL/G/XRcnfcxEut1vJt+AZqqYrocDbyTU24/luOU530VlIrWLkmNEgwGjqoK hw9bN+QCH1Ws0kbX0dBZvtBfi0rEKhthlLcqR8aOWTdRYase2x8qg+ii+njMP524deIaXdqqqke kFFWkxtBAPsCbq8LWDua8qWVfvPdOqTyj0/dcSeWj3P8E4dVA X-Received: by 2002:a17:90b:258d:b0:39e:89d:21c9 with SMTP id 98e67ed59e1d1-39e089d3e7bmr6053972a91.11.1789489851017; Tue, 15 Sep 2026 09:30:51 -0700 (PDT) X-Received: by 2002:a17:90b:258d:b0:39e:89d:21c9 with SMTP id 98e67ed59e1d1-39e089d3e7bmr6053889a91.11.1789489850542; Tue, 15 Sep 2026 09:30:50 -0700 (PDT) From: Brian Cain To: qemu-devel@nongnu.org Cc: sid.manning@oss.qualcomm.com, Pierrick Bouvier , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Brian Cain Subject: [PATCH v2 01/17] tests/tcg/hexagon: fix undefined signed left shift in circ.c Date: Tue, 15 Sep 2026 09:30:31 -0700 Message-Id: <20260915163047.4180600-2-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260915163047.4180600-1-brian.cain@oss.qualcomm.com> References: <20260915163047.4180600-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Info: AW1haW4tMjYwOTE1MDIzOSBTYWx0ZWRfX+9CWZIkln/tx P85WwddSqaNV4eOmXkfcx0CAad/57b5aykl/s+bYtMWG/QXRQpp3yojyqOKjHQnapoqSe4bdIqi VPE8UP/gdVCC/xjFMkgfB49HJOCnG84= X-Proofpoint-GUID: pXDVmVnWH7HKe5fP_9QRjHtXy2Js9gXs X-Authority-Analysis: v=2.4 cv=ZINCCn7b c=1 sm=1 tr=0 ts=6aa972bd cx=c_pps a=RP+M6JBNLl+fLTcSJhASfg==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=Um2Pa8k9VHT-vaBCBUpS:22 a=EUspDBNiAAAA:8 a=czf7IwGEd3W-wTYbEmAA:9 a=QEXdDO2ut3YA:10 a=zZCYzV9kfG8A:10 a=iS9zxrgQBfv6-_F4QbHw:22 X-Proofpoint-ORIG-GUID: pXDVmVnWH7HKe5fP_9QRjHtXy2Js9gXs X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTE1MDIzOSBTYWx0ZWRfX65wnb+lz08DU /4NcAQvs7gc0ySWVIMoNNNFzcPeY5K87G5ggiRxDStAfdsMQbcTOWS3cKIMkK+rYZoyduDzMUbA CIL0t7b8CZX3xAKmdw6iCuPPsvUdZEJ1bounkAVOOJS5vxGImFxQaFc8Xbu+3gL/IQxKhMqINKR 2xEiEXonEQmqcvOlIJDLWVjNmt7CR6+uaxkg2RRK9WYTGwykA6bTP+7pwqjTiehZ7rD3euhwzJF uYJdHHlzZHQLPq+9XD1SxRanf44Tbqvxi+jT4P84ai6d3dDhRbnuhQqhthkV+KPBhDuugV0QVSj hgWwmuOEy05Pf/0DhyOf3qtluKUOwQVNUrYMzHcCfcGWA/WbWEyeOPo5vbzt2cWOCNaZT/09nxW Mj4vxHgmQHZGLUu9MW1bjEV/biASjT5/jRfzBvQ/rtABPbChR92d4XE5YNqMjIjkI8efAHzkmWT ON55hBs/EsNlmBhGlcA== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-15_04,2026-09-15_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 bulkscore=0 phishscore=0 priorityscore=1501 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609150239 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=brian.cain@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, 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: 1789489980764158500 Cast operands to uint32_t before left-shifting in build_mreg() to avoid undefined behavior when the shift result overflows int32_t. Found with UBSan. Reviewed-by: Sid Manning Signed-off-by: Brian Cain --- tests/tcg/hexagon/circ.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/tcg/hexagon/circ.c b/tests/tcg/hexagon/circ.c index ab949ebef1c..2a15c324242 100644 --- a/tests/tcg/hexagon/circ.c +++ b/tests/tcg/hexagon/circ.c @@ -97,9 +97,9 @@ INIT(dbuf, NDOBLS) */ static int32_t build_mreg(int32_t inc, int32_t K, int32_t len) { - return ((inc & 0x780) << 21) | - ((K & 0xf) << 24) | - ((inc & 0x7f) << 17) | + return ((uint32_t)(inc & 0x780) << 21) | + ((uint32_t)(K & 0xf) << 24) | + ((uint32_t)(inc & 0x7f) << 17) | (len & 0x1ffff); } =20 --=20 2.34.1 From nobody Sat Sep 26 20:01:26 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=1789489966; cv=none; d=zohomail.com; s=zohoarc; b=XKZSSjMSsuys1ANRLwOWpdExH887lZfdqO4Ot+B6/JNL5o9wLtlo9vLpDlkSXFci05Ch8daBpoZ8y8DrWfSN862KrBemdxvOtTwtSVz6zOFLAy9oLPAJheE6B4OEFFMAN1RLTHXHzOGbQvX1/suko4vEVmx7BZ/9Jb4I2ZWZPec= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789489966; h=Content-Type: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=zF7wNM0uK32PaFnM0cjYMMOMVW+Srqc+PhvZl4ELL8A=; b=nBjtZAP+jdvMs0xOynuEH5V09rOSxEkYa2yYaAnlH8K5rY7b3w4hRt8eBSwaR3PT7QjDrUNqHesTqls09KO7Cnv51jL4WyDP6H+V7ehV9TnxhWDm1ZmbmjZ/nunz92nN0/abXjlzPg/MXA5mxddnFsbw8s/HuRvGPZvQddHWmhc= 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 1789489966224516.3321212594028; Tue, 15 Sep 2026 09:32:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x6W41-0005w0-Hg; Tue, 15 Sep 2026 12:31:26 -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 1x6W3d-0005u0-NT for qemu-devel@nongnu.org; Tue, 15 Sep 2026 12:30:59 -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 1x6W3b-0003lv-Lx for qemu-devel@nongnu.org; Tue, 15 Sep 2026 12:30:57 -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 68FFATvn4176138 for ; Tue, 15 Sep 2026 16:30:53 GMT Received: from mail-pj1-f70.google.com (mail-pj1-f70.google.com [209.85.216.70]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4gq3hc2df4-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 15 Sep 2026 16:30:53 +0000 (GMT) Received: by mail-pj1-f70.google.com with SMTP id 98e67ed59e1d1-39e087a18deso1363332a91.0 for ; Tue, 15 Sep 2026 09:30:52 -0700 (PDT) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-39dfdd0baaasm6068590a91.9.2026.09.15.09.30.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Sep 2026 09:30:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= zF7wNM0uK32PaFnM0cjYMMOMVW+Srqc+PhvZl4ELL8A=; b=B3ehBxub/r0elv+J llZxyEYBzR+JHq9BybRxAYsmYiEIcLU5d2QgAWN5+R1u1plqNdNdX4guABjphtg+ OT2eCZEo2+4Bg0b5gqWF9SpmALSzYqjNHIEQtOTWgXcpm3MmUchSjF6vmWs4CBgy r28QE2IgD+47LUlPHmk1Ki7kcONtsP/i8WGyrxnjqe84nMu2wBLqamS10e5fCWSg w8zwkqfOUIe5wgp8dUGu2G01jZKt/6UvEHpdop3Eq9Mbty2bO02cMK+eIeu7iHl6 W+mi3kwU5/6D6MhNNi+aBqPfvrhWtf2UCat5Aq5fQAy54Mp3ebQdubwMkyDVSp+T pZE4BA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1789489852; x=1790094652; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=zF7wNM0uK32PaFnM0cjYMMOMVW+Srqc+PhvZl4ELL8A=; b=IJY3GyjpvGsM3vq5FnsjM6jdLoL5avzy7VMGN7GVd9uh8Awb+rGD7xsz0xPZi9Ua3r QMmGcReADIyzoMcbnirbKj2tG7uRfEb+3SZm7pdPavL2naXj6uX9q+D38p6UIEbnmWon /DquKFmCL/nA4zdM/Nj0zx5IF+35RXgtq3273k9pDfb8l1A7awqSt1DuUgX8+UJtXZq3 RyVQRJ8xEktrVpxThCnpYd+lBKAjbVqRSZWpZzXbjKTr3PNLK0jD/98YDlukGsohMzEj tuKXnNjgZfxHzL69x3NG3VILQTf8pR9QkW8VDy9qVkbpRmn929MFxQTd1m/bVUrHxqT2 jIfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789489852; x=1790094652; h=content-transfer-encoding:content-type: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 :content-type; bh=zF7wNM0uK32PaFnM0cjYMMOMVW+Srqc+PhvZl4ELL8A=; b=OUgM7nPKqkC7ezprzHsWccHBNVPsrctPgcDrsR3YEPsOgDPgBxGwTfokZnx9ms4sIs eoO4NvW/GuhvNtIhKyTFoJFnx5q0E15w5+cWsTdZf2JSWV30bwzCO/oAKkTKRUNS24+v 5fTOphor6pmBVVI/odRqJpirMXPpbz7x01M+uM9LL4oBrcZ1d8n6Zm525nNfNrBjGsga J9byg9OJrQZU5ngDyWBcnAAXofhdndHxcXp0QKrPE4S4sRdKfZN7/YelHTuDiRx0ursY Tww5VVZweotot6ejQKESqOvxRewPDLPeJImLuCNv4L+ZS/z2SNgxzyalbmqHNs0PePZ6 9DFg== X-Gm-Message-State: AFuF++k2dxdQyR9pCiHt5VjXbPxqV5ThZMCcH9QAFJmpHyoV8rnoQAMZ KyblpuRKXfO9IawVpZYsvhLGIvIhsLZb7NuJ4jSxss4jQ30XoFAiGg48GK4xWtm9hmWLf8vr+vV FshozwCB3oFgxjspNih1ADsVbx8wHXbexJBg9cpr/MrvvEmg00MquO7lbIlW8AddISw== X-Gm-Gg: AYBFou0Zp1zLWTA/w7FIAvHt/N+arXe37A0BISefGe0/AJAoFerVqymDxSo+9MuZ9fz 5VsUfLDIHylMDfY2DwhrlizbztPflHqxvhI9uVphRcYarCUedteFGvips0QYjVX5D6TQjBGbAOI Ze/vVzBgSdFMavnIr43BwVHbGjCCBB+CINIlQymdRcHxwcPmOC1qKN0kJESF366rq/JnBdxjhQv mdIWbbgoh8lNJJy7nEBNi9gYWsYDpK1Jk1/x0YbyYy9CgeTZRTeHOgAmRckeEKw/xmoud190ja7 7KGVPUYTJFmuXfL563zizY4MfRD6afUQiYOFIQi6ZK0tIbqF0/gmIdyYdnLC++VBYkWbbbsp74z UXct3yFNwDnj5ACsXGSzqzJa9NnEyOL5GJzJtKbVM8nbfnQbH X-Received: by 2002:a17:90b:4b0f:b0:39d:f4fd:8075 with SMTP id 98e67ed59e1d1-39df4fd8118mr12196478a91.19.1789489852387; Tue, 15 Sep 2026 09:30:52 -0700 (PDT) X-Received: by 2002:a17:90b:4b0f:b0:39d:f4fd:8075 with SMTP id 98e67ed59e1d1-39df4fd8118mr12196398a91.19.1789489851836; Tue, 15 Sep 2026 09:30:51 -0700 (PDT) From: Brian Cain To: qemu-devel@nongnu.org Cc: sid.manning@oss.qualcomm.com, Pierrick Bouvier , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Brian Cain Subject: [PATCH v2 02/17] tests/tcg/hexagon: fix undefined signed left shift in brev.c Date: Tue, 15 Sep 2026 09:30:32 -0700 Message-Id: <20260915163047.4180600-3-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260915163047.4180600-1-brian.cain@oss.qualcomm.com> References: <20260915163047.4180600-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: Sgxl3LDCXBR00vgxBoFKNpzKP_I2xq1s X-Proofpoint-Spam-Info: AW1haW4tMjYwOTE1MDI0MCBTYWx0ZWRfX2mGmHdrbPak1 /81nzJ1wCJnmaqs1l8j+Nscv1kOQnEgdrXjUBNwSbygp/1BprUzJhZZtdoPd4tIgAeFRxDPDxU7 6xrakBgIiZszylf2+c8o82WvVh/m3No= X-Authority-Analysis: v=2.4 cv=dcUVTnXe c=1 sm=1 tr=0 ts=6aa972bd cx=c_pps a=0uOsjrqzRL749jD1oC5vDA==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yOCtJkima9RkubShWh1s:22 a=EUspDBNiAAAA:8 a=4mfA0qixJg5lnvjYkK4A:9 a=QEXdDO2ut3YA:10 a=zZCYzV9kfG8A:10 a=mQ_c8vxmzFEMiUWkPHU9:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTE1MDI0MCBTYWx0ZWRfX5iwg521T45I2 puAT+Pjl9+TvN7KWV57YGbKBWeOsLZS38ZgvmgYCZKfBt6Vp50Q+ZmCyh2VssGayQWI6RcH/8L5 Tj3saZ+68XjSSbcMawn8ItQIR3j3t/mCUjyvfTjbPDnt3eZNIUZJTf89c/LkN8Mq/UDvrAy1dZX SfkDoZc7/uQ2q9G/JNvOkHKFpCy3TFg3Cva4qKdBfvv3k2y51Z0mYfLbdRAwpuLSmM/IxzH7hsS N4Jx0wILIHXpZmjbqUZId1qjGJibVEGmy16Rz54zLJGctnJhKFck6oPinPAtJMSYaW9OaAvtryv 0DAlMp4ZXPXAufapgcp3HZM6dv2qkTuQsl8Aa5t6/KL1bhQy/OYMX3coEfeT4Eiy/tbI5saLTXl 2zLtOAF5U8DMwjCE9+IeLmH3/D45vi/zSYMgHLFb4eJQ0wep5ADsBQOiiqGd3w6V3HdanV4WPAR FvVvsTX21RQ/rJgqrIg== X-Proofpoint-GUID: Sgxl3LDCXBR00vgxBoFKNpzKP_I2xq1s X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-15_04,2026-09-15_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 bulkscore=0 impostorscore=0 malwarescore=0 phishscore=0 suspectscore=0 clxscore=1015 spamscore=0 lowpriorityscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609150240 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=brian.cain@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, 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: 1789489966593158500 Cast to uint32_t before left-shifting in sext8() to avoid undefined behavior when shifting a negative value. The subsequent arithmetic right shift on the int32_t cast correctly sign-extends the result. Found with UBSan. Reviewed-by: Sid Manning Signed-off-by: Brian Cain --- tests/tcg/hexagon/brev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/tcg/hexagon/brev.c b/tests/tcg/hexagon/brev.c index 6c7b1340849..1473e309ee0 100644 --- a/tests/tcg/hexagon/brev.c +++ b/tests/tcg/hexagon/brev.c @@ -106,7 +106,7 @@ uint32_t bitreverse(uint32_t x) =20 int32_t sext8(int32_t x) { - return (x << 24) >> 24; + return (int32_t)((uint32_t)x << 24) >> 24; } =20 #define TEST_BREV_LOAD(SZ, TYPE, BUF, SHIFT, EXP) \ --=20 2.34.1 From nobody Sat Sep 26 20:01:26 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=1789489908; cv=none; d=zohomail.com; s=zohoarc; b=eH1OLqROCZyjZEiVt3iDqf47Zl2E/dNFEfA+s+UBgXPgbnbnSyXXf8xErCF4imjSvkxJW4XpZgWomXGjJ0xtlfaVSOhKGy+mG1c3Hpw6minpefc8tn646hKUW/GHe5A5AlKk0fs7+HS9ccXCAbfzhpw33iV1wyttjcx6NcUGXu0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789489908; h=Content-Type: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=IcJNdY4hlB5wuvciSxp0uXAgBsXsEcVgYAWPzivXFtc=; b=Y7zAF5T904svML7ry82EhQbkcuocUSgT0Z+NcklzhLqygTE8Z1C+wMnggMpRrk3i0eUfp1RN6WdWD4n58uIEgM03hv4qR5GdQfODLXTm06/Y0zuGYTgNcLOsSuIUWQq/AplpvH/riofUlr0scXVunuk3wRbXFrT0MoxXXLe0zcE= 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 1789489908726734.4722456686924; Tue, 15 Sep 2026 09:31:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x6W3u-0005vm-8a; Tue, 15 Sep 2026 12:31:14 -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 1x6W3f-0005u7-43 for qemu-devel@nongnu.org; Tue, 15 Sep 2026 12:31:01 -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 1x6W3c-0003mI-9g for qemu-devel@nongnu.org; Tue, 15 Sep 2026 12:30:58 -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 68FFAQMh813414 for ; Tue, 15 Sep 2026 16:30:55 GMT Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4gq6kc170e-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 15 Sep 2026 16:30:54 +0000 (GMT) Received: by mail-pj1-f71.google.com with SMTP id 98e67ed59e1d1-381250979d5so5309995a91.0 for ; Tue, 15 Sep 2026 09:30:54 -0700 (PDT) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-39dfdd0baaasm6068590a91.9.2026.09.15.09.30.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Sep 2026 09:30:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= IcJNdY4hlB5wuvciSxp0uXAgBsXsEcVgYAWPzivXFtc=; b=Bn+LNovqns+vCGb+ t91yGgu19ChCqsd+q6WyWB9O5NZ56GC+q9JHGlr2hIdz6vZZcqm+3xLuraGfQ9ML rFODfnhl2FwDTC6BMXHy6Dcs5qxC3luSGOYrQSDxJpG3wQZ21f0gGjgcId0Wf47N H807QCk6MSy/DIuQfgqQrqHlxFvif73Cu7bgVfOtaQVXCM7aRWJjtTxYH/sqyNSL jJQOjkwH9jABPaeR28iTv8fPAeIWmqyYuTsSwSKECZXovPXvod8xnFekmQVOyjo8 DwTFLblwAQ5bHhDE4Jqyezl7awWhCAG6Oueimu83xMIIr0xRsOE4ogIp4Jsf5VxN x4PK4A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1789489854; x=1790094654; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=IcJNdY4hlB5wuvciSxp0uXAgBsXsEcVgYAWPzivXFtc=; b=cuBJTYm0fgNjVwpEEIxB3Lcd+EYR8bCVzr+1C0XJ3WOIU80G41omiAw22oohjWgzuZ zaJeoLBe/xZlI0QawyTm8D1MOdNI6OvgdtfuxsZWdtCpbAR2Q4D/IkJzKi7/fkqOkMW5 0/fjZ9YVV4cceYNMPEIlgRittGG1qtMoOvOWtolnVHvn4TEQZ7vbGEN9T1+ZPh2La7rP ApjvxHogOMe+HthTWTLu5O8uoIP2r9IC2hy8ltkrJAfWZJO0hmK2TyPBpp/rPyAjkMAE gcRiB1/qzJq/FG8co9Xkbu2Dsg3NDvhh93mvSkvzOePyReoFU7zb6lP/XoOXT1Fw+ErS L7jA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789489854; x=1790094654; h=content-transfer-encoding:content-type: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 :content-type; bh=IcJNdY4hlB5wuvciSxp0uXAgBsXsEcVgYAWPzivXFtc=; b=PXct1U7wtI4NOBGjTUtAHdE6v80K7g5p0FmNw6jd/FflJ2uz3TMHkWBvqTfITEsrAf f4vrL2WOWHf/yqQXPU7U2+qFLLZ+iXGSqFwUEYo8Lb5QpNKa/rnHJB5/mXIMtwY/Sq+v pfXeHTkmyM0FZDOoTWLQsvGTwqmMCwEMlNxpjS5Mgkca/8vMOZ+JWrnEt4eVGgSJM1KD AgPq04xDThAi/tSGRda//T6Bv+fGbXp3v9a2Wi7zqZoDUZv0BpHcsIDXbtY3r+jUpprc wGPm6vv5TpH6vzGeoVbL5KcdtVJQhzu8x1ulpUK1KKVIR7dIUDRtJcJVA//u7Sh1BIIe BuAQ== X-Gm-Message-State: AFuF++mGOFnZhTzZ0Cz/XGNcQVj3Fu3bw0PDZweY9QUM/mMXK7pIT1S4 FJ7FgZ0zfTQmp7XHF9r7X4NCV3Ul6cxBxG+rFqTsil+8gw5sFOmEy3ALDhkQ/vXhRbHJdvuIoUN +THY9so09WxrwupRkyxGJkfXmYQQJbQ1XlKwEpI6Y2ojM+ce8lpFY6W2BsHfuvbzktg== X-Gm-Gg: AYBFou0HoOduMytV7R3rRW/h+EqqSK3b4c/xGWTUnUXhLxL3i1+TllaE9yfx01pUtab 7pJDsN/UBg+CeGmogc1QKmVnzKKZh4n7KTJChAFT0IFCLhHFgI3GTlBHqhprztvrKDe9lSNHX7i +6xWf11FW+KApFSRyyCwpz605DU9cJIpR9pXUOwxX2qNV3tO68vnd1RfXDrSWWcP7E8fZoXUAN3 puPOnv9pM9Iug7ssny7k/hvdhE0pk1inqNbxfW2CHe4Os4NhxfxbxjhbxbhIrgUbM1Ly5E2ZqPp I23zex0Y9LYOrciMYTORHaJabc4wCh2HkK5i6fzkAdVXLOEjHVMoms/kFg2lUD4uohoHJ+CFNkH YbrtUZ90WNr9DLLltu9dUvKVeIcrlnn5uJEP+tiM1iplOiNb5 X-Received: by 2002:a17:90b:1d52:b0:39d:f189:48d6 with SMTP id 98e67ed59e1d1-39e10c45f67mr3360672a91.4.1789489854010; Tue, 15 Sep 2026 09:30:54 -0700 (PDT) X-Received: by 2002:a17:90b:1d52:b0:39d:f189:48d6 with SMTP id 98e67ed59e1d1-39e10c45f67mr3360631a91.4.1789489853449; Tue, 15 Sep 2026 09:30:53 -0700 (PDT) From: Brian Cain To: qemu-devel@nongnu.org Cc: sid.manning@oss.qualcomm.com, Pierrick Bouvier , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Brian Cain Subject: [PATCH v2 03/17] tests/tcg/hexagon: fix undefined signed integer overflow in hvx_misc Date: Tue, 15 Sep 2026 09:30:33 -0700 Message-Id: <20260915163047.4180600-4-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260915163047.4180600-1-brian.cain@oss.qualcomm.com> References: <20260915163047.4180600-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Info: AW1haW4tMjYwOTE1MDIzOSBTYWx0ZWRfXyhVJTaQWagDZ X0k2iXsIOhWfDRod4Cu/rEiI22EbvMmZrgCHRHjan1OP82AO/HE7CPQ7NLb31fsszCwmQZXD6It dWqErnBkNYZAt9SAJeQRzTNwg/JW3mE= X-Proofpoint-GUID: epXn0lrVf7ihZn5iRIYku-YqxwZCb5Fb X-Authority-Analysis: v=2.4 cv=ZINCCn7b c=1 sm=1 tr=0 ts=6aa972be cx=c_pps a=UNFcQwm+pnOIJct1K4W+Mw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=Um2Pa8k9VHT-vaBCBUpS:22 a=EUspDBNiAAAA:8 a=7jozP2JQLfe_envvOV8A:9 a=QEXdDO2ut3YA:10 a=uKXjsCUrEbL0IQVhDsJ9:22 X-Proofpoint-ORIG-GUID: epXn0lrVf7ihZn5iRIYku-YqxwZCb5Fb X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTE1MDIzOSBTYWx0ZWRfX0nuqPnRWqS5A QEiYuA67WSPImcKG72XBq/xSIygNY6ecFMf50tk5mXba4YVVDqbiPOZbgh7H/C0UgSJr2U6P2X+ TXfDGXAwcWhXbXVqp5KyRlGPkmkxuwikV0yMLdvck7HtHOGpExegK1A/HP0vowSODWcXLGkS4V0 2jdKY+p9niu/9ypNxYIpEy7YulpYcVHU/FEirhH+wbf99NYaamLKphkaKXweBBtxMOEuJfYHmxk IpUmTHeq0r7Xl0HZDs4EO7hPhpBSjAlL2B37RQnLX4bJBBNEOXuMbJmODd9lq24GLYIGcazvyZq BzfQ0FowzkmRZN4uVWAgxvIR1wNVmo/g1JRZjpX9ocHtFDT9VP9R6OPDBycFZwZdzkQeKGCe0Zj D6q4HCnNI5LSeAFt3XVM9hOuPzPNZ1Tagjoo34FrUGit1PxIiPk/Di3UybI/Fp8J4stEXMsfe7C Ogl8ADPOwwY83HcNEGQ== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-15_04,2026-09-15_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 bulkscore=0 phishscore=0 priorityscore=1501 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609150239 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=brian.cain@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, 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: 1789489910653158500 Use unsigned (.uw) instead of signed (.w) array members for vector addition and subtraction reference calculations to avoid signed integer overflow. Wrapping arithmetic is well-defined for unsigned types. Add CHECK_OUTPUT_FUNC(uw, 4) to support unsigned word comparisons in the TEST_VEC_OP2 macro. Found with UBSan. Reviewed-by: Sid Manning Signed-off-by: Brian Cain --- tests/tcg/hexagon/hvx_misc.h | 1 + tests/tcg/hexagon/hvx_misc.c | 18 +++++++++--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/tests/tcg/hexagon/hvx_misc.h b/tests/tcg/hexagon/hvx_misc.h index c21ea975c16..e32715ed11d 100644 --- a/tests/tcg/hexagon/hvx_misc.h +++ b/tests/tcg/hexagon/hvx_misc.h @@ -69,6 +69,7 @@ static inline void check_output_##FIELD(int line, size_t = num_vectors) \ CHECK_OUTPUT_FUNC(d, 8) CHECK_OUTPUT_FUNC(w, 4) CHECK_OUTPUT_FUNC(sf, 4) +CHECK_OUTPUT_FUNC(uw, 4) CHECK_OUTPUT_FUNC(h, 2) CHECK_OUTPUT_FUNC(uh, 2) CHECK_OUTPUT_FUNC(hf, 2) diff --git a/tests/tcg/hexagon/hvx_misc.c b/tests/tcg/hexagon/hvx_misc.c index 32a3661a86f..f20afc8e670 100644 --- a/tests/tcg/hexagon/hvx_misc.c +++ b/tests/tcg/hexagon/hvx_misc.c @@ -55,7 +55,7 @@ static void test_load_tmp(void) pout +=3D sizeof(MMVector); =20 for (int j =3D 0; j < MAX_VEC_SIZE_BYTES / 4; j++) { - expect[i].w[j] =3D buffer0[i].w[j] + buffer1[i].w[j] + 1; + expect[i].uw[j] =3D buffer0[i].uw[j] + buffer1[i].uw[j] + 1; } } =20 @@ -285,8 +285,8 @@ static void test_max_temps() =20 /* The first two vectors come from the vadd-pair instruction */ for (int i =3D 0; i < MAX_VEC_SIZE_BYTES / 4; i++) { - expect[0].w[i] =3D buffer0[0].w[i] + buffer0[2].w[i]; - expect[1].w[i] =3D buffer0[1].w[i] + buffer0[3].w[i]; + expect[0].uw[i] =3D buffer0[0].uw[i] + buffer0[2].uw[i]; + expect[1].uw[i] =3D buffer0[1].uw[i] + buffer0[3].uw[i]; } /* The third vector comes from the vshuffe instruction */ for (int i =3D 0; i < MAX_VEC_SIZE_BYTES / 2; i++) { @@ -295,7 +295,7 @@ static void test_max_temps() } /* The fourth vector comes from the vadd-single instruction */ for (int i =3D 0; i < MAX_VEC_SIZE_BYTES / 4; i++) { - expect[3].w[i] =3D buffer0[1].w[i] + buffer0[5].w[i]; + expect[3].uw[i] =3D buffer0[1].uw[i] + buffer0[5].uw[i]; } /* * The fifth vector comes from the load to v4 @@ -306,10 +306,10 @@ static void test_max_temps() check_output_b(__LINE__, 5); } =20 -TEST_VEC_OP2(vadd_w, vadd, .w, w, 4, +) +TEST_VEC_OP2(vadd_w, vadd, .w, uw, 4, +) TEST_VEC_OP2(vadd_h, vadd, .h, h, 2, +) TEST_VEC_OP2(vadd_b, vadd, .b, b, 1, +) -TEST_VEC_OP2(vsub_w, vsub, .w, w, 4, -) +TEST_VEC_OP2(vsub_w, vsub, .w, uw, 4, -) TEST_VEC_OP2(vsub_h, vsub, .h, h, 2, -) TEST_VEC_OP2(vsub_b, vsub, .b, b, 1, -) TEST_VEC_OP2(vxor, vxor, , d, 8, ^) @@ -489,9 +489,9 @@ static void test_load_tmp_predicated(void) pout +=3D sizeof(MMVector); =20 for (int j =3D 0; j < MAX_VEC_SIZE_BYTES / 4; j++) { - expect[i].w[j] =3D - pred ? buffer0[i].w[j] + buffer1[i].w[j] + 1 - : buffer0[i].w[j] + 2; + expect[i].uw[j] =3D + pred ? buffer0[i].uw[j] + buffer1[i].uw[j] + 1 + : buffer0[i].uw[j] + 2; } pred =3D !pred; } --=20 2.34.1 From nobody Sat Sep 26 20:01:26 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=1789489963; cv=none; d=zohomail.com; s=zohoarc; b=GykD/iCdJLe4EHduur3mP3LarUWxhkf7+oFDAjYa2Ag1tEFdKTWUWgnN5n832zmUJIcFlfvZMyo5s4yylC1/olBGGZRF1bB7Wh7nESrwtm+ZYxOxfz2cUlgHF6e1wtp0VuUaPqyFXQKcpYTWuZvOVn2zvT8ncHEunEnfnJ0Xr9M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789489963; h=Content-Type: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=JwcyVV0Im3vuhgFNU7i08puH9HDt/9zr+/Z/bFI5GJ0=; b=J2m2YLxmwhMOZyPFKNj04R956+I/NdZG8tG0nuNj3x669Ws8jyjNpPPS6+EBrjnngzwhW+m1ECBpwzmSS4YBGwelEMXBnuul57+TN2p297N+UaebLqlca8qa3RvRwlFSQtoZE0OV7lTOcOQsxb7g7Nl3WhA+pmZCIBcGPWqDMt8= 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 1789489963762538.9219329722409; Tue, 15 Sep 2026 09:32:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x6W49-0005yF-29; Tue, 15 Sep 2026 12:31:29 -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 1x6W3g-0005u9-Q8 for qemu-devel@nongnu.org; Tue, 15 Sep 2026 12:31:01 -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 1x6W3f-0003ms-6q for qemu-devel@nongnu.org; Tue, 15 Sep 2026 12:31:00 -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 68FFAT8F4176137 for ; Tue, 15 Sep 2026 16:30:58 GMT Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4gq3hc2dfn-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 15 Sep 2026 16:30:57 +0000 (GMT) Received: by mail-pj1-f71.google.com with SMTP id 98e67ed59e1d1-39e087a18deso1363587a91.0 for ; Tue, 15 Sep 2026 09:30:57 -0700 (PDT) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-39dfdd0baaasm6068590a91.9.2026.09.15.09.30.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Sep 2026 09:30:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= JwcyVV0Im3vuhgFNU7i08puH9HDt/9zr+/Z/bFI5GJ0=; b=cXI7DjvdC5jfZJbQ uuXyWTUOhGn5RRZOVTRIjds/6w6ANwzj/ol9LJL+IuZrD7ORlEk6DchrW8BIaUxF IX+Hj6s78p7I5X+Cv/pRPasdTE5HRv9rLtGjOvQqHaw1qWyNY0ksPxy1Vi23GJxF /OjPf/jTatcHUbEajbBt+cC7pvGK7mvyGKb53F/C44Cu0ZmvRZ4WDv0tG9H7//GU lzp1LoZQZRjgBCyfUHoP5wAj7AhkvT8HFgfxVtKgCTEARhmAF/4NA1oAFC62ffRI BuKzqTo2QQ2Wrk/zlrf2kWF9OwJpGXY2iWfu9+6le0b5pFK+mQSNI7reQCjbc8UZ R2iWIA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1789489857; x=1790094657; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=JwcyVV0Im3vuhgFNU7i08puH9HDt/9zr+/Z/bFI5GJ0=; b=ieYGI4jt2+hkwAYfdqfYtHkEV6Af0i15YHXUBD3WTgcaR8/VUr9wMlyqU8xsRp6JUg r1i5jMgS5PDVPTfmKsjh//CsAVEASIQMJOVtIOjsoA5lK603fdB2nAbAusUV1tlG4jt0 fMik6EIg/2KZSTPIwaPZna5oSWoj2A+61OIlaSi+jArDxz/3J3nZovWyK8Ri5uoPOyfx 2xbyXSvOqBuRimDn1wkLCYUROpRmqU0wL+xggdS5CYsAaZNF4piXosDoELOn96SDl1d3 fQ8y/K3b6r/cpuYzymqrmnXIwN0ElTMqERYd6GKgSdaPTNQdWwIJpkPr2h1YL8RKFZhB 0CyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789489857; x=1790094657; h=content-transfer-encoding:content-type: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 :content-type; bh=JwcyVV0Im3vuhgFNU7i08puH9HDt/9zr+/Z/bFI5GJ0=; b=kS+ECnXmNzxqiL75GJxgNpk/mrMOdtpBzMZMazAcnt1UKoYNgljU6QIKVUpAWnz8GH gghxx6wLkhu3LMA5b9PKL3u027KEps5F6mXTFZe61yZSoGu7+d/oyliRoAUE41ZdIQJ1 1Z967YWwfey+TUkPAMe1WU9gGnA++kGgTunZGcDueBxTN9B5d0+gFzm4qCXdlHyaLd6C 3Bvr0gX8KWLsDOFHIAIC2JRWBBeR6eXmqfaLDaEuwE371bE7q6uMfZxH0idt6fqsMAqS AaApWwR/SlEp+3Wzf8FCSEUYru4JZYUkvVAerTL8r1oKxyx9Mulos0EZ6JgJCDUfVHqw kc9w== X-Gm-Message-State: AFuF++njRQ7AcqyifxYeBWxhzwPx8INmuOuaO9BY3fU14A7EcR/r/OX8 A+8KS/ahOAgwSP7EqWy7J5v1SEoMX2bng+5AGaBxsfOoPzMhBGz+kJsNR+oZnOCMB2fjujcxs6T MjqESnPcTll0hfJSAZV9lyF1RCBcGHAxS/T48L8bZTHd7LlNXT8S8dPNGuJW5/8vF6w== X-Gm-Gg: AYBFou3yjloYx/g9OAZgOf6AOHt7Gr9PI/EiJpXuiw59K2XipgHgIr8J4Z4g/SZ5los pPDV6CDOuJcLJK0c2I+Po5eWk7P/GYc7ldppWYfS2yeW7qtlU/GnK0mGiXbw0eo6CfuXQE8jEfi gN18LmEg1OmMNNWQVANBNVJrckauau2NwEhQGf6rjb5rcGFNpYaiXH4QlmcEvJzG0Zne/PqHVw0 /PAiN1lIL5vbnkwSZR+FTc2bHCb+YDoJzT3L9eCdoL6V0fl6+JCHwf8K0eZQdAt3MpGbR+qg/bi Ynyu1m1clP3ftVjCI5GKYNOiq9V1heDhddR+CMt+E1ziPzUcR/f7leMrWd0nmaf/ZYHVrFzSBkW xiCsSmi9RIklFIOApcJ9LFSqCL2WhpUnNLwnb10hHTe9XATHb X-Received: by 2002:a17:90b:274b:b0:39e:d2a:e25a with SMTP id 98e67ed59e1d1-39e0d2ae7c0mr4017906a91.13.1789489856905; Tue, 15 Sep 2026 09:30:56 -0700 (PDT) X-Received: by 2002:a17:90b:274b:b0:39e:d2a:e25a with SMTP id 98e67ed59e1d1-39e0d2ae7c0mr4017839a91.13.1789489856409; Tue, 15 Sep 2026 09:30:56 -0700 (PDT) From: Brian Cain To: qemu-devel@nongnu.org Cc: sid.manning@oss.qualcomm.com, Pierrick Bouvier , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Brian Cain Subject: [PATCH v2 04/17] tests/tcg/hexagon: fix undefined integer overflow in v69_hvx.c Date: Tue, 15 Sep 2026 09:30:34 -0700 Message-Id: <20260915163047.4180600-5-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260915163047.4180600-1-brian.cain@oss.qualcomm.com> References: <20260915163047.4180600-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: bP9GnjSMNwsvN3xK4MizkepkkOpfLOZ_ X-Proofpoint-Spam-Info: AW1haW4tMjYwOTE1MDI0MCBTYWx0ZWRfXxkKZ5vllkC0B MD3ejPlR/TV5dvifYtrrBA0/1khplQaAXnUoYgMAovibcsYniYN4RAUHR7IuOlOQ0RwhVU3brc6 rH8fXY+p4T+hOYSHy9dfNUEv4Zz/M4A= X-Authority-Analysis: v=2.4 cv=dcUVTnXe c=1 sm=1 tr=0 ts=6aa972c1 cx=c_pps a=UNFcQwm+pnOIJct1K4W+Mw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yOCtJkima9RkubShWh1s:22 a=EUspDBNiAAAA:8 a=hLQBpLl1in5vK7AdPdsA:9 a=QEXdDO2ut3YA:10 a=uKXjsCUrEbL0IQVhDsJ9:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTE1MDI0MCBTYWx0ZWRfXxWnFk6LnpR+a 9UZ1ZHyVUMe95NjxOO3afStKGErOGEgAzVfPxcLUUYJioJw0hge1m/tNuRBBpMMBIKQS6O58alx gDY/QM2enD54rbDogIuozTBoXNHyivtuOHG3xhnuJrjIAyDbuiNUxsFJtawY8UU3Gz6of+nD31C 9IMDWmwbvpWN06Yu9AW/vCLa1f+d4m5095nwen+cDyE0tiGpRnMQp3iyUSPK8g7b6FB6izDrBGb Vt4WH8ArMYO9JOLaF7KTym4G0bgr33aonelmYWAXZLgYiSI4Omt2Yl89QwlUjrBHMnF0Y2GIhaO T0QagXx5gfbxszj7ci4uJPgGtpQANamPOfU2t29q1DRUME4tUpSZJg05uQha0uq634bNdqgE8EP tIDA4lmSBHg4JwsTjzHqgbjwihuNOQb7DOODTYSb9c8hPzqw738LJLNWQsJub3ApWMwV0sj7Cim WClFk+XrxFO2kbiBFKQ== X-Proofpoint-GUID: bP9GnjSMNwsvN3xK4MizkepkkOpfLOZ_ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-15_04,2026-09-15_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 bulkscore=0 impostorscore=0 malwarescore=0 phishscore=0 suspectscore=0 clxscore=1015 spamscore=0 lowpriorityscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609150240 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=brian.cain@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, 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: 1789489964569158500 Cast to uint32_t before multiplying uint16_t values to prevent signed integer overflow. Without the cast, the uint16_t operands are promoted to int, and the product can overflow the int range. Found with UBSan. Reviewed-by: Sid Manning Signed-off-by: Brian Cain --- tests/tcg/hexagon/v69_hvx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/tcg/hexagon/v69_hvx.c b/tests/tcg/hexagon/v69_hvx.c index a0d567d142f..eff936064a0 100644 --- a/tests/tcg/hexagon/v69_hvx.c +++ b/tests/tcg/hexagon/v69_hvx.c @@ -292,7 +292,8 @@ static void test_vmpyuhvs(void) pout +=3D sizeof(MMVector); =20 for (int j =3D 0; j < MAX_VEC_SIZE_BYTES / 2; j++) { - expect[i].uh[j] =3D (buffer0[i].uh[j] * buffer1[i].uh[j]) >> 1= 6; + expect[i].uh[j] =3D + ((uint32_t)buffer0[i].uh[j] * buffer1[i].uh[j]) >> 16; } } =20 --=20 2.34.1 From nobody Sat Sep 26 20:01:26 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=1789489975; cv=none; d=zohomail.com; s=zohoarc; b=YX6s8ngdo+IeGYZcQltV1QIiJFQNY8mbCL/z9pd3jkjNbztNqx8I+5OCsvWB5rk/bVLyN8xEppmP367xfq0sRuC8/6VVWcBha4J7SdnFDQAqnJNDXnM/iAHnxsg/BoG+Hw5PcUdbi78zsQdiW6Xpbf7tOaPNFkedBB3TosddLsw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789489975; h=Content-Type: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=mSFZtLAuVFymlxGuE/xeSBNBNcWYKAtnUcskIIJlCHU=; b=AbXLqC+6X99VqqdAAFVFmSHKxuZ/Nofq6OFV2aUWrhyMmGrEKQQzw6M3mqlQNRCtIsjSqnuZrHSnVq1lLhaytyjYIVeiVYhXjpA+i91dQS61YFu9sKRliRwUdci6jJneTT7+6gfKOGPVHbfinGpXq6YCHUQm4zbefpNhPNaY7qo= 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 1789489975839370.2960709470566; Tue, 15 Sep 2026 09:32:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x6W4J-00061L-53; Tue, 15 Sep 2026 12:31: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 1x6W3j-0005ur-7N for qemu-devel@nongnu.org; Tue, 15 Sep 2026 12:31:03 -0400 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x6W3h-0003nb-LW for qemu-devel@nongnu.org; Tue, 15 Sep 2026 12:31:02 -0400 Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68FFAYj23958808 for ; Tue, 15 Sep 2026 16:31:00 GMT Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4gq2y2j24t-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 15 Sep 2026 16:31:00 +0000 (GMT) Received: by mail-pj1-f71.google.com with SMTP id 98e67ed59e1d1-38f283baf1fso5355927a91.3 for ; Tue, 15 Sep 2026 09:31:00 -0700 (PDT) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-39dfdd0baaasm6068590a91.9.2026.09.15.09.30.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Sep 2026 09:30:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= mSFZtLAuVFymlxGuE/xeSBNBNcWYKAtnUcskIIJlCHU=; b=cMDQybN+FqNQcnPT KQU6GJ8iVBH/oCn9J3Z6bVaJ+TPzccnbE9B3wcHJK8SHyM6Ti5iGinH8IBC7qHNC W3be1UTeloX9DRvQOD2VOG7XAj4t4KsHhIWZiWzcLif3LUr1Wx62XgEIwtaMaANq taCnkRH5jPn6d+JIB4V+J1+bB3AtiXAOxnRYZGqzbDtBSBPPF6bkltElJepuEM33 124dWSshTSfGgaHxelnADsytI73UxK4X995YXJTNh/SMDNyID6sMEbKtgnuziDUm lCeXM3fr0sGNxNOHNyMlBsfKSMfrC9/81Se9cd82f2oQZeoGjSozLBgawQCC6PtM qWcfFQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1789489859; x=1790094659; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=mSFZtLAuVFymlxGuE/xeSBNBNcWYKAtnUcskIIJlCHU=; b=fdJ28gSaaKi1CDmaKAKnEwGrZoexibRtt1JQ9YYMJbydFn4dyq2wHqR40wi3eewncT S8Dbkl+ExQ7xIKJtgj9biyTK19AIUee50/ChXRszdmIs7CHHsZW6OTIzJG8lNDJfqsNA sUaQEoY8LIJ9dC4n2wWHjTEhydZglXf87ia0EnTofDThXmy1/FsM8zeWjySroWsgfELh fcLBUFNX0Et4t+I4opwgVCnxbVNRLM5p5ygWe+6AdRNPwFGEliVvHPPDNi3U2O3Iqcsb LfHOn1pCQEKfptwGBvBzftEpENh9oJ8WIUNLvjVeHvrEzfTtbfpwSGu2w2GxJQS4gXAL ciow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789489859; x=1790094659; h=content-transfer-encoding:content-type: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 :content-type; bh=mSFZtLAuVFymlxGuE/xeSBNBNcWYKAtnUcskIIJlCHU=; b=wprBkQemICOSCNDAvUoYgjKftDbsBbn3bXI/+oVvo68s19M3PwwXW5qEpil1xIOGWY eF6z0yACpIZ+9sbAsoNEFvM1GFdsS+5Xb7BO62CLj5y/uqOQ2+0yqyrieRYCAwS1h489 eHkTwFMp5OZM18ptvNY5tj9pxYnGXEFu0BDk3NYznrMMsuhtswks8unqgQktZTRgpA6Y HHw8DZTg209CLgRsWtnwNJz4zwCc6J6I4Oll3l/IpR6/h/7/a9Oay1WULPDxah0RHXnL nzvIhZ5jeeLTwCNUmVF0J9Er/dDtsSUk2/IvdwIQ9xNgi/phgbE1BRkYbH8zbeMyHVBD RY8A== X-Gm-Message-State: AFuF++m0is/Q0kOJMpHZaW3f2Yo9ob+SDL+oyc6uWxuicxQrofwuWwIG RdFK4jKZaRwFj3mxtG0+P9PTaDdGEXYe7GhQuflj3PpqRGfLEjfZPmG1tWasaHubbNBZk00h+oS vUnVfBSQA+LcDVnjr2HgbJvf7nkLYAQ5lfEZKOSRSHJMWZSk++jtD9IklAxi+BQObFQ== X-Gm-Gg: AYBFou2S76NJGm/UZwaie6E3cu+xWTBJAFPyCvuaEepcO2oJU9FKxQ96T0pxT/gIpez /mdg9udIoaFycO3Mw6ltqbQrgirhRDtfoFjwJW0UMqJ7/FvLL7p+eLA1J43zMN/ufKJtd8N8+6Q D4i/9uY169vZ0ggQZAn3GE4adsJlvykCaC+GT8lX2ohHqaWDr3N84Xs+5Q+FlZMbamqILVyDAxb Ze2yRfM+n10XLMeqtkZMU0nJndGH3sL5lJWkEhGkEoDZhIF3BGkWGX24AatS2a9whpQ6vD+j2+X sJlbYpjGMnen7T4eed2hHy/uAJgNHtLTPAdhZRquy4COeLxbVad9sXxTOQjQuwp+bxDIkiWEO8/ HQbZ2rl+PjCLP0/vx1PzAJ7NvbcWtvk03iDF+G8u0I5b2/BJ8 X-Received: by 2002:a17:90a:f944:b0:39e:1692:fd12 with SMTP id 98e67ed59e1d1-39e1692fed9mr1428291a91.24.1789489859232; Tue, 15 Sep 2026 09:30:59 -0700 (PDT) X-Received: by 2002:a17:90a:f944:b0:39e:1692:fd12 with SMTP id 98e67ed59e1d1-39e1692fed9mr1428209a91.24.1789489858744; Tue, 15 Sep 2026 09:30:58 -0700 (PDT) From: Brian Cain To: qemu-devel@nongnu.org Cc: sid.manning@oss.qualcomm.com, Pierrick Bouvier , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Brian Cain Subject: [PATCH v2 05/17] tests/tcg/multiarch: suppress UBSan for float-to-int conversions Date: Tue, 15 Sep 2026 09:30:35 -0700 Message-Id: <20260915163047.4180600-6-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260915163047.4180600-1-brian.cain@oss.qualcomm.com> References: <20260915163047.4180600-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: 3kxPbnE30QgP4aG6iEQkniFnrajY-Kxl X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTE1MDI0MCBTYWx0ZWRfX6meBBz8v70PO rf3cvHEa9O3ec+JKIOezyl16a/fi5zdeiAz62rzofpTghz1bk1MGldKoMTOqfGMf7ZrmgJMIvNL WVJr3msKMzUfLwqCbk0ewgX+lEWkL3w4mU8kcikFgldtEZ3twLzQtIlkTVKdwdI9nQuJSRI9za5 AZ4W+xbXB46aiEo/y10os9BuGs5vyKw7BGTlozju6G8MgPubqFEEZE7ne63lHAetNVOELz6M5vg 9M3dLUfKM8FXz2jftJqpFWfYmtap2J5Oy9CIBji+r7RZteLs/mF+k6/vopcDz2IuTMWQks8HsFP C/Q4JVkaY/AEomY+atXnlB7e4qy6YZedHjIYZfW17zFppPijTHLXn75WF/wFOiMpJ/wfSdhEJZ6 6Qeecsb9Byt7sPrqz4tkqg3rxWSovNix77VUJugDzWN0EVEiS/pxUpZvTSRn6skLxZHYrwBL4V/ AaLtcIs69IPi5I62fIA== X-Proofpoint-Spam-Info: AW1haW4tMjYwOTE1MDI0MCBTYWx0ZWRfX2oO6GRCE5J36 M+Y/+IMb+o9G8NFNLdrKYhSgJZAuf+QX0g65tFBAigjX9ra+D64o1UCT80PL+ZrNQPo3gRwxFl1 dFAJI62zlIxZumumgsrtxUVIEnGJYTM= X-Proofpoint-GUID: 3kxPbnE30QgP4aG6iEQkniFnrajY-Kxl X-Authority-Analysis: v=2.4 cv=IcISymqa c=1 sm=1 tr=0 ts=6aa972c4 cx=c_pps a=UNFcQwm+pnOIJct1K4W+Mw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=ZpdpYltYx_vBUK5n70dp:22 a=EUspDBNiAAAA:8 a=mocapJ0rodF7YK2GbI0A:9 a=QEXdDO2ut3YA:10 a=uKXjsCUrEbL0IQVhDsJ9:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-15_04,2026-09-15_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 impostorscore=0 lowpriorityscore=0 priorityscore=1501 adultscore=0 bulkscore=0 clxscore=1015 malwarescore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609150240 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.180.131; envelope-from=brian.cain@oss.qualcomm.com; helo=mx0b-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, 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: 1789489976715158501 Add __attribute__((no_sanitize("undefined"))) to the float/double to integer conversion functions. C17 6.3.1.4p1 only defines float-to-integer conversion for finite values whose integral part fits in the destination type; it discards the fractional part and explicitly makes it UB if the integral part doesn't fit. These tests intentionally exercise both of those UB cases, so we'll suppress it to get a clean ubsan run on the TCG test suite. Reviewed-by: Pierrick Bouvier Signed-off-by: Brian Cain --- tests/tcg/multiarch/float_convd.c | 1 + tests/tcg/multiarch/float_convs.c | 1 + 2 files changed, 2 insertions(+) diff --git a/tests/tcg/multiarch/float_convd.c b/tests/tcg/multiarch/float_= convd.c index 58d7f8b4c58..cb3884df974 100644 --- a/tests/tcg/multiarch/float_convd.c +++ b/tests/tcg/multiarch/float_convd.c @@ -62,6 +62,7 @@ static void convert_double_to_single(double input) #define str(a) #a =20 #define CONVERT_DOUBLE_TO_INT(TYPE, FMT) \ + __attribute__((no_sanitize("undefined"))) \ static void convert_double_to_ ## TYPE(double input) \ { \ TYPE ## _t output; \ diff --git a/tests/tcg/multiarch/float_convs.c b/tests/tcg/multiarch/float_= convs.c index cb1fdd439e3..584ce89aa17 100644 --- a/tests/tcg/multiarch/float_convs.c +++ b/tests/tcg/multiarch/float_convs.c @@ -62,6 +62,7 @@ static void convert_single_to_double(float input) #define str(a) #a =20 #define CONVERT_SINGLE_TO_INT(TYPE, FMT) \ + __attribute__((no_sanitize("undefined"))) \ static void convert_single_to_ ## TYPE(float input) \ { \ TYPE ## _t output; \ --=20 2.34.1 From nobody Sat Sep 26 20:01:26 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=1789489987; cv=none; d=zohomail.com; s=zohoarc; b=ivSgCw/ZTFk1Z/YdNBEUJxjG6NNreMDVRtoyHRwNo6QUxgSNsWvXM7KR3E7BcznhwCt1klxvPfsanGoMYNXnR0eIad538ujadE/Htso/ZD6AUdjLeBrwLP4x56F6ARKHdYmMSt0kmSFPwqRfkDCtk3Z2FWSI/Nqe2rSsX1hpnUE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789489987; h=Content-Type: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=d+11tnix2V/bt8ArMEcPhg4E6n1O2gIEaiQ5iZ3BXXI=; b=la8sbR0oHkxtY+Kw+0hckPvTb/QW+hNDcNE6UpQKNSmMhB4vyESQvIYQuzA569NpZuvJPj/kl4PVG60r3hqf6LmYN+Urms78WLpZeYq6gByWaE3sqa1D2sF386Ny83Y6Jl5ugJp8HuaDbJFTzqlSzAesCBYR+YauhVuL6J/SR8w= 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 1789489987301554.5867317789301; Tue, 15 Sep 2026 09:33:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x6W4H-00060m-NH; Tue, 15 Sep 2026 12:31:37 -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 1x6W3k-0005v6-V7 for qemu-devel@nongnu.org; Tue, 15 Sep 2026 12:31:06 -0400 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x6W3i-0003no-Qg for qemu-devel@nongnu.org; Tue, 15 Sep 2026 12:31:04 -0400 Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68FFAXDM3419329 for ; Tue, 15 Sep 2026 16:31:01 GMT Received: from mail-pj1-f70.google.com (mail-pj1-f70.google.com [209.85.216.70]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4gpye7317x-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 15 Sep 2026 16:31:01 +0000 (GMT) Received: by mail-pj1-f70.google.com with SMTP id 98e67ed59e1d1-39deda201bcso3200503a91.2 for ; Tue, 15 Sep 2026 09:31:01 -0700 (PDT) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-39dfdd0baaasm6068590a91.9.2026.09.15.09.30.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Sep 2026 09:30:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= d+11tnix2V/bt8ArMEcPhg4E6n1O2gIEaiQ5iZ3BXXI=; b=eWsVaOiHVzwYM52T tTY0BuWPYPa1IpgWfamJ4UUdy84AFRipYgWPn7+yLNsxHhC3K5nEWhDuAHsqlbbF UrM60U8ma9i+S2tzeefyFD5jKEDpXv790jl2H1GgP7zYDiPCN8IC9d4CnD6pyUtL RT1aBNP4YT7nM+6c3+XhqZQ2ryMXZJKQ+/7TccC3hM7mMpGKFgUJJnlk4PfhptP7 Zml/+uE/CwiodvLCfBzQNxLAZy0lqYEXn59TmN7T2Gk4Qg/y5uGjfDHm4h+JWlvC rl9yUMbSccMg53utUG+4+q+SdK2rbvwG8lFl5M9YSihqwp2MHtDzW4ZZYz9fnIJo cw/Oqg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1789489860; x=1790094660; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=d+11tnix2V/bt8ArMEcPhg4E6n1O2gIEaiQ5iZ3BXXI=; b=Epfa3sM9LfCmSgagoGZDlhG6JZ13aPANrHviPPJDmSK63gnf0aBH4IZ1GVkMG/gLxy CplesyuR8X5h8NaToYHXTVDW3WiM3wiw8P7o8XhDk56gbFk/uCmaoLWlNRLH4XXx9s4m +7h+yWo08z5cCJvJrHl2JZynCDwq9fX+9dzaMtUdoUqS+wlFRKGOTsU9SLUy3aJjvLiG ZBFsy/qSld/nVNs1yzH1GOW2pHnbeJ4d2usuvcDUSg+eEeT3LU6u7nuUe7viH5h0nma8 GZgzhfjtJbQGeuBCCbGEKpihwMdNxrV7gvBPi/wPZPWLClrDXnJVV8391mfFaPdFsYrz CQEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789489860; x=1790094660; h=content-transfer-encoding:content-type: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 :content-type; bh=d+11tnix2V/bt8ArMEcPhg4E6n1O2gIEaiQ5iZ3BXXI=; b=0zzR0+edUbK0RoCddUhvZFdUyrXVBn+97ulfj1sFqDW7OnZE6/UbuIXJznwULMKz5m Au2QFgYFdyr7V6397fluV3loScAHWf+JXVLAyB7PDLjQwZePJJjFPkC2XF97lLdFdbZz 7SC54Ig2p87BE0+3jZg1+w2k3Q7YHxqGGZm16UtMcrkcllDrZa42hOU45g+FCxsHunwQ Vv+I0o7ovg++pVoNE6X0uvVGih0sZTiIuVvvfM8dCo07awKK/xmSVDCZjmoHa5nF6V+V ALlRR1olPGGYoVEQP1JXqSCHR5WTiFD1+9QVitRBq6E7WiW/9p2IJageu1h+KlOyYOyl Wnxg== X-Gm-Message-State: AFuF++lVuXEDEcIas2lrwRy4ofA9gVpYiScw9SytS/xEOjUM2ETuVC0U e93BDoxkNksVPlvur2kohalkn/pc2FsS8+z+MYAIS0YIjMCRF95Mdk0ZV+/FPXm9/X3sR+jQ6R7 oWN7FsCPxYprdxO7easYYPyYpcDetcE85VUs8xrd6EFT5S1wY+KCBwwfa05Qi3e+9bw== X-Gm-Gg: AYBFou3WG5ixbgvihPYjimizUniEhfgJd2M4ig3MlERYwA4Irx5ycc9C1kt14MFzhDM 0g6CFrddmtzo6CBs3rc6dcNbrqHlTU5yQEgkJBADjJf+lb9ieNycr7OTp8lQ9P0G3K2dQhqRvFw 60MkLROvFAZ00u2cchYSbYMxQDN4/iIMBciGzs0OmBPpmXvkhDYTB3JfZC81iZMVu6oyJLRTrin nDT3ds5kKnTqm9RJku4/mzTQaKAypKu1orosJRgdeZ3Gh2WKpPTT9LYH95bTCrpfwZsv2sF1/A6 MVSQvM0yBAJ3VtCHR1FcS/qT3QZDPN04ubw/jeAG3KJrvtbXjsjbjfUjLWZ2wXaf+dE339TKJJo 4aXit4Z4t9YuQiH4Di3nXYpmCknNDRa1hROgAVJU+doqpm3D4 X-Received: by 2002:a17:90b:5806:b0:39d:f024:c7e2 with SMTP id 98e67ed59e1d1-39df024c8d5mr14127990a91.4.1789489860445; Tue, 15 Sep 2026 09:31:00 -0700 (PDT) X-Received: by 2002:a17:90b:5806:b0:39d:f024:c7e2 with SMTP id 98e67ed59e1d1-39df024c8d5mr14127939a91.4.1789489859979; Tue, 15 Sep 2026 09:30:59 -0700 (PDT) From: Brian Cain To: qemu-devel@nongnu.org Cc: sid.manning@oss.qualcomm.com, Pierrick Bouvier , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Brian Cain Subject: [PATCH v2 06/17] tests/tcg/hexagon: add FP classification, conversion, and fixup tests Date: Tue, 15 Sep 2026 09:30:36 -0700 Message-Id: <20260915163047.4180600-7-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260915163047.4180600-1-brian.cain@oss.qualcomm.com> References: <20260915163047.4180600-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTE1MDIzOSBTYWx0ZWRfX/ZEGjtxlsDLa XyLJALB7j/1ckfrtvSSludDPC0izHYrwxRHFMbd+7xZevKtS4HzzWc6FEao1DVZPoOWY/bMifMH MOh7ZJMp897MwOU9wTzjbtuA1DPGdFOKXo44AB5ob5/M2GL39lq5smP3dw/8v0B7z2iE2xI/oBu ygDBaWJ8Ygf13O/7mvMJCZRwTHTw9W1a1D/rAz6w81Pfyh/JdVB7UppGW1J57REEnaWIscXlsxr 2ChxcEkmXLHtDsku6SJy8RDHaNqcvMphEEudV1hw70nj2h0VjbN7dmdyvvFueIYsWURc2yAxqey iXqSAiE0BHmT5UpvJqwxtJdm8Qv79a9vQBh74fs4CG8d/cRWaK2cLBSinAH0WS6W/NqupbaRHfY GmFlNTcm/J9AmeWyaoOcTcpglPKKoKIfw9BhQv6nGA47i7sGFs+WhtAkfz9fS9wz15TmWePObMY w4Qp4ebQIj+Q33LVuyw== X-Proofpoint-GUID: zpzA7PcQl86c_PrqphebvwNLeEl-LfgB X-Proofpoint-Spam-Info: AW1haW4tMjYwOTE1MDIzOSBTYWx0ZWRfX1byGvrn4BzN/ iIK0nD5xINll2axxKyiozYimAwoVrKuWVzROysCfWVcNhm8B8MHsNfNin+D749ESMZVJZ96ndOv qseYVvzmh0Gic+5Wm5WWdzlZh3Lx3Zk= X-Authority-Analysis: v=2.4 cv=fck4WEQF c=1 sm=1 tr=0 ts=6aa972c5 cx=c_pps a=0uOsjrqzRL749jD1oC5vDA==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yx91gb_oNiZeI1HMLzn7:22 a=EUspDBNiAAAA:8 a=anSrM8_wVXE1bCkXRQoA:9 a=QEXdDO2ut3YA:10 a=mQ_c8vxmzFEMiUWkPHU9:22 X-Proofpoint-ORIG-GUID: zpzA7PcQl86c_PrqphebvwNLeEl-LfgB X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-15_04,2026-09-15_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 suspectscore=0 bulkscore=0 malwarescore=0 phishscore=0 spamscore=0 lowpriorityscore=0 adultscore=0 clxscore=1015 priorityscore=1501 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609150239 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.180.131; envelope-from=brian.cain@oss.qualcomm.com; helo=mx0b-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, 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: 1789489988851158500 Add sfclass/dfclass FP classification tests, unsigned-to-double conversions, and dfmpyfix denormal fixup tests. Reviewed-by: Pierrick Bouvier Signed-off-by: Brian Cain --- tests/tcg/hexagon/fpstuff.c | 175 ++++++++++++++++++++++++++++++++++++ 1 file changed, 175 insertions(+) diff --git a/tests/tcg/hexagon/fpstuff.c b/tests/tcg/hexagon/fpstuff.c index 6aadaccabdf..7561f31cdc3 100644 --- a/tests/tcg/hexagon/fpstuff.c +++ b/tests/tcg/hexagon/fpstuff.c @@ -711,6 +711,176 @@ static void check_dfmpyxx(void) check64(res64, 0x7fefffffffffffffULL); } =20 +/* + * sfclass mask bits: + * bit 0: positive/negative zero + * bit 1: positive/negative normal + * bit 2: positive/negative denormal + * bit 3: positive/negative infinity + * bit 4: positive/negative NaN + */ +#define TEST_SFCLASS(VAL, MASK, EXPECT) \ + do { \ + uint32_t res; \ + asm("%[res] =3D #0\n\t" \ + "p0 =3D sfclass(%[val], #" #MASK ")\n\t" \ + "if (p0) %[res] =3D #1\n\t" \ + : [res] "=3D&r"(res) \ + : [val] "r"(VAL) \ + : "p0"); \ + check32(res, EXPECT); \ + } while (0) + +static void check_sfclass(void) +{ + /* Zero: mask bit 0 */ + TEST_SFCLASS(SF_zero, 0x01, 1); + TEST_SFCLASS(SF_zero_neg, 0x01, 1); + TEST_SFCLASS(SF_zero, 0x02, 0); + + /* Normal: mask bit 1 */ + TEST_SFCLASS(SF_one, 0x02, 1); + TEST_SFCLASS(SF_one, 0x01, 0); + + /* Denormal: mask bit 2 */ + TEST_SFCLASS(SF_denorm, 0x04, 1); + TEST_SFCLASS(SF_denorm, 0x01, 0); + + /* Infinity: mask bit 3 */ + TEST_SFCLASS(SF_INF, 0x08, 1); + TEST_SFCLASS(SF_INF, 0x01, 0); + + /* NaN: mask bit 4 */ + TEST_SFCLASS(SF_QNaN, 0x10, 1); + TEST_SFCLASS(SF_SNaN, 0x10, 1); + TEST_SFCLASS(SF_QNaN, 0x01, 0); + + /* Combined: any class (all bits set) */ + TEST_SFCLASS(SF_one, 0x1f, 1); +} + +/* + * dfclass mask bits are the same as sfclass. + */ +static const uint64_t DF_INF =3D 0x7ff0000000000000ULL; +static const uint64_t DF_denorm =3D 0x0000000000000001ULL; +static const uint64_t DF_neg_one =3D 0xbff0000000000000ULL; + +#define TEST_DFCLASS(VAL, MASK, EXPECT) \ + do { \ + uint32_t res; \ + asm("%[res] =3D #0\n\t" \ + "p0 =3D dfclass(%[val], #" #MASK ")\n\t" \ + "if (p0) %[res] =3D #1\n\t" \ + : [res] "=3D&r"(res) \ + : [val] "r"(VAL) \ + : "p0"); \ + check32(res, EXPECT); \ + } while (0) + +static void check_dfclass(void) +{ + /* Zero: mask bit 0 */ + TEST_DFCLASS(DF_zero, 0x01, 1); + TEST_DFCLASS(DF_zero_neg, 0x01, 1); + TEST_DFCLASS(DF_zero, 0x02, 0); + + /* Normal: mask bit 1 */ + TEST_DFCLASS(DF_one, 0x02, 1); + TEST_DFCLASS(DF_neg_one, 0x02, 1); + TEST_DFCLASS(DF_one, 0x01, 0); + + /* Denormal: mask bit 2 */ + TEST_DFCLASS(DF_denorm, 0x04, 1); + TEST_DFCLASS(DF_denorm, 0x01, 0); + + /* Infinity: mask bit 3 */ + TEST_DFCLASS(DF_INF, 0x08, 1); + TEST_DFCLASS(DF_INF, 0x01, 0); + + /* NaN: mask bit 4 */ + TEST_DFCLASS(DF_QNaN, 0x10, 1); + TEST_DFCLASS(DF_SNaN, 0x10, 1); + TEST_DFCLASS(DF_QNaN, 0x01, 0); +} + +/* Rdd =3D convert_uw2df(Rs) */ +static uint64_t conv_uw2df(uint32_t val) +{ + uint64_t result; + + asm("%[res] =3D convert_uw2df(%[val])\n\t" + : [res] "=3Dr"(result) + : [val] "r"(val)); + return result; +} + +static void check_conv_uw2df(void) +{ + check64(conv_uw2df(0), DF_zero); + check64(conv_uw2df(1), DF_one); + /* 100 -> 0x4059000000000000 */ + check64(conv_uw2df(100), 0x4059000000000000ULL); + /* 0xFFFFFFFF -> 4294967295.0 =3D 0x41EFFFFFFFE00000 */ + check64(conv_uw2df(0xFFFFFFFF), 0x41EFFFFFFFE00000ULL); +} + +/* Rdd =3D convert_ud2df(Rss) */ +static uint64_t conv_ud2df(uint64_t val) +{ + uint64_t result; + + asm("%[res] =3D convert_ud2df(%[val])\n\t" + : [res] "=3Dr"(result) + : [val] "r"(val)); + return result; +} + +static void check_conv_ud2df(void) +{ + check64(conv_ud2df(0ULL), DF_zero); + check64(conv_ud2df(1ULL), DF_one); + /* 1000000 -> 0x412E848000000000 */ + check64(conv_ud2df(1000000ULL), 0x412E848000000000ULL); +} + +/* Rdd =3D dfmpyfix(Rss,Rtt) -- DF multiply denormal fixup */ +static uint64_t do_dfmpyfix(uint64_t a, uint64_t b) +{ + uint64_t result; + + asm("%[res] =3D dfmpyfix(%[a], %[b])\n\t" + : [res] "=3Dr"(result) + : [a] "r"(a), [b] "r"(b)); + return result; +} + +static void check_dfmpyfix(void) +{ + /* + * With two normal values (neither denormal, exps < 512), + * the result should be the first operand unchanged. + */ + check64(do_dfmpyfix(DF_one, DF_one), DF_one); + + /* + * Case: b is denormal AND a is normal with exp >=3D 512. + * a gets multiplied by 2^-52 (0x3cb0000000000000). + * a =3D 1.0, result =3D 1.0 * 2^-52 =3D 0x3cb0000000000000 + */ + check64(do_dfmpyfix(DF_one, DF_denorm), 0x3CB0000000000000ULL); + + /* + * Case: a is denormal AND b is normal with exp >=3D 512. + * a gets multiplied by 2^52 (0x4330000000000000). + * a =3D smallest denorm =3D 2^-1074, b =3D 2^512 (biased exp 0x5ff). + * Result =3D 2^-1074 * 2^52 =3D 2^-1022 =3D smallest normal + * =3D 0x0010000000000000 + */ + check64(do_dfmpyfix(DF_denorm, 0x5FF0000000000000ULL), + 0x0010000000000000ULL); +} + int main() { check_compare_exception(); @@ -725,6 +895,11 @@ int main() check_float2int_convs(); check_float_consts(); check_dfmpyxx(); + check_sfclass(); + check_dfclass(); + check_conv_uw2df(); + check_conv_ud2df(); + check_dfmpyfix(); =20 puts(err ? "FAIL" : "PASS"); return err ? 1 : 0; --=20 2.34.1 From nobody Sat Sep 26 20:01:26 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=1789489987; cv=none; d=zohomail.com; s=zohoarc; b=NGdGhY37mIJ+QZGgkITqMCtATlRhqa4pFuew4R9QHP8Q3k8XTTNYWRvZwtWVth4szX9SkDw8RyMn86jhKz8U4kcGdDVDxYxAkjgYsqLJWKni2dv+qZYEOL1WVGxdaYz5SoLnn1SLMDrHRrnBCbgBhmlYZ7LCG3hZcJ/+NoMAJCI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789489987; h=Content-Type: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=TD9oBr1J7/EIT0M0+rkmdoRA3UBnrqOUEqn9r3Ju3k0=; b=XpWVPrAYa6+4w45AMuxPWBK5psB61nYy+mdjwurs49o/WKBx128Ln/8d9NCTEsZufl9BUkpp7TSBt6R3JekALN+VakjuTaOoPkFKcfICvZR0rQ4Non60bRQSMedWII6kbXgo8V8J75+bNuhhniIv7z865zWMOOhllfnQvOFqIzY= 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 1789489987637103.69968482157333; Tue, 15 Sep 2026 09:33:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x6W4C-0005zX-40; Tue, 15 Sep 2026 12:31:32 -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 1x6W3m-0005v8-Ms for qemu-devel@nongnu.org; Tue, 15 Sep 2026 12:31:06 -0400 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1x6W3k-0003oH-W1 for qemu-devel@nongnu.org; Tue, 15 Sep 2026 12:31:06 -0400 Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68FFAphS125473 for ; Tue, 15 Sep 2026 16:31:04 GMT Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4gq3xtt65d-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 15 Sep 2026 16:31:03 +0000 (GMT) Received: by mail-pj1-f69.google.com with SMTP id 98e67ed59e1d1-39deda201bcso3200541a91.2 for ; Tue, 15 Sep 2026 09:31:03 -0700 (PDT) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-39dfdd0baaasm6068590a91.9.2026.09.15.09.31.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Sep 2026 09:31:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= TD9oBr1J7/EIT0M0+rkmdoRA3UBnrqOUEqn9r3Ju3k0=; b=JP9xZOH9aKiXl4bg I3sQx+M2tw3G+jLaWbNeDxy3pTa0B5j0UIZKqbzJHE+UTesOP8V4sdr1CPum+Y/g b6H2xoWW8dVfOnflXCQr5Hj3Hd0DxxKhXTPA1ag8GBzsMcALWqPQs1xLm8+Z4Gsl ECXO00i/367wSWrtM1nzvUmc2DfWtDW/LRNS6NjO4YbdBIuBL18hfWyff/c11sMZ ukuebh8bciMYe4ZCyvqNLgSi1TJHBb7LAbUkhIFUzCdX7Gsds2n4GX+9YgBEDlJf 1qGfSmSGs3AwXtKiwo24RL25Za3fHXWGg7jlJW8s2pUmH1A/0Fq8nmKG3PLaocJM lBNzdw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1789489863; x=1790094663; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=TD9oBr1J7/EIT0M0+rkmdoRA3UBnrqOUEqn9r3Ju3k0=; b=aIKsQdwK8u5GqvS1sfGOc9uzW1LWSjNIJ+GC/g6kuj9N2e9tndh3uJNVP02TDMU9k5 5BJo+t8dcQQqIKXPU0eHb6zzZgwQgXCeLNWe8kSpIyk9k7+Sf9dgLh1QyLmUfVioAjxu oBOMq8mXzEwHqMs3ZgVCDBkKzQ/40u0BjHYg8exUZMuMIZF/hPodOlqgjCAN8BIK3Oz4 rOrJwqyoUSk5S2AQAFBfiUZb1Tv1Y/mfiud/vLG7zcmyQOADLbyNBvOmlkEl3zmgOlEQ BnzPqV2ZuuszzzWKqtk4xQkJnXfE6LEXt+xnHw2a4cR+jP0PhUXNcKdsfUyljfp1+UjV /Fjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789489863; x=1790094663; h=content-transfer-encoding:content-type: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 :content-type; bh=TD9oBr1J7/EIT0M0+rkmdoRA3UBnrqOUEqn9r3Ju3k0=; b=sE3ribZF+RWkgLDW8/5eXEqrm+VHX9F6c5WmULPaiSUbeZEkJbBKF5u5hpgfyUGb7C NUx1YdwmlJLSPyFArqIne3tsW1itOAdIEHgMwqq/sWI4VcOuUFhI2MR8i0yz1RwDwqkJ EJuB0nna6YeioRRq8Y5tpYqJhpVGlH5pl/vjC026F+XCahf+YY9ObgpRym8yYAp98/Fj Ry50xEeJsykQQdw0HRucfRxV0SBdt3Sww24acO/zBdZVrejzIo0UTgvLTaD+k2KZpMOn V+MGroAsGNDCLHFItNebgzawxa8kikDxMETdcmyQmt5xIXw79ND8gdiRdpE2NuV6tQ+b 9tWA== X-Gm-Message-State: AFuF++lKi3aiUFpwFF1CW04/c5fv78lWyV8O+wvnoUW5E9JE0rNw8Isg 2dRJFbOdxo3iU6ds+uNh1fEhfblTHceYpE+0TQ6C3N0XhJh1O7WV6GHWcV3U55UFTKss9SoujGv H51oArSJoH+1jCUTh+Ys+wQAGDWRP2ic5+P/m8qiOGeK3AWBT5vCHtsQXZAsuiT322w== X-Gm-Gg: AYBFou2QoD4FHykbcohKwLX/aM5UZSTnEQoIo7w0UItt/0DS8WK4brikbnZChiGsPgu HuraHSEbYDu0veoxIKtzcHSBMYN8UuSOOkYAhsC5poA/mhTqIyJM6LvPI3WnLGydNB/CapgpVQL SQi0PJbf6rDSBmnbZQP2zMCe39INY7/VRnELDVtEeoQT0GKsvDpXJ+FF6QRPoTySqIa23rY/8uY BecxoTF8oo5co7Fbkl9WrHS75p8SzBi8MZewEQLnT3sK5rB3M8AP19TWcshfVNUSMrW22R4X1Q+ hZ3h3/Es1q3odja2FDIFKfbS6OtlSLR62x8VIXWWjPKjog17+x+8E0JHfnNc3jF4fJn704+HbLo YywFZ21AGHkMtYEf+LbNIff8GdOl9PJorxxDlLz2eSQ4ewHOL X-Received: by 2002:a17:90b:5850:b0:39d:fcbe:fdd2 with SMTP id 98e67ed59e1d1-39dfcbf811dmr10527202a91.5.1789489862771; Tue, 15 Sep 2026 09:31:02 -0700 (PDT) X-Received: by 2002:a17:90b:5850:b0:39d:fcbe:fdd2 with SMTP id 98e67ed59e1d1-39dfcbf811dmr10527144a91.5.1789489862273; Tue, 15 Sep 2026 09:31:02 -0700 (PDT) From: Brian Cain To: qemu-devel@nongnu.org Cc: sid.manning@oss.qualcomm.com, Pierrick Bouvier , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Brian Cain Subject: [PATCH v2 07/17] tests/tcg/hexagon: add bit interleave and convergent rounding tests Date: Tue, 15 Sep 2026 09:30:37 -0700 Message-Id: <20260915163047.4180600-8-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260915163047.4180600-1-brian.cain@oss.qualcomm.com> References: <20260915163047.4180600-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: WOPVQB2gCff2L-SZUUTVq-N2pEK7kmQI X-Proofpoint-GUID: WOPVQB2gCff2L-SZUUTVq-N2pEK7kmQI X-Proofpoint-Spam-Info: AW1haW4tMjYwOTE1MDIzOSBTYWx0ZWRfX8LrHL9U4e6pD 8HTD6xOX4xP9U6y56+F77ynEh8uM9T86KbfoVnqIsNmOECOPJrDgVp8/h3t4G8IWxkFMLs5l5ri B4UJpfBBUWOtEEFzne7IX1sh7feTwDs= X-Authority-Analysis: v=2.4 cv=As97T+9P c=1 sm=1 tr=0 ts=6aa972c7 cx=c_pps a=vVfyC5vLCtgYJKYeQD43oA==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=gowsoOTTUOVcmtlkKump:22 a=EUspDBNiAAAA:8 a=MD3S-f5BDBJKRhxJpBIA:9 a=QEXdDO2ut3YA:10 a=rl5im9kqc5Lf4LNbBjHf:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTE1MDIzOSBTYWx0ZWRfX6csT/E6ectwd nI2d8yhT0NAD8/NdKsiJ8YgOSLsXaSBZSsoWQWr2tvfZALNqSGxhrnjjlJcqi/U2HQ25uF+iT03 uhOu0wVmxyRhlTfddox7RspLsr4oVLO937zyM/SFd71PD1xRe/mY+kyMUmWO++jL7jDYY8a9Mxw iR4W3hLRxe4IbEc7Ui813K7+slKGKgBuSG7l2m0pMBhitG/UdS4rGf40FowQfMMng7jZJpXRp6K fhlNgcTXmvJxmRyuaFqNcnuLFT5Vu/Yl98hHeF5UBBflwpeFGO+RGS4fwNcC2TIk8wyIRX1o8Ca 4QzIxtSz+NDGNtwJTsIUiDstPMtbMuwqVRQGD+IELfPHnpL2ddnUIon/aigldx9iG3zM4opAaQa 8P55e1csr/h+7m5WYWQ5yiEgNecPDIC9lYWq07luCnGJNj46vZGJs20YUgxBLJbERi3pHXt1Fpj jdyjk+N4MeWjEN4Bhpw== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-15_04,2026-09-15_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 malwarescore=0 bulkscore=0 clxscore=1015 impostorscore=0 priorityscore=1501 phishscore=0 lowpriorityscore=0 spamscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609150239 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.180.131; envelope-from=brian.cain@oss.qualcomm.com; helo=mx0b-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, 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: 1789489988836158500 Test the interleave/deinterleave 64-bit bit-manipulation instructions and the cround instruction. Reviewed-by: Sid Manning Signed-off-by: Brian Cain --- tests/tcg/hexagon/test_bitops.c | 98 +++++++++++++++++++++++++++++++++ tests/tcg/hexagon/meson.build | 1 + 2 files changed, 99 insertions(+) create mode 100644 tests/tcg/hexagon/test_bitops.c diff --git a/tests/tcg/hexagon/test_bitops.c b/tests/tcg/hexagon/test_bitop= s.c new file mode 100644 index 00000000000..3e9274ddddd --- /dev/null +++ b/tests/tcg/hexagon/test_bitops.c @@ -0,0 +1,98 @@ +/* + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +/* + * Test bit interleave/deinterleave and convergent rounding. + */ + +#include +#include +#include + +int err; + +#include "hex_test.h" + +static void check_interleave(void) +{ + uint64_t input; + uint64_t inter; + uint64_t deinter; + + /* + * interleave takes the 32 even bits and 32 odd bits of Rss and + * interleaves them: even[0] goes to bit 0, odd[0] to bit 1, + * even[1] to bit 2, odd[1] to bit 3, etc. + * + * Input: low 32 bits (even half), high 32 bits (odd half) + * If low =3D 0xFFFFFFFF, high =3D 0x00000000: + * result has every even bit set, every odd bit clear + * =3D 0x5555555555555555 + */ + input =3D 0x00000000FFFFFFFFULL; + inter =3D Q6_P_interleave_P(input); + check64(inter, 0x5555555555555555ULL); + + /* All ones should stay all ones */ + input =3D 0xFFFFFFFFFFFFFFFFULL; + inter =3D Q6_P_interleave_P(input); + check64(inter, 0xFFFFFFFFFFFFFFFFULL); + + /* All zeros should stay all zeros */ + input =3D 0x0000000000000000ULL; + inter =3D Q6_P_interleave_P(input); + check64(inter, 0x0000000000000000ULL); + + /* + * deinterleave is the inverse of interleave. + * deinterleave(interleave(x)) should equal x. + */ + input =3D 0xDEADBEEFCAFEBABEULL; + inter =3D Q6_P_interleave_P(input); + deinter =3D Q6_P_deinterleave_P(inter); + check64(deinter, input); + + /* deinterleave of 0x5555...5555 -> low half all 1s, high half all 0s = */ + deinter =3D Q6_P_deinterleave_P(0x5555555555555555ULL); + check64(deinter, 0x00000000FFFFFFFFULL); +} + +static void check_cround(void) +{ + /* + * cround(0x300, #8) -> 3 (exact shift, no rounding needed). + * 0x300 >> 8 =3D 3 + */ + check32(Q6_R_cround_RI(0x300, 8), 3); + + /* + * cround(0x380, #8) -> 4 (0x380 >> 8 =3D 3.5, rounds to even =3D 4) + */ + check32(Q6_R_cround_RI(0x380, 8), 4); + + /* + * cround(0x280, #8) -> 2 (0x280 >> 8 =3D 2.5, rounds to even =3D 2) + */ + check32(Q6_R_cround_RI(0x280, 8), 2); + + /* + * cround(0x3C0, #8) -> 4 (0x3C0 >> 8 =3D 3.75, rounds up to 4) + */ + check32(Q6_R_cround_RI(0x3C0, 8), 4); + + /* + * Shift by 0 -> return the input unchanged. + */ + check32(Q6_R_cround_RI(42, 0), 42); +} + +int main(void) +{ + check_interleave(); + check_cround(); + + puts(err ? "FAIL" : "PASS"); + return err ? 1 : 0; +} diff --git a/tests/tcg/hexagon/meson.build b/tests/tcg/hexagon/meson.build index 6e36a9a1220..e95096c1a49 100644 --- a/tests/tcg/hexagon/meson.build +++ b/tests/tcg/hexagon/meson.build @@ -69,6 +69,7 @@ tests +=3D { 'test_abs.S': {'cflags': asmflags}, 'test_bitcnt.S': {'cflags': asmflags}, 'test_bitsplit.S': {'cflags': asmflags}, + 'test_bitops.c': {'cflags': cflags}, 'test_call.S': {'cflags': asmflags}, 'test_clobber.S': {'cflags': asmflags}, 'test_cmp.S': {'cflags': asmflags}, --=20 2.34.1 From nobody Sat Sep 26 20:01:26 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=1789489966; cv=none; d=zohomail.com; s=zohoarc; b=ETAb6VKxHyDtEviuzw8C31/whzOLJflbw/oCS2ni4i5q4SwZpn5hbkTMCWbRnTxIVoHpBcPk29IMWxtUmKaA5h7g3Me31X8dV7qzwRJsMOB+BSTKhy6uhNGMVWVG7KbVFvQzm3rqSZSMrFFyOEMChllGvix7fySz/pG6yDdgzM8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789489966; h=Content-Type: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=+qVJQ/GUPjywBgxwOfRwjo+ZY6Han56403zjJbxAG3w=; b=AsEdIS33U3w0yBE3f2kG0KU9TUz1GOMgh33lf8xIUBZEqqTh+xa3VcQFLMbcKN4WfO52HzqwqY/256ZG550JQvimBTtH5LzF86hrK0zHkuslavVzXjndI+GGT2gIla5YgxSYNrb5dyruhB1hPVEMn6PpuGvn/3eqqIiUjG84c6E= 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 1789489966154587.005152435023; Tue, 15 Sep 2026 09:32:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x6W4I-00060x-Kh; Tue, 15 Sep 2026 12:31: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 1x6W3x-0005wQ-KM for qemu-devel@nongnu.org; Tue, 15 Sep 2026 12:31:22 -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 1x6W3v-0003pW-HO for qemu-devel@nongnu.org; Tue, 15 Sep 2026 12:31:17 -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 68FFAfgg2836598 for ; Tue, 15 Sep 2026 16:31:13 GMT Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4gq1qpaym3-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 15 Sep 2026 16:31:13 +0000 (GMT) Received: by mail-pj1-f71.google.com with SMTP id 98e67ed59e1d1-39dc5d85a9cso3781949a91.2 for ; Tue, 15 Sep 2026 09:31:13 -0700 (PDT) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-39dfdd0baaasm6068590a91.9.2026.09.15.09.31.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Sep 2026 09:31:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= +qVJQ/GUPjywBgxwOfRwjo+ZY6Han56403zjJbxAG3w=; b=Cj++1s3/K4XZ+1re TTfu2VdUPYgXtcKa37m7ICUbKW1lAL31KB2k0ZYkMaUfdbpegoWdrIW5VH8VA+YN WEg7yYB498eZ6OGOqB6+zxtJpcCvb+HDkf9WKfqb67XOwoNPdoyMeD8/iHTq6p68 257cI+GSSUyTsM+aHv39iddIDVZna874XO0XCbMPHqzVdrhZZgCx7i5L1DZ/u8nm L8y9fZYU7jWFBebHfURpu1l2X/vZ+dswVEZoLUHkJ4RH3vkXOwmuRVozGuH1Uvbi 9gw2HBTRis5Cs2pRIXZTdhj6PLUQUuoiFJfoNozIRrQmdWjLGhObI/97NEAHgtEo FHSsvg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1789489872; x=1790094672; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=+qVJQ/GUPjywBgxwOfRwjo+ZY6Han56403zjJbxAG3w=; b=CEkl0SO52Lv1N3JUz0anaUXxRR/JAF5oIJzfVOGSF01G8FOdt1WeHISgWzoRQaU8Wq fONQzp+nlrPMUbnchg71iOaiKQ7bniC1kuICAi25o0mPIpAIf3BMmrQuGh4dyai8v+9q eyitWI6C/PVmMF6DKwlN6WcxKDh+hkWm3M26Co4DcQbUbaqxX2lwsZnJ9xjUPEZFU1Yt 36MgqAfQDIXHSr2ctoglqQp+koZR+45IDsDB/YqieKCJAuvwdto4JMh28ptEUxNI8T3v X8o6YgqM8hCO6TL66VLwPid3W7Rz02qnBTOBCUWA5FLiSxwJcuyo7WQpDxyDOXAbC8Jr dmVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789489872; x=1790094672; h=content-transfer-encoding:content-type: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 :content-type; bh=+qVJQ/GUPjywBgxwOfRwjo+ZY6Han56403zjJbxAG3w=; b=gm+fSVzGF47g4HgqLN//RInrQbqC/TbrzQCW22K9ih/3B3tr2JM/XlFAs9IhU7DBrO ykWdcQRTnv37VJ7Scl3BEi/8JQm3oE5cAIWeugBafh1D73pCxeL24qMU+JVvMeOaZ/b1 7pnCIIET8NwgKVUZfxTTWaWY51oFmI4t6wMZ5lTb1EbA9ji5M7Wa1CpLk/gIzk4VRDC3 WkSFt/4Cce1s5jkJgJOAt93+RcjC5o3lB9epLZ+gu4YZNbJKxYmmjowMWukbYvUh70au WMbhwQ29psuIRGH0402jCsg6Sddc/k62cEZX6tZY0cTwRBVWuEZAzkFRXX2oUmlPB3qZ hS3A== X-Gm-Message-State: AFuF++mcSjMXK8RcJK94/a4vO8HKSHYJRk5y8UE3FN86Y1Xi69EaYrYx 5rDMLsiSdGWQh6aExhnN6WyE9eMTJpA5HkCSBZJLcwj5PllMj3yQUabiJabTyKg1rHWhX31NH0A DxvzbXCVM3Fxy4GyCGux9royunWht4wGxAPjvSb9A+eKDnWZyDiJV0ShUh0e5yccwTQ== X-Gm-Gg: AYBFou1QifBJRwSiR/xci7PeCLNoUsx8o+WKHEpxJb8mSlnhSZVphYCWhF6UiFl1jx8 61O0qWAVCLrlT3uDIpfTh/La0uicELiNnD+y++ReJ+xauyhjVM3dMnLTvMU2VwC6gBRasLRR5x8 ZY4Nwz5ke+2K3Z/1OlEM6mtT9L66YHClEvlhUGv+zXxkyJgUScXtOI52t5heQEKkxY9rRxuugrQ YJjIPFzDmBriLRGEtSmJQ1nrdrYVYGn4E3A8cVfMNXoU2yrLio/MCr6jxDq03kX/BIPTPfV2wm2 N/QRwIWQNvQjcDTi9iuuQBZHU9HK5tl0PtsBIMLlDbDpsu6Qm5uVfI1hPcaGjxoE+qD1gQZPT1F NYoRsq76TxObn6mdt5RdJOi+BKu1+P0enDKB+80flJEaMmLIv X-Received: by 2002:a17:90a:6096:b0:39e:14db:437b with SMTP id 98e67ed59e1d1-39e14db4706mr1392437a91.7.1789489872484; Tue, 15 Sep 2026 09:31:12 -0700 (PDT) X-Received: by 2002:a17:90a:6096:b0:39e:14db:437b with SMTP id 98e67ed59e1d1-39e14db4706mr1392380a91.7.1789489871944; Tue, 15 Sep 2026 09:31:11 -0700 (PDT) From: Brian Cain To: qemu-devel@nongnu.org Cc: sid.manning@oss.qualcomm.com, Pierrick Bouvier , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Brian Cain Subject: [PATCH v2 08/17] tests/tcg/hexagon: add cond call, tstbit-jump, and endloop01 tests Date: Tue, 15 Sep 2026 09:30:38 -0700 Message-Id: <20260915163047.4180600-9-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260915163047.4180600-1-brian.cain@oss.qualcomm.com> References: <20260915163047.4180600-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Info: AW1haW4tMjYwOTE1MDIzOSBTYWx0ZWRfX4QoKACEiyHuh ap50Kgta7qwdYOgKOgI540cY8455txwXXaF1X1Oh8MYMLfEzECVGLyukF6QwuU52UupLmjH5mdt 3bRnHse7PzVjzNZ7ZK6rgIBp+/W6aag= X-Authority-Analysis: v=2.4 cv=I4Xw19gg c=1 sm=1 tr=0 ts=6aa972d1 cx=c_pps a=UNFcQwm+pnOIJct1K4W+Mw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=DJpcGTmdVt4CTyJn9g5Z:22 a=EUspDBNiAAAA:8 a=UPTrhlJ9XJtdYAbvsWkA:9 a=QEXdDO2ut3YA:10 a=uKXjsCUrEbL0IQVhDsJ9:22 X-Proofpoint-ORIG-GUID: KVGcJYODv6f_kQpvLpN4z52MadEJx1Au X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTE1MDIzOSBTYWx0ZWRfXw1DF7fcfEb9u KGIsm7Kvxg2IsZcesaFrSAgybZX84QzjYZgPAN+6I620gJOyZ22FUah8s1aKZWWHFQp1QdxHHS+ sVYwz5F0XEpMB24BapOBDsETx11D08Asu63nkyUJTyoi29rMSbJAdJXSBsrL8e28veAijpZ8cyH a0+aKZXOy7uJhGKf8qWwn+9YA3xHYES2ELZDLFEE1zWhEP4Sr8G5jLmjdvzhJ/UKbMVY96WD9Od 0ZebI6ogFZfXazcTjKkxHeQLgoSZbjaFYbM2DZ2TPIDGlYED9KRiQ9Ud2VBtzNmJgjnv45+cl7a 6hnASmTD1O8zsz6rcF8Sg6Sak9tkBmaUSYe2d/aLBz7ZMArn890bbz+KHhDn9bxb1jJQ+AWWsrT nmeBotxwNzfmYU6q8oDiTzoQRtDpUaCLMgsM75yA+coVIvJwCWi0vqqTRr2zo8BCtHVkiXr2bgW v4zQny20e2ra1s7XUBQ== X-Proofpoint-GUID: KVGcJYODv6f_kQpvLpN4z52MadEJx1Au X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-15_04,2026-09-15_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 suspectscore=0 phishscore=0 clxscore=1015 priorityscore=1501 bulkscore=0 malwarescore=0 impostorscore=0 adultscore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609150239 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=brian.cain@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, 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: 1789489966679158500 Test conditional callr, compound tstbit0-and-jump instructions and endloop01. These exercise previously uncovered branch paths in translate.c. Reviewed-by: Pierrick Bouvier Signed-off-by: Brian Cain --- tests/tcg/hexagon/test_cond_branch.c | 162 +++++++++++++++++++++++++++ tests/tcg/hexagon/meson.build | 1 + 2 files changed, 163 insertions(+) create mode 100644 tests/tcg/hexagon/test_cond_branch.c diff --git a/tests/tcg/hexagon/test_cond_branch.c b/tests/tcg/hexagon/test_= cond_branch.c new file mode 100644 index 00000000000..73be8fbb43c --- /dev/null +++ b/tests/tcg/hexagon/test_cond_branch.c @@ -0,0 +1,162 @@ +/* + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +/* + * Test conditional calls, compound testbit0-and-jump instructions, + * and endloop01 (dual hardware loop end). + */ + +#include +#include + +int err; + +#include "hex_test.h" + +/* Target function for conditional calls */ +static int call_target_val; + +__attribute__((noinline)) +static void call_target(void) +{ + call_target_val =3D 42; +} + +/* + * Test conditional call: if (Pu) callr Rs / if (!Pu) callr Rs + */ +static void check_cond_call(void) +{ + void (*fn)(void) =3D call_target; + + /* + * callr clobbers all caller-saved registers. + * Hexagon caller-saved: r0-r5, r14-r15, r28, p0-p3. + */ + + /* if (p0) callr Rs -- predicate true */ + call_target_val =3D 0; + asm volatile("p0 =3D cmp.eq(%[one], %[one])\n\t" /* p0 =3D true */ + "if (p0) callr %[fn]\n\t" + : + : [one] "r"(1), [fn] "r"(fn) + : "r0", "r1", "r2", "r3", "r4", "r5", + "r14", "r15", "r28", "r31", + "p0", "p1", "p2", "p3", "memory"); + check32(call_target_val, 42); + + /* if (!p0) callr Rs -- predicate true, so !p0 is false */ + call_target_val =3D 0; + asm volatile("p0 =3D cmp.eq(%[one], %[one])\n\t" /* p0 =3D true */ + "if (!p0) callr %[fn]\n\t" + : + : [one] "r"(1), [fn] "r"(fn) + : "r0", "r1", "r2", "r3", "r4", "r5", + "r14", "r15", "r28", "r31", + "p0", "p1", "p2", "p3", "memory"); + check32(call_target_val, 0); + + /* if (!p0) callr Rs -- predicate false, so !p0 is true */ + call_target_val =3D 0; + asm volatile("p0 =3D cmp.eq(%[a], %[b])\n\t" /* p0 =3D false (1 !=3D = 2) */ + "if (!p0) callr %[fn]\n\t" + : + : [a] "r"(1), [b] "r"(2), [fn] "r"(fn) + : "r0", "r1", "r2", "r3", "r4", "r5", + "r14", "r15", "r28", "r31", + "p0", "p1", "p2", "p3", "memory"); + check32(call_target_val, 42); +} + +/* + * Test compound testbit0-and-jump. + * p0 =3D tstbit(Rs, #0); if ([!]p0.new) jump:t/nt target + */ +static void check_tstbit0_jump(void) +{ + uint32_t result; + + /* Rs has bit0 =3D 1, test "if (p0.new) jump" -> should jump */ + result =3D 0; + asm volatile( + "{\n\t" + " p0 =3D tstbit(%[val], #0)\n\t" + " if (p0.new) jump:t 1f\n\t" + "}\n\t" + "%[res] =3D #0\n\t" + "jump 2f\n\t" + "1:\n\t" + "%[res] =3D #1\n\t" + "2:\n\t" + : [res] "=3Dr"(result) + : [val] "r"(0x5) /* bit 0 is set */ + : "p0"); + check32(result, 1); + + /* Rs has bit0 =3D 0, test "if (p0.new) jump" -> should NOT jump */ + result =3D 0; + asm volatile( + "{\n\t" + " p0 =3D tstbit(%[val], #0)\n\t" + " if (p0.new) jump:t 1f\n\t" + "}\n\t" + "%[res] =3D #0\n\t" + "jump 2f\n\t" + "1:\n\t" + "%[res] =3D #1\n\t" + "2:\n\t" + : [res] "=3Dr"(result) + : [val] "r"(0x4) /* bit 0 is clear */ + : "p0"); + check32(result, 0); + + /* Rs has bit0 =3D 0, test "if (!p0.new) jump" -> should jump */ + result =3D 0; + asm volatile( + "{\n\t" + " p0 =3D tstbit(%[val], #0)\n\t" + " if (!p0.new) jump:t 1f\n\t" + "}\n\t" + "%[res] =3D #0\n\t" + "jump 2f\n\t" + "1:\n\t" + "%[res] =3D #1\n\t" + "2:\n\t" + : [res] "=3Dr"(result) + : [val] "r"(0x4) /* bit 0 is clear */ + : "p0"); + check32(result, 1); +} + +/* + * Test endloop01: a packet that terminates both loop0 and loop1. + * Outer loop runs 3 iterations, inner loop runs 4. + */ +static void check_endloop01(void) +{ + uint32_t count; + + asm volatile( + "%[cnt] =3D #0\n\t" + "loop1(1f, #3)\n\t" /* outer loop: 3 iterations */ + "1:\n\t" + "loop0(2f, #4)\n\t" /* inner loop: 4 iterations */ + "2:\n\t" + "{ %[cnt] =3D add(%[cnt], #1) }:endloop01\n\t" + : [cnt] "=3Dr"(count)); + + /* 3 outer * 4 inner =3D 12 total iterations */ + check32(count, 12); +} + +int main(void) +{ + check_cond_call(); + check_tstbit0_jump(); + check_endloop01(); + + puts(err ? "FAIL" : "PASS"); + return err ? 1 : 0; +} diff --git a/tests/tcg/hexagon/meson.build b/tests/tcg/hexagon/meson.build index e95096c1a49..2094ef3f65c 100644 --- a/tests/tcg/hexagon/meson.build +++ b/tests/tcg/hexagon/meson.build @@ -73,6 +73,7 @@ tests +=3D { 'test_call.S': {'cflags': asmflags}, 'test_clobber.S': {'cflags': asmflags}, 'test_cmp.S': {'cflags': asmflags}, + 'test_cond_branch.c': {'cflags': cflags}, 'test_dotnew.S': {'cflags': asmflags}, 'test_ext.S': {'cflags': asmflags}, 'test_fibonacci.S': {'cflags': asmflags}, --=20 2.34.1 From nobody Sat Sep 26 20:01:26 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=1789489932; cv=none; d=zohomail.com; s=zohoarc; b=kus8KOySlPWdbHdtNIFkhMSXwuyXnkqum6qj3zSrjnY7EW9JHmJG0qkNsi0I9q0xh4h3y8OdO6oJhfdRgaer0GvIlCV/SyjLTY939UoCuQ+F8Q5BdulDgHLiCCofOKS95BOpZjcTlkKyAtFIzdJi3ZLVS+W+yzNYduDgwSRzDqY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789489932; h=Content-Type: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=fvwL/IbEMWV8t1l928t0mwgbwsnd4aQXSPTQMPU5mAo=; b=lCA5rDx9FhitVEaXv1hY86WgLqyf8yh0R0Vna97SCRuwWTiuZm2ApYX4RGrWiVQNI+R+b+X9BXD4KDC/HiW6/MLZ9X7vZewk4cBzWpS2r5g5qvjfQ4NwNKtcoIkhBkM6nKpNsEAcCbw5qFYJif8MVJONlQOtQBs9jDGPsnv4uwA= 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 1789489932588762.2814760996768; Tue, 15 Sep 2026 09:32:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x6W4L-00062L-Q9; Tue, 15 Sep 2026 12:31:41 -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 1x6W41-0005wX-9z for qemu-devel@nongnu.org; Tue, 15 Sep 2026 12:31:22 -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 1x6W3z-0003qA-GC for qemu-devel@nongnu.org; Tue, 15 Sep 2026 12:31:21 -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 68FFATvu4176138 for ; Tue, 15 Sep 2026 16:31:17 GMT Received: from mail-pg1-f200.google.com (mail-pg1-f200.google.com [209.85.215.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4gq3hc2dj6-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 15 Sep 2026 16:31:17 +0000 (GMT) Received: by mail-pg1-f200.google.com with SMTP id 41be03b00d2f7-cc4c1fc9ceaso3821749a12.3 for ; Tue, 15 Sep 2026 09:31:16 -0700 (PDT) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-39dfdd0baaasm6068590a91.9.2026.09.15.09.31.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Sep 2026 09:31:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= fvwL/IbEMWV8t1l928t0mwgbwsnd4aQXSPTQMPU5mAo=; b=kvNmv3iidS52/Y9J uKELo5JhIQ09P3V+EXQRt5r4zSZeVqfiwqQMGCAtf/S4kEyuBH3Y0+5LkJee8X6l p2R7hPbXsSaps65gsPfkEXfNg6etk1S/Azzy1Afakw9OSYlU2JRztlzMSTB68jfc pUxwV/WIg7ssOD3cLgPfW7d59c2dLhEzTa57zHsVIsF7UEjnxYVP0jC6D3MDMmli jwvckzsl7kmQtE8QBuMzT31MATw7rG5e8L0YXnMUzRS8JmnfweAfeBnYHnEBslnL Wk2hAHu2n1skoYUFLhDtEnUWlp/WaeYP8cee67kWGcJsJq7G4kn/3tcwj7IgklRz RgO45g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1789489876; x=1790094676; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=fvwL/IbEMWV8t1l928t0mwgbwsnd4aQXSPTQMPU5mAo=; b=GfLcjNvyssH3bPNt84E3BUGZGaVF4FWTMrEYNzmw5GJ2PmKem90TFlRMWPS6EUwdws XOo2mizgVWpGofumYq6p2kpqosG+oIt/aMeHNo4A+JLF80mERnfHVULXexTMpS6pnlvv ElXDNTcfqKELmBYW3LixwiNL5gpUq+kqv0zOaHq+CMayBkh3dSw5sbFAps+3V5s7QTEQ PfFK9EIAjIJ12/ERA3ydscBLMy+V/wpSgdTrNPCF+JfIG6kW4zgTdnGFJT2bJbtmo0Px zCIgnhJ9Iu2tdT/pc3p4cmOj8oYoCkS9DBAKFe4DS9sT1PZXVy3uJL7zQM4ft+6CCmX2 +BmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789489876; x=1790094676; h=content-transfer-encoding:content-type: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 :content-type; bh=fvwL/IbEMWV8t1l928t0mwgbwsnd4aQXSPTQMPU5mAo=; b=QCFuCrtaIp3FEfBubeY3+3gEPSAQHrGGzwQGqFjqk222wf2ikwXNjhXMDO4uptlsdD uKKvMtCjHMHhrLeiFO4878L9sVTzxiyhXNp7wR27vKGaD5t3dxnJvl02QYB6Ixkndp2G 2ZAcXGpR7cRn2hOkU1iAJE1y1+wTs4u2ZNyyU9RKGJdHnTtP7Y1iJNlk3qJ/22ojCzga Zm7tfGhbBlGwAWqsfOC2BWIyHczxbBReVD4oMvxe2iFn1LV4EFQmZstmGnEcoKDfvx2I rLTgzWSBBEwTQ+IttnDN3AM2JzFOYGSRkXa4q7rCDctKIsUlgn4xRvPvnMGy3erSryw5 5Sfg== X-Gm-Message-State: AFuF++k68T6P0p3u8zNEA68h6NXiBc6wtO4HICupsODUmi03vnlJnGGP sC/aDU7ZuGZ+XMsdEbN8tNM5M3dIsBd4aPTRKzjJa7eNCtXMF9rfOKXWFLgTpcamB+2H55Sw3nU 2F7zqVif1WCefFim9QZ03578RfvKyvP8w+og8Rhxvh7Sv2fgEQgbzpnVqUz9b08/Xhw== X-Gm-Gg: AYBFou3yjd9nAfBHuno2snDvAvOb49AZS87KvuRnVeF5tTm2vqJKj09dwm1ZElKgU8m 0Ot1Mqp9XYo0FUpNK+lofy9+86kG3Sqzy9rAfvc+EMn3KDS9HUGp0+ML1069u3tlifNa0B8w6sR pppU7qHyj8RqbKwyqHPkXd2pqsVyrbPCInigi4UpRXOhBzhc0Y1hO9wayukp7Phu7Y5rWUsRkBR XHhCB5198l2viv99WTY7fWFJAgCD8igYuQD+YSjy4cF9Zr73D9Vgq3Zwu685MqRhitH06P9xAnw NrUF+i4SxoYfojL8UR/tOVjeTPIrZAarOmTMXOlJFexmvCZBcKSnZtkb3gVAyYwSVlbkKUW8iM8 pHzB9YQZLhhGXlQrhV/TQJSC9J+id1eXxHQvwqBlFXQIqRVuZ X-Received: by 2002:a17:90b:3f46:b0:38e:9ef9:eb97 with SMTP id 98e67ed59e1d1-39e10fbc659mr3700721a91.16.1789489876275; Tue, 15 Sep 2026 09:31:16 -0700 (PDT) X-Received: by 2002:a17:90b:3f46:b0:38e:9ef9:eb97 with SMTP id 98e67ed59e1d1-39e10fbc659mr3700630a91.16.1789489875734; Tue, 15 Sep 2026 09:31:15 -0700 (PDT) From: Brian Cain To: qemu-devel@nongnu.org Cc: sid.manning@oss.qualcomm.com, Pierrick Bouvier , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Brian Cain Subject: [PATCH v2 09/17] tests/tcg/hexagon: add dczeroa cache line zero test Date: Tue, 15 Sep 2026 09:30:39 -0700 Message-Id: <20260915163047.4180600-10-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260915163047.4180600-1-brian.cain@oss.qualcomm.com> References: <20260915163047.4180600-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: JQpU3nmMmKrFH6EdY6PFikQn_32yrLbf X-Proofpoint-Spam-Info: AW1haW4tMjYwOTE1MDI0MCBTYWx0ZWRfXxHUOr+uInSsq l0ZX7UU+0lYbUqMunWjim6IASzae7IaMdKweuDPN9a0A+7mS7ySvhOYWLxWf+eaLF5vsf3QPM0J IThV55Kin4TezEhpSG/9y+4CkPe5Q5A= X-Authority-Analysis: v=2.4 cv=dcUVTnXe c=1 sm=1 tr=0 ts=6aa972d5 cx=c_pps a=oF/VQ+ItUULfLr/lQ2/icg==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yOCtJkima9RkubShWh1s:22 a=EUspDBNiAAAA:8 a=StvKSay-7vg8R344wSoA:9 a=QEXdDO2ut3YA:10 a=3WC7DwWrALyhR5TkjVHa:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTE1MDI0MCBTYWx0ZWRfX8J7/gIUtq+uu 0sABbHY6Kv3ayMo9kMvB0rljp0uDKTvFZ32dQ3O06v3Od0iNvvTzoE1OgeHSZP0i/zrmefACwPx GpTAhQHI1/Q8phabmLI5ymcFxYwCUn+oABq+SvOWmD/VwZFlfrUmmUl8H88rpd2n22ygvvAoUs3 HLTJr2XTjFaAAo2INtqftLtyhY0XYxEnqAgFZjCkxjr0UYUHs6wUCKNKr+VFko2xl+cFpzVrN3+ uxWS9e4IUfSLTNA0jhV80xbyCyDGv/Pw+ze2lhCy5N4sX7WutFJtF8UwCXdoBLE8kosvVjghD+D SlffGE5jo9kw6vg+rVNEvBwRQdExTU8Vv9GSO6VHUD1DGRgAiKWi68WAo2kf77BlG7cEswd8YXm 5h4L3UcWvM++GkXcnSZB1GoiXY5dOVkdVVJcbhLpFKge6uE0QkT305/0giAcSx34MDqMQa5AuoA 38kyDyIzOMkbvceiQHA== X-Proofpoint-GUID: JQpU3nmMmKrFH6EdY6PFikQn_32yrLbf X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-15_04,2026-09-15_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 bulkscore=0 impostorscore=0 malwarescore=0 phishscore=0 suspectscore=0 clxscore=1015 spamscore=0 lowpriorityscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609150240 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=brian.cain@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, 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: 1789489935424158500 Test the dczeroa instruction which zeroes a cache line. Verifies aligned, unaligned, and buffer-start addresses. Reviewed-by: Sid Manning Signed-off-by: Brian Cain --- tests/tcg/hexagon/test_dczeroa.c | 88 ++++++++++++++++++++++++++++++++ tests/tcg/hexagon/meson.build | 1 + 2 files changed, 89 insertions(+) create mode 100644 tests/tcg/hexagon/test_dczeroa.c diff --git a/tests/tcg/hexagon/test_dczeroa.c b/tests/tcg/hexagon/test_dcze= roa.c new file mode 100644 index 00000000000..8cdcdd6a3b5 --- /dev/null +++ b/tests/tcg/hexagon/test_dczeroa.c @@ -0,0 +1,88 @@ +/* + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +/* + * Test the dczeroa instruction, which zeroes a 32-byte cache line. + * The address is rounded down to a 32-byte boundary: (addr & ~0x1f). + */ + +#include +#include +#include +#include + +int err; + +#include "hex_test.h" + +static uint8_t buf[128] __attribute__((aligned(32))); + +/* dczeroa with an aligned address */ +static void test_dczeroa_aligned(void) +{ + int i; + + memset(buf, 0xff, sizeof(buf)); + + Q6_dczeroa_A(&buf[32]); + + for (i =3D 0; i < 32; i++) { + check32(buf[i], 0xff); + } + for (i =3D 32; i < 64; i++) { + check32(buf[i], 0x00); + } + for (i =3D 64; i < 96; i++) { + check32(buf[i], 0xff); + } +} + +/* dczeroa with an unaligned address (should round down) */ +static void test_dczeroa_unaligned(void) +{ + int i; + + memset(buf, 0xff, sizeof(buf)); + + /* Address buf+40 rounds down to buf+32 */ + Q6_dczeroa_A(&buf[40]); + + for (i =3D 0; i < 32; i++) { + check32(buf[i], 0xff); + } + for (i =3D 32; i < 64; i++) { + check32(buf[i], 0x00); + } + for (i =3D 64; i < 96; i++) { + check32(buf[i], 0xff); + } +} + +/* dczeroa at the start of the buffer */ +static void test_dczeroa_start(void) +{ + int i; + + memset(buf, 0xff, sizeof(buf)); + + Q6_dczeroa_A(&buf[0]); + + for (i =3D 0; i < 32; i++) { + check32(buf[i], 0x00); + } + for (i =3D 32; i < 64; i++) { + check32(buf[i], 0xff); + } +} + +int main(void) +{ + test_dczeroa_aligned(); + test_dczeroa_unaligned(); + test_dczeroa_start(); + + puts(err ? "FAIL" : "PASS"); + return err ? 1 : 0; +} diff --git a/tests/tcg/hexagon/meson.build b/tests/tcg/hexagon/meson.build index 2094ef3f65c..fbea3154ed7 100644 --- a/tests/tcg/hexagon/meson.build +++ b/tests/tcg/hexagon/meson.build @@ -74,6 +74,7 @@ tests +=3D { 'test_clobber.S': {'cflags': asmflags}, 'test_cmp.S': {'cflags': asmflags}, 'test_cond_branch.c': {'cflags': cflags}, + 'test_dczeroa.c': {'cflags': cflags}, 'test_dotnew.S': {'cflags': asmflags}, 'test_ext.S': {'cflags': asmflags}, 'test_fibonacci.S': {'cflags': asmflags}, --=20 2.34.1 From nobody Sat Sep 26 20:01:26 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=1789489978; cv=none; d=zohomail.com; s=zohoarc; b=L+uD1Y8gTy+Rd2BcYVv48WPGtKxU7b8Jbx29teevunpqZT/oRVSBwm7vZIQX6REzg49KWBa5Dp2DHKyj4agKCQZOwWyB7PJEMssGM4fqepWJ2Ag+/IziZ8i1dT+43EFoUpciTWz54/eOKWGjioR3ttTSbdhMnBBIbaAxbtPekJU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789489978; h=Content-Type: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=I1hmGv97eNAh+Ae9+gZiCmZ4/pSNRiOv9LPCWLU4h5E=; b=CFpFoudyAi2o0JZi8blxTq74H+4uacIfUoblSFlFl9qgaKxGOW/ONkDnr+9a1yJ6RFg6uC8r9V1UGxlXToKZIvi9qB6ib25zsh8geKoPmBQwY5cklEUVjSYmxVfzqr4AnuZxqrt34/T/nRxCuie+l1s8FHfn36ZpXSVp3NZJ3OE= 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 1789489978377406.09071863936845; Tue, 15 Sep 2026 09:32:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x6W4J-00062B-C6; Tue, 15 Sep 2026 12:31: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 1x6W45-0005wn-4y for qemu-devel@nongnu.org; Tue, 15 Sep 2026 12:31:28 -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 1x6W42-0003qX-AK for qemu-devel@nongnu.org; Tue, 15 Sep 2026 12:31:24 -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 68FFATsZ4176129 for ; Tue, 15 Sep 2026 16:31:20 GMT Received: from mail-pj1-f72.google.com (mail-pj1-f72.google.com [209.85.216.72]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4gq3hc2djh-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 15 Sep 2026 16:31:20 +0000 (GMT) Received: by mail-pj1-f72.google.com with SMTP id 98e67ed59e1d1-3965ba1ba3eso5734871a91.2 for ; Tue, 15 Sep 2026 09:31:20 -0700 (PDT) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-39dfdd0baaasm6068590a91.9.2026.09.15.09.31.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Sep 2026 09:31:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= I1hmGv97eNAh+Ae9+gZiCmZ4/pSNRiOv9LPCWLU4h5E=; b=MZZBcWNFRr1EQfKN 09m9KJobei2cJ02UxehkgZ0kuOEp3+7jId5F8WPbUkKPOSO4BneH8OKIgCsO2UyB oDIVnBN6DyBC1JI+sXX8G9MoAN0oqv5PXNI69v4hZCfWZj7byNfyk+hZl8r/Gy9S tN40d88LURN2XT41h8do9U7KixhKcCmFyXgksoeXTkI6W4J6047CHR4yIwRqtTMs T/GvxNk1bXyyuK/qVFqi2RmRxxvprdFCRNcwK1raplwRGZ7o1U1GnUtJsEtpBqQm IOVoW8nHGwQSVctXdj0KnEQV83EdL20y0Rp50NECEo5ZfXlGE9CK2p0evN0rTivI 7EIEJQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1789489879; x=1790094679; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=I1hmGv97eNAh+Ae9+gZiCmZ4/pSNRiOv9LPCWLU4h5E=; b=eQDOiDar2thUPtWC2BUyCmqDhJjjofeq8/y96NwWx3+2U42d/O7mdYKiTcL070kE15 oy/nBXLfTE3+Pv4cV2QSBBwppkEFKs8z9jNedSzFvJh8MYB8remNmZ9I4r6RCPbOcOXm leCMoO+HiUdvAm4JdIrvWBmkwheonw6NZLe4BIeL8DynxzZ0kF/Re07h8d/+rjHKq33F 5K5K4WMtoW0SWKUmdkj2gt14vmL6t9qeVKsYPelVFarV5r6mKylH3kDmMfvzLGoDf3Mt c50PcWCTc4kEzHwKXuV198fsKKeF89Uf5ttj3RaqMsIV6xcJZMsL9nkG80fcnQdxmqPo +UEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789489879; x=1790094679; h=content-transfer-encoding:content-type: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 :content-type; bh=I1hmGv97eNAh+Ae9+gZiCmZ4/pSNRiOv9LPCWLU4h5E=; b=OQ1dNJhD3bvTny9U3NN6XcvVh6ngxerVTR5abZ1AjPzkJhz4jGqz9/qn9bywP3TkMq LcgRoIPvjSOtg+6zlfA87hXXyQ9kh78ESSds3mhzJQGG2b1s2Q1wzF6ZRV5uRL32TLDy Ots9yLQYpAJwa/e6UuU6JrVkX4fay9v4RUhQvMv8AGDMEvn/YJIiqmA1NtSrIcvaaNoK ktLuj/CGJwdRWSBie813JM5m6xE8k7Y6Ol7ZKQg+/30xs84YrEATzB7QZ3rzF5x7nn++ 25iki1MLALU/eQxJv8/gLg8LVeBV/1MJ1tL0j8+vqLGI7Gpkgv/6/+HcsRKIRrHgv7bz afWA== X-Gm-Message-State: AFuF++m/+YzrBCIIWO1A6+RRev4s6OxNc8XVPzZ2IR6VcWz4pkXh5KRL I3WXTGPjM33/X+9l0a9D5UbO6XQgzfJa6ropT1a40zrGX0WFyAEZoxIUGNhErKmjl+dzD4krZQc ooc1D2IoDnA3wkTCvxK5nhgWWYFZFNXgMRkeWx6R1vpRWsib3Ukpsdj6dBme3ue8HEA== X-Gm-Gg: AYBFou0/hszNqq2kACf2Y4DFMaEe5TMyELyqnUhcNg1T07lI+hhVfu23FdRfritf0ZH UrA/ettkNQ48AvZ/RfGPrv8pRpOXhRpwxoZjFUpUHV3EHtOKL2bvzY01jj6CNDsRF7ehjhP9kSd VoSg94evEsPSIs0MY/4iE8Qrqo5ujn/eVKHy3onqAsh+wISyNeyEnUYgSaGXdlwti1uOrYDRmb6 4bgp6zpa4GLN+iEXImGwnoiX6Iute4oufsOJboABy8DgOBLNUIgRHO6aPqZvfEpi2ZoPQxnqHYG pC3n/jBl9MpHl8GUwlPMbEY3cVtNucSohxfBeaMmjuXYiaax1jcP/ZmxeHnP+3w3EBVblaWqwTp CjxIlqr1CuQ3ccmApigjjodmKer8zBr8bEhBNHvPdP6SLP+Nb X-Received: by 2002:a17:90b:39cc:b0:36d:9e0b:3801 with SMTP id 98e67ed59e1d1-39debf94eefmr18226155a91.8.1789489878762; Tue, 15 Sep 2026 09:31:18 -0700 (PDT) X-Received: by 2002:a17:90b:39cc:b0:36d:9e0b:3801 with SMTP id 98e67ed59e1d1-39debf94eefmr18226060a91.8.1789489878160; Tue, 15 Sep 2026 09:31:18 -0700 (PDT) From: Brian Cain To: qemu-devel@nongnu.org Cc: sid.manning@oss.qualcomm.com, Pierrick Bouvier , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Brian Cain Subject: [PATCH v2 10/17] tests/tcg/hexagon: add HVX vwhist tests Date: Tue, 15 Sep 2026 09:30:40 -0700 Message-Id: <20260915163047.4180600-11-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260915163047.4180600-1-brian.cain@oss.qualcomm.com> References: <20260915163047.4180600-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: goxIOVOkDrnerdUL5xH2BWe-GDzaBslf X-Proofpoint-Spam-Info: AW1haW4tMjYwOTE1MDI0MCBTYWx0ZWRfX72Qf73gAZqaH 33amWgaR7xwoOoVZjNMU766YKTJ0Ab5E9UKK2ejbR9ACOHEc63RbKTxZT6o0JysBC/mmlagGEms bSOMV3iQcucdrmm+7Sl9m6JaPZrlnWc= X-Authority-Analysis: v=2.4 cv=dcUVTnXe c=1 sm=1 tr=0 ts=6aa972d8 cx=c_pps a=RP+M6JBNLl+fLTcSJhASfg==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yOCtJkima9RkubShWh1s:22 a=EUspDBNiAAAA:8 a=3zvnb_JKlmlTvwE-U_QA:9 a=QEXdDO2ut3YA:10 a=iS9zxrgQBfv6-_F4QbHw:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTE1MDI0MCBTYWx0ZWRfX2UZ7oeTtY+bg Xxdo1z9o6LkO8WHwmpQmYPlJh9awuVjEmS74K4A+fphG10kKx8C9YR12WZUaEopcY3+qcPSIj2q gwV7v+vdOd1xJxYtiA4HDQ31K+DhZugjCUvP2n9lsHtaAYyq3+dbL+Qr4LMYYa5SWbWpM4trC06 VTPBQlyuL6Y9OG4m5Aqa/bhShJIOLYzcWjIWlhFsEpiEuSaMrqqBnUJl/xL9Td0AgLzAHO9PeJQ Zw9cdzze4ghrHfopmg8vagvrA8hsvflMU5JDC8PlUgeH3HaUiv9RpYlxOsnALDrp1+I3aC49PiM jo8tLiSUtaPbMvhdK7gAR7JvvADXS1NF3Ful/uyg0LQG74TsABLn5J4kA1rjVa3jGCObX9h9Gfu 5MXp8hhilGaJEGn4aZWpNAASJCYKi9eu1mqPxX8vba2m6FHEL68ri8d3ta/edw7Guh+8Fv5waHZ ByE+gLOc4PSCny8XrCg== X-Proofpoint-GUID: goxIOVOkDrnerdUL5xH2BWe-GDzaBslf X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-15_04,2026-09-15_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 bulkscore=0 impostorscore=0 malwarescore=0 phishscore=0 suspectscore=0 clxscore=1015 spamscore=0 lowpriorityscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609150240 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=brian.cain@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, 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: 1789489978860158500 Test all eight vwhist instruction variants and the four Q-masked forms. Signed-off-by: Brian Cain Reviewed-by: Pierrick Bouvier --- tests/tcg/hexagon/hex_test.h | 10 + tests/tcg/hexagon/test_vwhist.c | 345 ++++++++++++++++++++++++++++++++ tests/tcg/hexagon/meson.build | 1 + 3 files changed, 356 insertions(+) create mode 100644 tests/tcg/hexagon/test_vwhist.c diff --git a/tests/tcg/hexagon/hex_test.h b/tests/tcg/hexagon/hex_test.h index f86e6e1a69e..9315fe463a1 100644 --- a/tests/tcg/hexagon/hex_test.h +++ b/tests/tcg/hexagon/hex_test.h @@ -21,6 +21,16 @@ =20 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) =20 +static inline void __check16(int line, uint16_t val, uint16_t expect) +{ + if (val !=3D expect) { + printf("ERROR at line %d: 0x%04x !=3D 0x%04x\n", line, val, expect= ); + err++; + } +} + +#define check16(RES, EXP) __check16(__LINE__, RES, EXP) + static inline void __check32(int line, uint32_t val, uint32_t expect) { if (val !=3D expect) { diff --git a/tests/tcg/hexagon/test_vwhist.c b/tests/tcg/hexagon/test_vwhis= t.c new file mode 100644 index 00000000000..32dedb0a8b9 --- /dev/null +++ b/tests/tcg/hexagon/test_vwhist.c @@ -0,0 +1,345 @@ +/* + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +/* + * Test HVX weighted histogram instructions (vwhist128/vwhist256 variants). + * + * Each halfword in the input vector (loaded via Vx.tmp) contains a bucket + * index (low byte) and a weight (high byte). The instruction accumulates + * the weight into the appropriate element of the destination vector. + */ + +#include +#include +#include + +int err; + +#include "hex_test.h" + +#define MAX_VEC_SIZE_BYTES 128 + +typedef union { + uint32_t uw[MAX_VEC_SIZE_BYTES / 4]; + uint16_t uh[MAX_VEC_SIZE_BYTES / 2]; + uint8_t ub[MAX_VEC_SIZE_BYTES]; +} MMVector; + +/* + * Build input vector for vwhist256: each halfword is (weight << 8 | bucke= t). + * We put bucket=3D0, weight=3D1 in every slot so that v0.uh[0] gets incre= mented + * by 1 for each of the 64 halfwords -> v0.uh[0] should equal 64. + */ +static MMVector input __attribute__((aligned(MAX_VEC_SIZE_BYTES))); +static MMVector zero_vec __attribute__((aligned(MAX_VEC_SIZE_BYTES))); +static MMVector result __attribute__((aligned(MAX_VEC_SIZE_BYTES))); + +/* + * Test vwhist256: 256-bin histogram with 16-bit accumulation. + * Each halfword of the input: low byte =3D bucket, high byte =3D weight. + * bucket bits [7:3] -> vindex (which vector register), [2:0] + lane -> el= ement. + * All entries have bucket=3D0 weight=3D1, so v0.uh[0..7] get incremented. + */ +static void test_vwhist256(void) +{ + int i; + + /* Set all input halfwords to bucket=3D0, weight=3D1 */ + for (i =3D 0; i < MAX_VEC_SIZE_BYTES / 2; i++) { + input.uh[i] =3D 0x0100; /* weight=3D1, bucket=3D0 */ + } + + asm volatile( + /* Zero out v0 (the target for bucket 0) */ + "v0 =3D vmem(%[zero] + #0)\n\t" + "{\n\t" + " v12.tmp =3D vmem(%[inp] + #0)\n\t" + " vwhist256\n\t" + "}\n\t" + "vmem(%[out] + #0) =3D v0\n\t" + : + : [inp] "r"(&input), [zero] "r"(&zero_vec), + [out] "r"(&result) + : "v0", "v12", "memory"); + + /* + * 64 input halfwords all targeting bucket 0. + * elindex =3D (i & ~7) | (bucket & 7) =3D i & ~7 (since bucket=3D0). + * So elements 0,8,16,24,32,40,48,56 each get 8 increments. + */ + for (i =3D 0; i < 64; i++) { + uint16_t expected =3D ((i & 7) =3D=3D 0) ? 8 : 0; + check16(result.uh[i], expected); + } +} + +/* + * Test vwhist256:sat -- saturating variant. + * Use weight=3D0xFF to test that saturation to 0xFFFF works. + */ +static void test_vwhist256_sat(void) +{ + int i; + + for (i =3D 0; i < MAX_VEC_SIZE_BYTES / 2; i++) { + input.uh[i] =3D 0xFF00; /* weight=3D0xFF, bucket=3D0 */ + } + + asm volatile( + "v0 =3D vmem(%[zero] + #0)\n\t" + "{\n\t" + " v12.tmp =3D vmem(%[inp] + #0)\n\t" + " vwhist256:sat\n\t" + "}\n\t" + "vmem(%[out] + #0) =3D v0\n\t" + : + : [inp] "r"(&input), [zero] "r"(&zero_vec), + [out] "r"(&result) + : "v0", "v12", "memory"); + + /* + * Same distribution as vwhist256: elements 0,8,16,...,56. + * Each gets 8 * 0xFF =3D 2040 =3D 0x7F8 (within uint16 range). + */ + for (i =3D 0; i < 64; i++) { + uint16_t expected =3D ((i & 7) =3D=3D 0) ? 8 * 0xFF : 0; + check16(result.uh[i], expected); + } +} + +/* + * Test vwhist128: 128-bin histogram with 32-bit accumulation. + * bucket bits [7:3] -> vindex, [2:1] + lane -> element (word granularity). + */ +static void test_vwhist128(void) +{ + int i; + + for (i =3D 0; i < MAX_VEC_SIZE_BYTES / 2; i++) { + input.uh[i] =3D 0x0100; /* weight=3D1, bucket=3D0 */ + } + + asm volatile( + "v0 =3D vmem(%[zero] + #0)\n\t" + "{\n\t" + " v12.tmp =3D vmem(%[inp] + #0)\n\t" + " vwhist128\n\t" + "}\n\t" + "vmem(%[out] + #0) =3D v0\n\t" + : + : [inp] "r"(&input), [zero] "r"(&zero_vec), + [out] "r"(&result) + : "v0", "v12", "memory"); + + /* + * 128-bin: 64 halfwords all targeting bucket 0. + * bucket 0 -> vindex=3D0, elindex based on (i>>1)&(~3) | (bucket>>1)&= 3. + * With bucket=3D0, elindex =3D (i>>1)&(~3). + * For i=3D0,1: elindex=3D0; i=3D2,3: elindex=3D0; ... up to i=3D6,7: = elindex=3D0 + * i ranges 0..63. (i>>1) ranges 0..31. + * (i>>1)&(~3) =3D 0,0,0,0,4,4,4,4,8,... + * So elements 0,4,8,12,16,20,24,28 each get 8 increments. + */ + for (i =3D 0; i < 32; i++) { + uint32_t expected =3D ((i & 3) =3D=3D 0) ? 8 : 0; + check32(result.uw[i], expected); + } +} + +/* + * Test vwhist128(#0) -- masked variant. + * Only processes elements where (bucket & 1) =3D=3D mode. + */ +static void test_vwhist128m(void) +{ + int i; + + /* All bucket=3D0, weight=3D1. bucket&1=3D=3D0, so mode=3D0 matches a= ll. */ + for (i =3D 0; i < MAX_VEC_SIZE_BYTES / 2; i++) { + input.uh[i] =3D 0x0100; /* weight=3D1, bucket=3D0 */ + } + + asm volatile( + "v0 =3D vmem(%[zero] + #0)\n\t" + "{\n\t" + " v12.tmp =3D vmem(%[inp] + #0)\n\t" + " vwhist128(#0)\n\t" + "}\n\t" + "vmem(%[out] + #0) =3D v0\n\t" + : + : [inp] "r"(&input), [zero] "r"(&zero_vec), + [out] "r"(&result) + : "v0", "v12", "memory"); + + /* Same distribution as vwhist128 since all buckets have bit0=3D0 */ + for (i =3D 0; i < 32; i++) { + uint32_t expected =3D ((i & 3) =3D=3D 0) ? 8 : 0; + check32(result.uw[i], expected); + } + + /* Now test with mode=3D1: bucket=3D0 has bit0=3D0, so nothing should = match */ + memset(&result, 0, sizeof(result)); + asm volatile( + "v0 =3D vmem(%[zero] + #0)\n\t" + "{\n\t" + " v12.tmp =3D vmem(%[inp] + #0)\n\t" + " vwhist128(#1)\n\t" + "}\n\t" + "vmem(%[out] + #0) =3D v0\n\t" + : + : [inp] "r"(&input), [zero] "r"(&zero_vec), + [out] "r"(&result) + : "v0", "v12", "memory"); + + for (i =3D 0; i < 32; i++) { + check32(result.uw[i], 0); + } +} + +static MMVector ones_vec __attribute__((aligned(MAX_VEC_SIZE_BYTES))); + +/* + * Test vwhist256(Qv4) -- Q-masked vwhist256. + * Set Q0 to all-ones so all elements pass the mask -> same as vwhist256. + */ +static void test_vwhist256q(void) +{ + int i; + + for (i =3D 0; i < MAX_VEC_SIZE_BYTES / 2; i++) { + input.uh[i] =3D 0x0100; /* weight=3D1, bucket=3D0 */ + } + + asm volatile( + "v0 =3D vmem(%[zero] + #0)\n\t" + "v1 =3D vmem(%[ones] + #0)\n\t" + "q0 =3D vcmp.eq(v1.b, v1.b)\n\t" /* all-ones Q0 */ + "{\n\t" + " v12.tmp =3D vmem(%[inp] + #0)\n\t" + " vwhist256(q0)\n\t" + "}\n\t" + "vmem(%[out] + #0) =3D v0\n\t" + : + : [inp] "r"(&input), [zero] "r"(&zero_vec), + [out] "r"(&result), [ones] "r"(&ones_vec) + : "v0", "v1", "v12", "q0", "memory"); + + for (i =3D 0; i < 64; i++) { + uint16_t expected =3D ((i & 7) =3D=3D 0) ? 8 : 0; + check16(result.uh[i], expected); + } +} + +/* + * Test vwhist256(Qv4):sat -- Q-masked saturating vwhist256. + */ +static void test_vwhist256q_sat(void) +{ + int i; + + for (i =3D 0; i < MAX_VEC_SIZE_BYTES / 2; i++) { + input.uh[i] =3D 0xFF00; /* weight=3D0xFF, bucket=3D0 */ + } + + asm volatile( + "v0 =3D vmem(%[zero] + #0)\n\t" + "v1 =3D vmem(%[ones] + #0)\n\t" + "q0 =3D vcmp.eq(v1.b, v1.b)\n\t" + "{\n\t" + " v12.tmp =3D vmem(%[inp] + #0)\n\t" + " vwhist256(q0):sat\n\t" + "}\n\t" + "vmem(%[out] + #0) =3D v0\n\t" + : + : [inp] "r"(&input), [zero] "r"(&zero_vec), + [out] "r"(&result), [ones] "r"(&ones_vec) + : "v0", "v1", "v12", "q0", "memory"); + + for (i =3D 0; i < 64; i++) { + uint16_t expected =3D ((i & 7) =3D=3D 0) ? 8 * 0xFF : 0; + check16(result.uh[i], expected); + } +} + +/* + * Test vwhist128(Qv4) -- Q-masked vwhist128. + */ +static void test_vwhist128q(void) +{ + int i; + + for (i =3D 0; i < MAX_VEC_SIZE_BYTES / 2; i++) { + input.uh[i] =3D 0x0100; /* weight=3D1, bucket=3D0 */ + } + + asm volatile( + "v0 =3D vmem(%[zero] + #0)\n\t" + "v1 =3D vmem(%[ones] + #0)\n\t" + "q0 =3D vcmp.eq(v1.b, v1.b)\n\t" + "{\n\t" + " v12.tmp =3D vmem(%[inp] + #0)\n\t" + " vwhist128(q0)\n\t" + "}\n\t" + "vmem(%[out] + #0) =3D v0\n\t" + : + : [inp] "r"(&input), [zero] "r"(&zero_vec), + [out] "r"(&result), [ones] "r"(&ones_vec) + : "v0", "v1", "v12", "q0", "memory"); + + for (i =3D 0; i < 32; i++) { + uint32_t expected =3D ((i & 3) =3D=3D 0) ? 8 : 0; + check32(result.uw[i], expected); + } +} + +/* + * Test vwhist128(Qv4,#0) -- Q-masked mode vwhist128. + */ +static void test_vwhist128qm(void) +{ + int i; + + for (i =3D 0; i < MAX_VEC_SIZE_BYTES / 2; i++) { + input.uh[i] =3D 0x0100; /* weight=3D1, bucket=3D0 */ + } + + asm volatile( + "v0 =3D vmem(%[zero] + #0)\n\t" + "v1 =3D vmem(%[ones] + #0)\n\t" + "q0 =3D vcmp.eq(v1.b, v1.b)\n\t" + "{\n\t" + " v12.tmp =3D vmem(%[inp] + #0)\n\t" + " vwhist128(q0,#0)\n\t" + "}\n\t" + "vmem(%[out] + #0) =3D v0\n\t" + : + : [inp] "r"(&input), [zero] "r"(&zero_vec), + [out] "r"(&result), [ones] "r"(&ones_vec) + : "v0", "v1", "v12", "q0", "memory"); + + /* bucket=3D0, bit0=3D0, mode=3D0 matches -> same as vwhist128 */ + for (i =3D 0; i < 32; i++) { + uint32_t expected =3D ((i & 3) =3D=3D 0) ? 8 : 0; + check32(result.uw[i], expected); + } +} + +int main(void) +{ + memset(&zero_vec, 0, sizeof(zero_vec)); + memset(&ones_vec, 0xff, sizeof(ones_vec)); + + test_vwhist256(); + test_vwhist256_sat(); + test_vwhist128(); + test_vwhist128m(); + test_vwhist256q(); + test_vwhist256q_sat(); + test_vwhist128q(); + test_vwhist128qm(); + + puts(err ? "FAIL" : "PASS"); + return err ? 1 : 0; +} diff --git a/tests/tcg/hexagon/meson.build b/tests/tcg/hexagon/meson.build index fbea3154ed7..0273cb7b931 100644 --- a/tests/tcg/hexagon/meson.build +++ b/tests/tcg/hexagon/meson.build @@ -94,6 +94,7 @@ tests +=3D { 'test_vminh.S': {'cflags': asmflags}, 'test_vpmpyh.S': {'cflags': asmflags}, 'test_vspliceb.S': {'cflags': asmflags}, + 'test_vwhist.c': {'cflags': [cflags, '-mhvx']}, 'unaligned_pc.c': {'cflags': cflags}, 'unaligned_data.c': {'cflags': cflags}, 'usr.c': { --=20 2.34.1 From nobody Sat Sep 26 20:01:26 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=1789489938; cv=none; d=zohomail.com; s=zohoarc; b=k1FGT/YH5f4fkoXAKzZnUHhrhX6Ee8DGFCDyw90ZizJ58OI4swmQzZj79LRntXeY+AJ9nu6qHV0/KsKmuNjea771WHTrXZAzPD5EirA8hrJC+DqWq6XhqCfI3Ieclc0TfGib5YJ9oP0YBR+EuyIwrlf2Ojzxx3LsqIdwLWgDksQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789489938; h=Content-Type: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=hqfVicHy6v894bNbcDZGGKOJEk5tlT9bKuiAy6xrO9Q=; b=g6bk1dlh1DBG1jKJ9jUJ21SMi+dqEReYFoyfV9CfYFp36Fz2AMYzD2AEAw1SEvBJHlZkRqSZBYhlkBEzARFurnBZaHhgKugsFEAto1VSLIn7K9XRy2mUNmNIUPwkGTLpmwzP60V9oSR0YJoxxPKd79afHZS+yp9K7sd9msYjepA= 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 1789489938475360.0922219860116; Tue, 15 Sep 2026 09:32:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x6W4O-00063O-QM; Tue, 15 Sep 2026 12:31: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 1x6W46-0005wp-1g for qemu-devel@nongnu.org; Tue, 15 Sep 2026 12:31:28 -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 1x6W43-0003qm-0y for qemu-devel@nongnu.org; Tue, 15 Sep 2026 12:31:25 -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 68FFAPeK813402 for ; Tue, 15 Sep 2026 16:31:21 GMT Received: from mail-pj1-f70.google.com (mail-pj1-f70.google.com [209.85.216.70]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4gq6kc1740-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 15 Sep 2026 16:31:20 +0000 (GMT) Received: by mail-pj1-f70.google.com with SMTP id 98e67ed59e1d1-39b6416441eso8893599a91.1 for ; Tue, 15 Sep 2026 09:31:20 -0700 (PDT) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-39dfdd0baaasm6068590a91.9.2026.09.15.09.31.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Sep 2026 09:31:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= hqfVicHy6v894bNbcDZGGKOJEk5tlT9bKuiAy6xrO9Q=; b=Psa/d0XVf0UNzzqg LqadgSJUaJjkV+mz578HQlxDbwiaySm/bA87SaMOqqVlj6wgAfgvk6MBmZiJp26b fcKjtTMUvC3pZouHZVIkyDE6vUYHAVoUfSZPSZNJRwMMHb9RTEpEcu6BHy/K83yl 1h2P9/tJuDgNCESRx0ihzSsGNmPEKjPJxehhG8yAFuDjj5YpVCJN1oYt4baMacYK TV8XUn65Vy9NoPGEhtAi5v1IvuDIRNNeQSOXJUwWcSCF2NiIiPKkXenisFKBAJ2+ YrbvuAIIyRxzWNW7Bu0qaj3Tw+Idn2soa74aiD99fg76NFKfmWebZ50ME2z/fqye QUsmCw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1789489880; x=1790094680; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=hqfVicHy6v894bNbcDZGGKOJEk5tlT9bKuiAy6xrO9Q=; b=IOAG8BnVJoMziQ8DFDrV33FG+ZbZL8jHRSuY9PPWg7c0oOdPb1SR9ISXEGfLw6MhJU OfLYCTbVFfRpOrAOiIiapluiybxBDtEpIRp8Gmz4jqKvUeRlmiziAvQYYaSLiE13LdHa ul/jThWshChvIlg6YV1pWSvC8h8doBKfoCH4J15Ya1gDw83JLaFqOXdFLUnkiBt2TFxF EINjlbREwKn53emvshZm9QRAjJyiXDo8CCnvuJPgzFunYur/P80pbXbs4+Qoasl+QGrA 4ZM+NndGdVIhoq/xgah1v8WV3VifjTmJduM2tZimUUBU0TwhWqCVzfoTJXGwqjjtOjFh pajw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789489880; x=1790094680; h=content-transfer-encoding:content-type: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 :content-type; bh=hqfVicHy6v894bNbcDZGGKOJEk5tlT9bKuiAy6xrO9Q=; b=Rkh9ceMBmq/ctAG0eIry83TxJiiUXxhymhmcuL0HrnTwZPRgfbJ1ZfWyw4+5NvTBwG LPOPZr1k+zh45KPQJJa2082g1AdbBVFjy9Ib2dosfEoDf+/Hs+2pYHH59cGA0ORd3Hex HluxEx9vTktI2jKR3hqb3bRd1sjie2XcJZQGaVvyZkWpuo5MDGGWjLWsGV7iDw5smP9l QNODRivG2OUwFK1aC989knLhTd2VZ8JK5k2sF3V/B4wMPuuqcPEEG80VL4oFeAFprmh6 yxT7syWxdbYqJprvXfJ6QCbMKqgJDmxumfougA0O2Y7gI6ZEbOAbxDEAG9ABL+3oKrNT bGCg== X-Gm-Message-State: AFuF++n1ZxQik5eunNzL3FVErp5VOYtXiCG9EoVC6hezRB9CTZlI3Q7j 3+s2ZeHO7cF/OCNXpgiixlKdrvvrBnF7x7TMzsxfKdj3KNwErlpv4rc1Pk+f/YSom1zkl5CrdPQ 845sShqV+9JGNkeLWUoizG4xtJpEjStVEm3kct3st9d/uLERv71cGQLIUNrk5DTBJ8g== X-Gm-Gg: AYBFou0ounW/BHuYuib1pFQ1ji0ECaggXV+9HQ+m8W32Rd8GDwpu7cuCCe4uBnZCOdj ngZWSh09tMV3WGgidWl+vGjVLiyLnzRhwEiYLlyTEV/1rhunWpS1dLdp3+u0IsNmHpjEj/CIQpk V6RGBX87Vm0AK/vB6OXmk57MydHvqcXMZBL6OiDBLhkGk5aJD+w/sOGGetm02ntC35LWizCGDsS q/+kCiBd22ra1wkumiYlTjUbG83XrAR5ViOZGDquzZreJd7Qzlwc7V49Rf2h69jFMIGad/hIQ1Q 19qoNy8Ss4eCS08SXg39vFaD7dzNrD2Z956Vp5nr5olqmGZVqPdd93usByP4z7rgHxwBmGw7OHm 5AX4fVae3D4kPUdw1fLyXKZ7pQSrvfxYVhTuc0GcaeIJcg6Nn X-Received: by 2002:a17:90b:4a85:b0:39d:f731:e5f3 with SMTP id 98e67ed59e1d1-39df731eb5dmr4669775a91.24.1789489880021; Tue, 15 Sep 2026 09:31:20 -0700 (PDT) X-Received: by 2002:a17:90b:4a85:b0:39d:f731:e5f3 with SMTP id 98e67ed59e1d1-39df731eb5dmr4669717a91.24.1789489879504; Tue, 15 Sep 2026 09:31:19 -0700 (PDT) From: Brian Cain To: qemu-devel@nongnu.org Cc: sid.manning@oss.qualcomm.com, Pierrick Bouvier , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Brian Cain Subject: [PATCH v2 11/17] tests/tcg/hexagon: add sfrecipa edge case tests Date: Tue, 15 Sep 2026 09:30:41 -0700 Message-Id: <20260915163047.4180600-12-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260915163047.4180600-1-brian.cain@oss.qualcomm.com> References: <20260915163047.4180600-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Info: AW1haW4tMjYwOTE1MDIzOSBTYWx0ZWRfX42SNm9t/iHFz 53i6zsnscGn/JpVYDKeEdxnz61I1sDRDu+ayPbjSR652YwzuCEBwTIeehC+itHHvc4mFEbZnJvn ZB0vg8LNNTMiMe5KLbfxGgwku7Li4sw= X-Proofpoint-GUID: sPOw0bMFZJArg81JfgFoilI20DCKgmAG X-Authority-Analysis: v=2.4 cv=ZINCCn7b c=1 sm=1 tr=0 ts=6aa972d8 cx=c_pps a=0uOsjrqzRL749jD1oC5vDA==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=Um2Pa8k9VHT-vaBCBUpS:22 a=EUspDBNiAAAA:8 a=iLNeMspusdFBM-S5qpkA:9 a=QEXdDO2ut3YA:10 a=mQ_c8vxmzFEMiUWkPHU9:22 X-Proofpoint-ORIG-GUID: sPOw0bMFZJArg81JfgFoilI20DCKgmAG X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTE1MDIzOSBTYWx0ZWRfXwTyssixZwZS2 BRk35rmiDguMgOIl4impepNM6c3yCU8YP9oohtxZFngh56allzjbjxZpYnNF1tVcywZX/JXCGLf XyxkOWe8Cg0QZGMg0D6bxOs/+BSORBJ012daf5bkauAQMxjnUNJ/wn+FCva5w/aRsQ3c5dbr7HW +DVRDi80E1XVBqkEwUHUCc9AhVO8wZ1BfkAX+5WmXNO+eI9nN6OtjyblhjJ/L+spIC+Q7FpiLlW NLaMi365XQ/STOz4KxFxp51BLYgGiaX95unB3dFJ5GtJKx+d9qU11wvwbb+XmxhkgNvLa2g/5TQ MYuHNof0xr3R+Kyk2Y1sQoyeZ8xVmlji0+NzUEGWG1FLiPbKPgpj/UkpkgFW/v0ex9QRzSjY4uq h6NcB+7iGnXXl1d9APLzJGfehzrdybga2utBqbFneDqCxO3P56HTzxCSVbbjC1/rPFw0uolDBv6 v1EiOkmInDUiEPBL9gw== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-15_04,2026-09-15_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 bulkscore=0 phishscore=0 priorityscore=1501 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609150239 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=brian.cain@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, 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: 1789489940464158500 Add edge case tests for the sfrecipa instruction Reviewed-by: Pierrick Bouvier Signed-off-by: Brian Cain --- tests/tcg/hexagon/fpstuff.c | 81 +++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/tests/tcg/hexagon/fpstuff.c b/tests/tcg/hexagon/fpstuff.c index 7561f31cdc3..f82262ab4ac 100644 --- a/tests/tcg/hexagon/fpstuff.c +++ b/tests/tcg/hexagon/fpstuff.c @@ -345,6 +345,86 @@ static void check_sfrecipa(void) check32(pred, 0x80); } =20 +/* + * Helper to run sfrecipa and capture result + USR. + */ +static void do_sfrecipa(uint32_t Rs, uint32_t Rt, + uint32_t *Rd, uint32_t *usr_out) +{ + uint32_t rd, usr; + + asm volatile(CLEAR_FPSTATUS + "%[rd],p0 =3D sfrecipa(%[Rs], %[Rt])\n\t" + "%[usr] =3D usr\n\t" + : [rd] "=3Dr"(rd), [usr] "=3Dr"(usr) + : [Rs] "r"(Rs), [Rt] "r"(Rt) + : "p0", "r2", "usr"); + *Rd =3D rd; + *usr_out =3D usr; +} + +/* + * Additional sfrecipa edge cases: + * - inf/inf, 0/0 -> NaN + invalid + * - normal/inf, 0/normal, inf/normal + * - denominator with extreme biased exponents + */ +static void check_sfrecipa_edges(void) +{ + uint32_t rd, usr; + + /* inf / inf -> invalid */ + do_sfrecipa(SF_INF, SF_INF, &rd, &usr); + check_fpstatus(usr, USR_FPINVF); + + /* -inf / +inf -> invalid */ + do_sfrecipa(0xff800000, SF_INF, &rd, &usr); + check_fpstatus(usr, USR_FPINVF); + + /* 0 / 0 -> invalid */ + do_sfrecipa(SF_zero, SF_zero, &rd, &usr); + check_fpstatus(usr, USR_FPINVF); + + /* -0 / +0 -> invalid */ + do_sfrecipa(SF_zero_neg, SF_zero, &rd, &usr); + check_fpstatus(usr, USR_FPINVF); + + /* normal / inf -> fixup (Rd =3D 1.0) */ + do_sfrecipa(SF_one, SF_INF, &rd, &usr); + check32(rd, SF_one); + + do_sfrecipa(SF_two, SF_INF, &rd, &usr); + check32(rd, SF_one); + + /* 0 / normal -> fixup (Rd =3D 1.0) */ + do_sfrecipa(SF_zero, SF_one, &rd, &usr); + check32(rd, SF_one); + + do_sfrecipa(SF_zero_neg, SF_two, &rd, &usr); + check32(rd, SF_one); + + /* inf / normal -> fixup (Rd =3D 1.0) */ + do_sfrecipa(SF_INF, SF_one, &rd, &usr); + check32(rd, SF_one); + + do_sfrecipa(0xff800000, SF_two, &rd, &usr); + check32(rd, SF_one); + + /* + * Denominator with biased exponent <=3D 1. + * Rs: biased exp 26, Rt: biased exp 1. + */ + do_sfrecipa(26U << 23, 1U << 23, &rd, &usr); + check32_ne(rd, 0); + + /* + * Denominator with biased exponent > 252. + * Both: biased exp 253. + */ + do_sfrecipa(253U << 23, 253U << 23, &rd, &usr); + check32_ne(rd, 0); +} + static void check_canonical_NaN(void) { uint32_t sf_result; @@ -887,6 +967,7 @@ int main() check_sfminmax(); check_dfminmax(); check_sfrecipa(); + check_sfrecipa_edges(); check_canonical_NaN(); check_invsqrta(); check_sffixupn(); --=20 2.34.1 From nobody Sat Sep 26 20:01:26 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=1789489928; cv=none; d=zohomail.com; s=zohoarc; b=cPbcnENw5t3fwI+VUYunnTtXYFgV+NnRC8ifyjVLGrJIwtRDN1xjtCqVEyF/nuqKqxII+kbbOl3c9izqCO+DVnL2UkRKEjxDP0T5yrxuxcgorlr2QkMbGqFy/uwlIRJtwfAvwSySuYTmqflnyrfqfq6cnWkHvRd/FgQZGwF/L3M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789489928; h=Content-Type: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=guMuSpkJh4ywaheNw4BuJpOegoZiRuIVSSULtLUUsTY=; b=lDwaCev4RJmlruD2LRDRSWqdVv2wKAMxMT1ejPVl3tu3AckYfKK+urXn+WrbrZjta/+cnlTAJyjzWQGbdfj1+Q3LDyA7mAJDDcwlOJWC28cKEeaPkqWAQUi/uJ/veU3OsfKNrG3wyWhE/lU3Dylci6qnMeuS0tHdS4woUysSzoM= 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 1789489928354962.0712592668449; Tue, 15 Sep 2026 09:32:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x6W4T-00067u-RT; Tue, 15 Sep 2026 12:31:50 -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 1x6W48-0005y8-Tm for qemu-devel@nongnu.org; Tue, 15 Sep 2026 12:31:28 -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 1x6W45-0003rG-FT for qemu-devel@nongnu.org; Tue, 15 Sep 2026 12:31:26 -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 68FFANV1813359 for ; Tue, 15 Sep 2026 16:31:24 GMT Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4gq6kc174d-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 15 Sep 2026 16:31:23 +0000 (GMT) Received: by mail-pj1-f71.google.com with SMTP id 98e67ed59e1d1-39e087a17dfso1179435a91.3 for ; Tue, 15 Sep 2026 09:31:23 -0700 (PDT) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-39dfdd0baaasm6068590a91.9.2026.09.15.09.31.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Sep 2026 09:31:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= guMuSpkJh4ywaheNw4BuJpOegoZiRuIVSSULtLUUsTY=; b=JDF1eODgaT1kaAvK HmFIM5edv9N4HLH332HBt1iqwR0mrW8dEYrozdeFQ/w6h1eG9CcBXj2POD6xx+Xy AuxorQa4NBNBRabvx45ljmFTz2B/R7mid7sFKMf0Xikm86Oa/uJBfgXhv8OaQLV5 tyO9IcoasmHyhA4m7nmJPMbyUsEih+0sAceTrpg9ctQXXGAGsHNgx2hYGxVWAULA wv/sGzsZ5IspdWOGle0RjqBnYpRRwALhzzx9i00mnef8g3GSwkylj+Uv16SwEVSu CmpPjQ8oxmujDRSEp77Qumxes7bZodyHcghxWGigUCrVlto9+oIxY5X1EjIwdgWK DX1aDA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1789489883; x=1790094683; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=guMuSpkJh4ywaheNw4BuJpOegoZiRuIVSSULtLUUsTY=; b=Wbn1pzJedI+SNHji9ORec4WCDwYIy6CMBPTmtV8hUx7IzSqTUhkDgU8AOW1Gf+D5A6 ohtnzHke+Rxw7D5Y2lR+rmmEmLPowvdZl28D4+jsqCdQsosDWGz4jPac4p4K0gt70jk2 Jp/4QuOEE8LOFS1qHQT9Seh4CSrJ8ec6G/Qm30Ai/AizQVdUxIR56ySP5lx0JpjB2bCr iXTAgqq7zZ2hg4RLfhdPKxsWtW8f4n/VBzApDwNinN6a0k8/DQvXSddmypZam1Le9Ku5 0kuNgv6Ae79M8hEI4W8Ybtj1r8VbG/+li5BoyCO0GXMpsXD3rWkaCxWOOu3qseDqdYmR GT/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789489883; x=1790094683; h=content-transfer-encoding:content-type: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 :content-type; bh=guMuSpkJh4ywaheNw4BuJpOegoZiRuIVSSULtLUUsTY=; b=iyqjPLsPa5sfyd49Wc1/Gf2oUl+J1HDahkOTQ31XxiVzv/2qfVvVDs+rqsOjhT9c/X ZFLf5j3OIzAG/VtO2Txyh5Wqqw1Hq9GqdRXhfZNKEU7u8+hufO28HKlZOO8ehspa/QI7 +loZdCisiyaUoQXrz6a5sMFJEUgBRwDhr0o/beUU9rB7uZ8Qcl4PBpGjc21eRLcIgOWY axTzMla8teVC5qPfBUiOR+aR926jL2FUdpn00MkcnyDvzMRHHgufN+x/5Rm2o50rEgvp LXn7cHpiiaYiZYfAG8hknjloLqqAmrSbuJN0FqSAtNVGjStHV5AaDb9VWsDamJIgS+tj BD2A== X-Gm-Message-State: AFuF++npVD7HEzal729dHhZtmfeyfUoWMJ7jJCcD5YfpwXYvpLCNETMv XyRVweAtquKEYFOYtDQhopZZn4cqyjS8rqXlR0CCQ3Fu3X3OSaEawcWssh5AeHIJzyr85aDDdIB Pt4dSt/yrmPeCKRPH27NXWcmNFRVNYIFlYk+iH44sQIZd+eS0BX2EZ2grVf7qobQ8bw== X-Gm-Gg: AYBFou3iod1bs4QqOfqPz03liMMdmxmzcux0AeT57ZAtIXLH4xGQa6AFrBLcjvRPspT 9yXUUSM+ZGzC4cPwhYMViANhey8IxvWHqxbEANPypxl7OjhQWckzWNp/bmFBTldDKRwvpbKZo0q f3oJchehGT21CQooh045y7Nlqd379eLUHcPbpJDiun1g4frDGg8yIquIhPpd+IHHTy5jinub+cS fQM/JxrK1FcNXmIgHsIYeL2sRzKb1+b53QXUAFnXZNitfTdobpbiJ3e1b6A+Xt9zI/d3hoTKCR9 RQ1u3zZUS4JNrsM5DbxJNonUKoy+xiRZ4b1B333XrdHd+mzEtyN3r5fWgKCYeUoN03NXJYs5QdY gd70KiBcIRRaDyFKh3x7tX1BJdNCZLlLuMmKsDdtKXwc1h/OI X-Received: by 2002:a17:90b:1dc6:b0:39d:84af:a0b3 with SMTP id 98e67ed59e1d1-39dec09cf6dmr16214762a91.18.1789489882793; Tue, 15 Sep 2026 09:31:22 -0700 (PDT) X-Received: by 2002:a17:90b:1dc6:b0:39d:84af:a0b3 with SMTP id 98e67ed59e1d1-39dec09cf6dmr16214683a91.18.1789489882144; Tue, 15 Sep 2026 09:31:22 -0700 (PDT) From: Brian Cain To: qemu-devel@nongnu.org Cc: sid.manning@oss.qualcomm.com, Pierrick Bouvier , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Brian Cain Subject: [PATCH v2 12/17] tests/tcg/hexagon: add dfmpyhh Date: Tue, 15 Sep 2026 09:30:42 -0700 Message-Id: <20260915163047.4180600-13-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260915163047.4180600-1-brian.cain@oss.qualcomm.com> References: <20260915163047.4180600-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Info: AW1haW4tMjYwOTE1MDIzOSBTYWx0ZWRfX57zDyfRD1UGo RT+A4SUQk5AQzdauPvxxAjYgxHvo1fm3iVnvCFPJwZMNOLiIA+rhCzZPPGahik2I5xsVKNk5jvh VTPMxPN4vI2zX0SaJpSpV22WMkw5+hc= X-Proofpoint-GUID: 0xizuJev1SYHPb1tdAzBz-owIUrW8bU9 X-Authority-Analysis: v=2.4 cv=ZINCCn7b c=1 sm=1 tr=0 ts=6aa972db cx=c_pps a=UNFcQwm+pnOIJct1K4W+Mw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=Um2Pa8k9VHT-vaBCBUpS:22 a=EUspDBNiAAAA:8 a=7ev5N2rqXU9IWHHYf1oA:9 a=QEXdDO2ut3YA:10 a=uKXjsCUrEbL0IQVhDsJ9:22 X-Proofpoint-ORIG-GUID: 0xizuJev1SYHPb1tdAzBz-owIUrW8bU9 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTE1MDIzOSBTYWx0ZWRfX0g5YMZDtyqAk MF8eLp2KuDpo8u+0awE9K+wa9ETjZ+hvsSHn0sNlKT3fpYwA5HnKxr1N3drG9zdb+ysbj46G51A +bVxucCuCwncFUR+++QrBeO9wUhvWSloLdeQiSi7imtuemK8FFSlh2msunjUgiHPa8EG6ALypMa BoJ5Ktiy/gTA+85KRuTQqlDmBe46vfOWbMAXImXr3bcjwfXnkpOrKliZ3pDVUKfCTfTg5x2G2LH +n9hopIMCpR8TrfOl49yvU0nLx60FU5LEMdt/NiSpxmCKwv+Xdhi6wEOUwCrRS4i+/CzLzQGr4H WpqA3tWp7twpLQ6D8M0l8qIJQ1hMqy79KV6qXH/MSDGq0A+FOHc4a0psbi9ErGF9L1IdHxRSnhS /mSJoQbWmZgZCWGgub5nJ0SMmZo3ovVhhhR8oHAP+pkR++HP4EZjc0WHZJfEN5NzpNyliG7cH70 yylAQCZy24acop5rq4A== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-15_04,2026-09-15_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 bulkscore=0 phishscore=0 priorityscore=1501 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609150239 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=brian.cain@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, 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: 1789489930379158500 Test the dfmpyhh instruction. Reviewed-by: Pierrick Bouvier Signed-off-by: Brian Cain --- tests/tcg/hexagon/fpstuff.c | 57 +++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/tests/tcg/hexagon/fpstuff.c b/tests/tcg/hexagon/fpstuff.c index f82262ab4ac..0f28a218d84 100644 --- a/tests/tcg/hexagon/fpstuff.c +++ b/tests/tcg/hexagon/fpstuff.c @@ -935,6 +935,16 @@ static uint64_t do_dfmpyfix(uint64_t a, uint64_t b) return result; } =20 +static uint64_t do_dfmpyhh(uint64_t a, uint64_t b, uint64_t acc) +{ + uint64_t result =3D acc; + + asm("%[res] +=3D dfmpyhh(%[a], %[b])\n\t" + : [res] "+r"(result) + : [a] "r"(a), [b] "r"(b)); + return result; +} + static void check_dfmpyfix(void) { /* @@ -961,6 +971,52 @@ static void check_dfmpyfix(void) 0x0010000000000000ULL); } =20 +/* + * Test dfmpyhh (double-precision FP multiply high*high and accumulate): + * - normal inputs + * - denormal inputs (crushed to inexact zero) + * - zero/NaN/infinity inputs + * - nonzero accumulator + */ +static inline uint64_t df_abs(uint64_t v) { return v & 0x7FFFFFFFFFFFFFFFU= LL; } +static inline uint64_t df_exp(uint64_t v) { return v & 0x7FF0000000000000U= LL; } +static inline uint64_t df_mant(uint64_t v) { return v & 0x000FFFFFFFFFFFFF= ULL; } + +static void check_dfmpyhh(void) +{ + uint64_t result; + + /* Normal * normal: 1.0 * 1.0 + 0 -> nonzero finite */ + result =3D do_dfmpyhh(DF_one, DF_one, 0ULL); + check64_ne(df_abs(result), 0ULL); + + /* Denormal input a: crushed to zero */ + result =3D do_dfmpyhh(0x0008000000000000ULL, DF_one, 0ULL); + check64(df_abs(result), 0ULL); + + /* Denormal input b: crushed to zero */ + result =3D do_dfmpyhh(DF_one, 0x0008000000000000ULL, 0ULL); + check64(df_abs(result), 0ULL); + + /* Zero input: early exit */ + result =3D do_dfmpyhh(DF_zero, DF_one, 0ULL); + check64(df_abs(result), 0ULL); + + /* Infinity input: early exit, result contains inf */ + result =3D do_dfmpyhh(0x7FF0000000000000ULL, DF_one, 0ULL); + check64(df_exp(result), 0x7FF0000000000000ULL); + + /* NaN input: early exit, result is NaN */ + result =3D do_dfmpyhh(DF_QNaN, DF_one, 0ULL); + check64(df_exp(result), 0x7FF0000000000000ULL); + check64_ne(df_mant(result), 0ULL); + + /* Nonzero accumulator: nonzero finite result */ + result =3D do_dfmpyhh(DF_one, DF_one, DF_one); + check64_ne(df_abs(result), 0ULL); + check64_ne(df_exp(result), 0x7FF0000000000000ULL); +} + int main() { check_compare_exception(); @@ -981,6 +1037,7 @@ int main() check_conv_uw2df(); check_conv_ud2df(); check_dfmpyfix(); + check_dfmpyhh(); =20 puts(err ? "FAIL" : "PASS"); return err ? 1 : 0; --=20 2.34.1 From nobody Sat Sep 26 20:01:26 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=1789489939; cv=none; d=zohomail.com; s=zohoarc; b=d6guwW1fiRNKzfSZW66/qZDQBb/yQ1yXvMV5aJTRyAYSYPQm1I337g+149FIJeq8i8DVa0yIB7zXR8z20fj8Oz1CIyeH6XrdVQ6jxGfo+B8dP5ZptD57+nG2DyV4oUhzUxchVlM2vDzMZky3j0qvd8KliROyI64aHlq47Z9NJrY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789489939; h=Content-Type: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=8f+YUKiUCgruigEWW6RCmqNqjaanWMaUWMcLnw3kF70=; b=ny/WpWZQe7s4mr7/+icIhc5EQO3oozHESZn1hfWWrDCSrbRzeU1AOvKyiwlnT3sxJ72xCJwNfI8CEoKvN+J8SY5iOLM9FgQ5BV7OjxTbO0uYN9zq3CmZFXxXtiQsMBrllR63F0xxVi6qZH5fsbWzrXJpf++Y26/M1fMfbIMqAGE= 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 1789489939662578.3754323476744; Tue, 15 Sep 2026 09:32:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x6W4O-00063N-Q5; Tue, 15 Sep 2026 12:31: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 1x6W4D-0005zq-BA for qemu-devel@nongnu.org; Tue, 15 Sep 2026 12:31:34 -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 1x6W4B-0003sS-Ik for qemu-devel@nongnu.org; Tue, 15 Sep 2026 12:31:33 -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 68FFAU704176153 for ; Tue, 15 Sep 2026 16:31:25 GMT Received: from mail-pj1-f72.google.com (mail-pj1-f72.google.com [209.85.216.72]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4gq3hc2dmh-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 15 Sep 2026 16:31:25 +0000 (GMT) Received: by mail-pj1-f72.google.com with SMTP id 98e67ed59e1d1-39e087a18deso1364684a91.0 for ; Tue, 15 Sep 2026 09:31:25 -0700 (PDT) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-39dfdd0baaasm6068590a91.9.2026.09.15.09.31.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Sep 2026 09:31:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= 8f+YUKiUCgruigEWW6RCmqNqjaanWMaUWMcLnw3kF70=; b=MH+mMJqPEiK/oKmK 2Cb5oQtsEwe482DHFdmMlCrMqLbibUxM/X8o5YjoqO3NK9zbLuWRR2eGQbqxvQsF amXIgq3AJ7R871OQsaodz4EdiPvTdAHq5DMNnSRuckI9wenWmkdyz696IXU22kPg AJmhaZwQoCFHC77UxMN0UJgLvBDhVARj2acBVVbmrQfGSdld0ziPaAQR0rHkDZvh OrZLY9dT3BM82CsfN8hHpAi1gl68cPW56AwddiayxDApvE5yc9KpuHciJxOXUNGo 41YG+gRtmCIbXwl8ntn+fMl/Luttgs+oK3ZfdxLBpj5WDroCKtrlaQptmqT81SFY fA1/Ow== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1789489885; x=1790094685; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=8f+YUKiUCgruigEWW6RCmqNqjaanWMaUWMcLnw3kF70=; b=KLSjTDD6wDWI3XqXtAMKoYNpjTRtzTca8To2rkLWizsqm2znuh3bPvyxk3zLmWuBwc Lna87xuGIKfPiHdaoybGSSiRwMv8bX9Ao7D6HdWDxvDNUxi/BSKI1N3ai0sZ76Qrpbpa 8/WHZKQsox1bSBXOC1+d+S5Czb70O/eYUwhv9iJk8F8g7fl+9EhYzXzcWtEgrwfkjmBc EbVGerbJt5s6ErfVPKrHt9bNn1pOnk1ibB7MB1Wo+OwDP34waIIfeS/PZumSDC1+MFar XzdyJCOQqilBNldMAECQvfpQeWuYJGDJUAqgYidiKXH6tvZ5P9ASuDCysOhXbW4b139J ddSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789489885; x=1790094685; h=content-transfer-encoding:content-type: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 :content-type; bh=8f+YUKiUCgruigEWW6RCmqNqjaanWMaUWMcLnw3kF70=; b=Oz8uGtebyDkfyNA+lAKsNwlVt3dQPCfSHWw0j5ktK9FDmYHgqTJroEiPawbg5AiSq4 pB6G4WIAEWuRW6DVTzlLw1IXW/1bzbFTyvfrdo1ZH0v0S67ETrSfRgZs+3H8Hzn3rAmF 4k0mB2CNHGvmK2d3lVkaZe610KS++gTYNgVr6CQdFez+uhF5bi1HBklcUdhYYpfhhKlS Bw+Hkf9n+l9LZDt3HfE7/alhNU3eyW3cJfNRhsDtfRgz2jUs7AdfmZKQ5foSqa6m1Wcr dKg9nppLSGQOk6QTA0gtcjLzcW/Y3nhN4vivtsPGW+aNg1ZWXzhzMZkfMGRlumWO8TZ/ tGCg== X-Gm-Message-State: AFuF++kBkVqnQ6ExgfrGsdKanjEQdSYZy8VWuIxLRUY3iwIVcHkxcbrL uccBoPYLv/XNZ3HTtZiGrBz3I7oaTKXUE5p2+UfhuY8b2u59E13Tf+maavgmPy6UiAvp4R37FrE iTpZELufn+DBsLkg6JtfGSpbDr7G8OuQYsfdTaZ+w0GJ/0GPZ5R0qhKHyk+DJcirrPA== X-Gm-Gg: AYBFou3Oj3ARsH3B70xXdrWIYPsyNZIejR0VW83ZCgmokI28ZrmDbFG4EdmipCsAiN9 86Tddlm/Aa2aqjLNvyL4yjJSd1wlJY/IOTb156GcGZdGQVcPhR1h0CdH1M2eHDsGXe16rR7+11b fvnVJr52M4Y/j1rMMJbau+iPOlvwuz/UOR5pluzuUx0G+rZKG2SvLtOgXkqfC2tugdsUc6hSaFD rDRbz1DZ2Dwy4wkocqh1Kg2skLjtunjvxPF6b0DbnykO21oHnoTRN12ZSiPXF7LZ+AW8xfBB/su wPg/l6aWBOSs6reBgFg58enZIDdDbtisHJUo+f73MhjXk2O4Bpey7cRsaMXl41pVaxgo8mWr6JD u+g7T+a+VCITrxCAxhghrfobfcjf8O0Yw+5qVNodk2GyeFE+6 X-Received: by 2002:a17:90a:dfc7:b0:39d:f5ef:b1d5 with SMTP id 98e67ed59e1d1-39df5efb222mr13595924a91.7.1789489884426; Tue, 15 Sep 2026 09:31:24 -0700 (PDT) X-Received: by 2002:a17:90a:dfc7:b0:39d:f5ef:b1d5 with SMTP id 98e67ed59e1d1-39df5efb222mr13595849a91.7.1789489883925; Tue, 15 Sep 2026 09:31:23 -0700 (PDT) From: Brian Cain To: qemu-devel@nongnu.org Cc: sid.manning@oss.qualcomm.com, Pierrick Bouvier , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Brian Cain Subject: [PATCH v2 13/17] tests/tcg/hexagon: add unconditional store-immediate tests Date: Tue, 15 Sep 2026 09:30:43 -0700 Message-Id: <20260915163047.4180600-14-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260915163047.4180600-1-brian.cain@oss.qualcomm.com> References: <20260915163047.4180600-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: nmL3D3lzgVoYKvhn4g7H62FXJMOB2gdn X-Proofpoint-Spam-Info: AW1haW4tMjYwOTE1MDI0MCBTYWx0ZWRfX2NL0bpcfMkrF ohoLLRxUDFZlCzKeHVDeO/6B/cxJ6Dukmq8t/otJX3eeXCWxt1sqvbILgt27W722nakO11P4/SE EEe8W+vkvisk+GUOdL4CCeGGcS/yjdA= X-Authority-Analysis: v=2.4 cv=dcUVTnXe c=1 sm=1 tr=0 ts=6aa972dd cx=c_pps a=RP+M6JBNLl+fLTcSJhASfg==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yOCtJkima9RkubShWh1s:22 a=EUspDBNiAAAA:8 a=0l-Zo2GwZyP_T63qDoMA:9 a=QEXdDO2ut3YA:10 a=iS9zxrgQBfv6-_F4QbHw:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTE1MDI0MCBTYWx0ZWRfX+ER58Z+aX+lE Fwe1XOkv1A23X342ooo61xfKx+DaNzT1VjuZqfnO5wHPTRmczeCS4ooySM/2UIbHFcME6pezaxN oenShQ2XUg+Z28cQeisc3DMU2JrE4aqOSDLMf03vhyWx4+bRiHNAK6kSQH3yzfij9FLqdkhqhm8 aNw1X1PnaMlcOeWMVl1w4vtUFevQaRUshuNgAtqtBv6lyVHKniqli1XXMTqfO9X8i27TdxHaeTc BvsWi7HS3QE+ljynuD4MxdMbKm2o6EnQNaAG/GmOgxPz0NpB+TyD4KYrlZesLo03YkIiXES0e56 weE+qFZiz11pvts9TVx+Wfvu5mFBPOzS6yrqpPY/92PwB7n27wVruAdhnnPlDShpOYEEeALW9wT ZkEPb0DI18/YvUz3zTOQwJYD6OtTXERm5EEZ4xtgPfbfOiwXv0kKNFUNABEIOwmXCdfPOWFz98L Teq2TS8IIZShlsyfL8A== X-Proofpoint-GUID: nmL3D3lzgVoYKvhn4g7H62FXJMOB2gdn X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-15_04,2026-09-15_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 bulkscore=0 impostorscore=0 malwarescore=0 phishscore=0 suspectscore=0 clxscore=1015 spamscore=0 lowpriorityscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609150240 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=brian.cain@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, 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: 1789489940462158500 Reviewed-by: Pierrick Bouvier Signed-off-by: Brian Cain --- tests/tcg/hexagon/misc.c | 44 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/tests/tcg/hexagon/misc.c b/tests/tcg/hexagon/misc.c index ca22bb79f7b..c07547b6f68 100644 --- a/tests/tcg/hexagon/misc.c +++ b/tests/tcg/hexagon/misc.c @@ -404,6 +404,48 @@ void test_dpmpyss_rnd_s0(void) check32(dpmpyss_rnd_s0(0x7fffffff, 0x7fffffff), 0x3fffffff); } =20 +static uint8_t storeimm_byte_array[16]; +static uint16_t storeimm_half_array[16]; +static uint32_t storeimm_word_array[16]; + +/* + * Unconditional store-immediate instructions (S4_storeir*_io). + * The predicated forms are tested above; these exercise the base encoding + * with positive and negative #S8 immediate values. + */ +static void check_store_imm(void) +{ + /* memb(Rs+#u6:0) =3D #S8 */ + memset(storeimm_byte_array, 0, sizeof(storeimm_byte_array)); + asm volatile("memb(%[ptr] + #0) =3D #0x12\n\t" + : : [ptr] "r"(storeimm_byte_array) : "memory"); + check32(storeimm_byte_array[0], 0x12); + + asm volatile("memb(%[ptr] + #3) =3D #-1\n\t" + : : [ptr] "r"(storeimm_byte_array) : "memory"); + check32(storeimm_byte_array[3], 0xff); + + /* memh(Rs+#u6:1) =3D #S8 */ + memset(storeimm_half_array, 0, sizeof(storeimm_half_array)); + asm volatile("memh(%[ptr] + #0) =3D #0x34\n\t" + : : [ptr] "r"(storeimm_half_array) : "memory"); + check32(storeimm_half_array[0], 0x34); + + asm volatile("memh(%[ptr] + #4) =3D #-1\n\t" + : : [ptr] "r"(storeimm_half_array) : "memory"); + check32(storeimm_half_array[2], 0xffff); + + /* memw(Rs+#u6:2) =3D #S8 */ + memset(storeimm_word_array, 0, sizeof(storeimm_word_array)); + asm volatile("memw(%[ptr] + #0) =3D #0x56\n\t" + : : [ptr] "r"(storeimm_word_array) : "memory"); + check32(storeimm_word_array[0], 0x56); + + asm volatile("memw(%[ptr] + #8) =3D #-1\n\t" + : : [ptr] "r"(storeimm_word_array) : "memory"); + check32(storeimm_word_array[2], 0xffffffff); +} + int main() { int32_t res; @@ -547,6 +589,8 @@ int main() =20 test_dpmpyss_rnd_s0(); =20 + check_store_imm(); + puts(err ? "FAIL" : "PASS"); return err; } --=20 2.34.1 From nobody Sat Sep 26 20:01:26 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=1789489954; cv=none; d=zohomail.com; s=zohoarc; b=Ie4f7TVV9uDbjLZhXiXNeQxcdbTs5FPb6dbcQbH/+s2y6COrHBsDe9Llz+tEiKQHZvLWPK5BFPtRWvcHGaXmn/GQMwbruAOEFk4wO3uKq2VelGiLsdztcS0LhQIrvwRClCrFskb5eIIIWHoK5SYly5y+z+NkXRTtxwxBC49DJHY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789489954; h=Content-Type: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=rBXlxaNGAMkAydJ5ombBnoAHAkAmT2hhBvrVhestqV4=; b=Tb8zlPyod+3sEPWDwWehLkteSHmlbEnNkBjGOoLydgb26J3+qb0zo1+GIQpStQyfxUVpAARdSFqtuImqqJjFi6mkzZqavivCh5fTNM1hTd+YCSZiKAzaQaPoqxsgv81/DDG0RJ8GXxdFZmjw7mg9OSOxwnMzNhTNZgrfuptA674= 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 1789489954524168.43687769526002; Tue, 15 Sep 2026 09:32:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x6W4L-00062M-RB; Tue, 15 Sep 2026 12:31:41 -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 1x6W4A-0005zg-Lq for qemu-devel@nongnu.org; Tue, 15 Sep 2026 12:31:32 -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 1x6W48-0003rq-Po for qemu-devel@nongnu.org; Tue, 15 Sep 2026 12:31:30 -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 68FFAc5h813981 for ; Tue, 15 Sep 2026 16:31:27 GMT Received: from mail-pj1-f70.google.com (mail-pj1-f70.google.com [209.85.216.70]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4gq6kc174s-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 15 Sep 2026 16:31:26 +0000 (GMT) Received: by mail-pj1-f70.google.com with SMTP id 98e67ed59e1d1-38e8fee6af3so3391401a91.1 for ; Tue, 15 Sep 2026 09:31:26 -0700 (PDT) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-39dfdd0baaasm6068590a91.9.2026.09.15.09.31.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Sep 2026 09:31:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= rBXlxaNGAMkAydJ5ombBnoAHAkAmT2hhBvrVhestqV4=; b=UOuMmC/AY8Km/Wne rrhtZJdENrXPN+YgUObpj4R8HZvM2XAFz66j5lKFA8K1HYaNKRAIFCkiK/JqloyT i8usDOcNxNi+7K11TePZNMzq4vxNtxzh/H8uC0TkCJ0/+C0shigPaHI0dNMSPLmM PmEZfEKVdbl2wkfEPJ4UlrrBBFZTC35oP7RaJ7rLZDic0xiU+YhSPdXrf9FsbxCI XhV3Vfg3kIKf5Mzc/iK7lllvjoH0jUMAS8yK9nKwzVJIYxtSEcfHCeCT8HmFb+dT 9ithU6Jbes+zuqF0m5sg9Gfgtn7pZ2RYM2B5EvuWYPB79tfMFOOUPeaXGvYTJsG4 oQUfHA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1789489886; x=1790094686; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=rBXlxaNGAMkAydJ5ombBnoAHAkAmT2hhBvrVhestqV4=; b=hNSFwO65cBgV1FDeD9kUT/ViTkTAIBzmTosVsNn0mHWj91SPs4vFtBHq2vm+ScCrNo aaA6PjnsNwUkov94DEJ1jukpZ6CuxHgrUDb1pGrFMCEaxohu5wNZzu1fzVip+4lYTnBt 4FNv+TR3OTSRu6DAwvxMgj/xyByGRgATzUZlru7SgL/E3NRUMdvkhfhWxPDKTkACuRV8 5vhTGJKRrhyTwQ2uxBnzy51Owg67EOdDW4J3LTrJlLqbhJXi92nWw0aE0eUKHk23XMAI H+Z86tIYsLhtsfNBz6N9YGnWIdsmBOB5hRofyF/nAVMAhZBsVOdcAKOir/sMQJmI4Uz2 CxSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789489886; x=1790094686; h=content-transfer-encoding:content-type: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 :content-type; bh=rBXlxaNGAMkAydJ5ombBnoAHAkAmT2hhBvrVhestqV4=; b=AHcwTqL1jVbX5ATuxKkEkadbFH9oWH3xoyAR7XNYqs6hSof1kDIYhT5Yl5SmnysKwU htQa5tM+VT6ZmFj0QcLK0R5tEUvLtW8gTxble7qSFzLrJJWW+u+pcm1K3NUmAgFRQ6g/ SQJF3KY5QIM4Db39mEnTPZcGecnObM255ryJJWXlaK4CzzgWHW7ftYmu/BEb+olGEIso 7o1f7NFb34UP31xL7tDJydmNJTpTAKTk5cRm/05sAFCJKBgjX2ZwTwW6CRwc/KNOoLij zwkk85ayNcF7MGS650WpA1EkuZhqjYUK7BGB2JKWQQn7IJqGCyxu6qK3Q1O7G4AwKY6n PuIA== X-Gm-Message-State: AFuF++kehbFpv8bYxc0ivk0sfhnXSKyQPyYaS3Y4egUfPoGEKZLh9OUC lGYrjLFYW5cpjd4KBJzGowwVsbB5XGdafcfA4jmaACQ8sygfijgQ7YfKd82ckGMIMyRPAhpGfgv fcGPdlRugpUz4UErKfiVDBCR4TWWHr4BNfXUNftOhKHmUiBXuLRocrsVWExTigTytCA== X-Gm-Gg: AYBFou120iK2waSyHok/lO+vJ2NhSXF5sX59HxHVV8KA9TgG2ewCBbQKmKSVuVDHWTH N8TU9ItGuIu0So03qT5C6MaJl7d14elkI4kwE8TFDrl/Yg4c3a2sBjZ4PMjWqRsKJrYuO2mhR4r rZ412Dz+GhS9fTTlLEbWR3xMTGAifDC7eATAhi0NF7Jmw5paOD78zFptNOB2wM4UcovzO3XVp8j 6DYJssg3oOH+zk+FnZ2z/NACaafuNKnyjSJstrtraPfiPkgXCkQkZzZhJBRwmB4o6/L8jeVZgPD D/JMvE8d8FKFDewZZds5I+qpzese3+3+3zZsn+PSaaeUmy8PNmX1gbbwyYeygNQrMgtzrNstMU/ 7j8xTY3dMu728dUk2iZl4mJHfQiMCCUfzzqb7kXpgp9PUWgyp X-Received: by 2002:a17:90b:1d52:b0:39d:f189:48d6 with SMTP id 98e67ed59e1d1-39e10c45f67mr3364541a91.4.1789489885835; Tue, 15 Sep 2026 09:31:25 -0700 (PDT) X-Received: by 2002:a17:90b:1d52:b0:39d:f189:48d6 with SMTP id 98e67ed59e1d1-39e10c45f67mr3364478a91.4.1789489885379; Tue, 15 Sep 2026 09:31:25 -0700 (PDT) From: Brian Cain To: qemu-devel@nongnu.org Cc: sid.manning@oss.qualcomm.com, Pierrick Bouvier , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Brian Cain Subject: [PATCH v2 14/17] tests/tcg/hexagon: add predicate register transfer test Date: Tue, 15 Sep 2026 09:30:44 -0700 Message-Id: <20260915163047.4180600-15-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260915163047.4180600-1-brian.cain@oss.qualcomm.com> References: <20260915163047.4180600-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Info: AW1haW4tMjYwOTE1MDIzOSBTYWx0ZWRfX1jzuZKv1onp0 Vz8QwPDQY8xAvUriDP033e555U5jTJMGGLSABp9c6oOtF90owr4I4ltnaWmMYOjuRNIhuh78+EK YmcXy1HQwRPcqcmFF+e0mkqgYWpIyqw= X-Proofpoint-GUID: CgQ3rXH3-sjxun5yJTP_D12WWYD3XwtI X-Authority-Analysis: v=2.4 cv=ZINCCn7b c=1 sm=1 tr=0 ts=6aa972de cx=c_pps a=0uOsjrqzRL749jD1oC5vDA==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=Um2Pa8k9VHT-vaBCBUpS:22 a=EUspDBNiAAAA:8 a=yBA84NwwydepxRIuKt4A:9 a=QEXdDO2ut3YA:10 a=mQ_c8vxmzFEMiUWkPHU9:22 X-Proofpoint-ORIG-GUID: CgQ3rXH3-sjxun5yJTP_D12WWYD3XwtI X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTE1MDIzOSBTYWx0ZWRfX/iGNNK0CEjcV bVl+fBzoRu2UYj9wgejQuhnscva2QJge4Rx+AyrnyxexKIb2+FBkmQ8NHKkYF/j3k3pDdg+7jOD Lw150AuP07+JgvZFXtPKZZ5tk5op2O4pAw8WsmylKq3PKNE+oJ9411WxmWZu8g50vmdpAT48FHD kQPGt0+lRtGPudbx+GDdNNVkVoTaFd/bSr/DOxAIiB8H3moBd40zDBaMEA8GOWo8vj5/r6uqE2g vsqlknzaFIo/lfIs8lTSguysPvreazFaaEbqlf8BrgY7fKewpbwktsaQWVr/JhUb2bweHvE0BFA 5ekAk/TkQNt/Q55VIUAkLC+G0Qquwjh27IPug4JE91N6DdEMf3PZ5L4f6f0g+O3FysEtH4Ltrby IIGdghQ7czoprmgCIFR2PAtkF5cfoddQr+Clw1bLaxJYm+WoqyJTosg1ov9l154NRruJrDuFivP 4t/nNKeILf3txUcOe1Q== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-15_04,2026-09-15_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 bulkscore=0 phishscore=0 priorityscore=1501 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609150239 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=brian.cain@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, 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: 1789489956716158500 Reviewed-by: Pierrick Bouvier Signed-off-by: Brian Cain --- tests/tcg/hexagon/misc.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/tcg/hexagon/misc.c b/tests/tcg/hexagon/misc.c index c07547b6f68..abb34ab6a65 100644 --- a/tests/tcg/hexagon/misc.c +++ b/tests/tcg/hexagon/misc.c @@ -446,6 +446,31 @@ static void check_store_imm(void) check32(storeimm_word_array[2], 0xffffffff); } =20 +/* + * Rd =3D Ps -- transfer predicate register to general register. + * The result is 0x00 or 0xff depending on the predicate value. + */ +static void check_preg_transfer(void) +{ + uint32_t result; + + /* Set p0 =3D true, then Rd =3D p0 should give 0xff */ + asm volatile("p0 =3D cmp.eq(%[val], %[val])\n\t" + "%[res] =3D p0\n\t" + : [res] "=3Dr"(result) + : [val] "r"(1) + : "p0"); + check32(result, 0xff); + + /* Set p0 =3D false, then Rd =3D p0 should give 0x00 */ + asm volatile("p0 =3D cmp.eq(%[a], %[b])\n\t" + "%[res] =3D p0\n\t" + : [res] "=3Dr"(result) + : [a] "r"(1), [b] "r"(2) + : "p0"); + check32(result, 0x00); +} + int main() { int32_t res; @@ -590,6 +615,7 @@ int main() test_dpmpyss_rnd_s0(); =20 check_store_imm(); + check_preg_transfer(); =20 puts(err ? "FAIL" : "PASS"); return err; --=20 2.34.1 From nobody Sat Sep 26 20:01:26 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=1789489995; cv=none; d=zohomail.com; s=zohoarc; b=e0+TGagtw431waOjiGk9HeOfbONoAjJUFC2SyyujySKsUcYXUx33cpZzKgSzWC5PEYWcgH6LOu+4QHu+yvp0LKMRnGyhd6kdTHMwOKjWk9B/Fka+L3oinwmbOHJpFzXVLfxbZMV1kCAYwlJaV6ODFUSSF4DOmlbiP1fraWaZoLM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789489995; h=Content-Type: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=eoZnPMfgh/uoiNhVRO9ZE3BANiXO18FNesirNIySkCQ=; b=dim+TlT0fJ0KzRW7Zo2IHAIkw3B9baYFokh8YJ4D2ZOYmwyOOXH3gT+2vdWcAdK4W7t4pV3kWpdjSGvgIHJ1EYKklwzGNxSYRjKMwxvIpP/XeVyS5JhU+kzCeLk3kyKbDIsm+RItKz8PiVSwI6QDN5jBlhCcRm4APzWu0i7AnbY= 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 1789489995451285.6304543773598; Tue, 15 Sep 2026 09:33:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x6W4X-0006IO-VA; Tue, 15 Sep 2026 12:31:54 -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 1x6W4O-00063P-MI for qemu-devel@nongnu.org; Tue, 15 Sep 2026 12:31:44 -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 1x6W4L-0003sT-GV for qemu-devel@nongnu.org; Tue, 15 Sep 2026 12:31:43 -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 68FFATw24176138 for ; Tue, 15 Sep 2026 16:31:28 GMT Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4gq3hc2dmx-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 15 Sep 2026 16:31:28 +0000 (GMT) Received: by mail-pj1-f69.google.com with SMTP id 98e67ed59e1d1-38f283baf1fso5356249a91.3 for ; Tue, 15 Sep 2026 09:31:28 -0700 (PDT) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-39dfdd0baaasm6068590a91.9.2026.09.15.09.31.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Sep 2026 09:31:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= eoZnPMfgh/uoiNhVRO9ZE3BANiXO18FNesirNIySkCQ=; b=Kynie+Ol9p7BKuqp zMNu6DLKXwXZMJxRJ2is6eYufS5Qny+NeqQ+0ZA1rDnrLdJb1UtmpiNx1lCwaUZP sIDNoqw5AOtStO8hpxkIyfTV5oXEZDZy+RWBQw7ljSyxmciiEEYg9+yWvvPLLTSA 93Rc69bVj3mXfLd38C0IM/8TY8CqS2mBA35DwwC5pCmLzFuWsxtMsSc97niZNNpi m5EedLq8Z1TjDcb5rLQAHylL39uojaz1zk5NWdHyGRb9jNwOEJLqfD6N3NzemPMz cExOa6E8KkQLrUX7mbtJszztcn5qFzxgGgt2cl5Y830HSookFVAzFI17Y+uvp8/R BvGahg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1789489888; x=1790094688; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=eoZnPMfgh/uoiNhVRO9ZE3BANiXO18FNesirNIySkCQ=; b=SKphvLBAiD/EzP5nEF3FeOIeVoPPiVJanhG0QEPiCLk/FrNg4lsNzq+VvIDsho71g7 pgTFVKllu2g7kAk5HHpqYx4yjc9su6QEbxwcYatzvt2MCy0dH6v+t4r35KtYPVi75zFa 30N2MZIqnLgZUu9yuiQ9aRp/osdHbxcPWCIJ7VXv9YcfESoAt6g9tFiPEYKOWZ4S9ch5 Vka6EizEui/eBhqAYwz9F6fVAd2JoUrnkH8bVWYID2dmQ1MM1HUJpJ0OK50ze0XvW+iR brWXjHMNOMIG31+pM1SHhie3HOrsgWlZCY+8QMCQutS3MBWl0XGS4TRHaeAC5haWCWWz bQtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789489888; x=1790094688; h=content-transfer-encoding:content-type: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 :content-type; bh=eoZnPMfgh/uoiNhVRO9ZE3BANiXO18FNesirNIySkCQ=; b=hOagAy9Wi+zpH0owsQdy8pcX8PemCMsb1OPXbogxzX9aEzETmBzsteBo2dt2ye+jWn pzeTIhZEGtCNx/WfxylWu0tx/azqspm+aTFf0ou0aFBBMheZvr7uMpyFhsBHL769lM+m Ykwogmaf36Hvv0SLvDeAUgrjea+cvAzuUGnupWYsnVZ6JAcv1WTJnHuj5n4jwJDfepSy RNaejcPd/e/20icX0Ql/Nm9xxj0+subqjHmrCIr+Z6k2Ul6+3BHE/jB0LokYrbi9NmEy yp0ItGCdToV66Nrxxuxjbt1lFn1VZm/q36kFXQa7++WUj9eR+8XZC+0mcrj+eRjRjqmy uwQg== X-Gm-Message-State: AFuF++mS903buuC//oEjfQOwRHjPpLT4F/89nxbg1EI3kqjDiTRrIx8R WKU2wWl/rv+VR3exRxhIARCP4+CCoRRkyqRrw9MbR3OQzW9Dgcs3sQF7R1vG8hpHW6Z1I2xMTyu DKZue4M++ZG5c+/GnGkOlYjPDyPx9V5ZbEdqwzCnZPHr/V/d74oCc6w9aU5V8D8yMDg== X-Gm-Gg: AYBFou0lqBorA5xS6RU9L7/vrxz69B/ykEKuXnBpl5bi5kBB1eIZfRf/i+jthb9Zte+ Gnn39qqKPVY9Dth1f1/BQbU89GMJkKEnCn1udl5IA4v6GmkV+uvbcEG0wF/POxGRENf0/iW6+oc bDP/jsAaxYFPwRmG41St3jNz+bwRxF8s41aG82EZ3svSg97VN+SoT8t/AvSEphuxUHIejt9jC2h d1JzXy8bYdWhwmgRaHCI89oOBRsYsjt575DlXmjEMmBI+ZPHvL8PLUVxvS7euq1KOn8a3m8okUS ZVZFYSxyAaXtWYwD/K8zt6EQyOujv7gybME8MuDKHmfPw6rVttO+LcWyfVJ4648lT+bKRrZ3xZ5 qCEDRa45DXZiWFN3sPoI1FrozDm4vGrqaW7RiaRPF79tEdGPM X-Received: by 2002:a17:90b:3f0d:b0:399:1f8b:d255 with SMTP id 98e67ed59e1d1-39e10c8a755mr3191187a91.5.1789489887420; Tue, 15 Sep 2026 09:31:27 -0700 (PDT) X-Received: by 2002:a17:90b:3f0d:b0:399:1f8b:d255 with SMTP id 98e67ed59e1d1-39e10c8a755mr3191111a91.5.1789489886797; Tue, 15 Sep 2026 09:31:26 -0700 (PDT) From: Brian Cain To: qemu-devel@nongnu.org Cc: sid.manning@oss.qualcomm.com, Pierrick Bouvier , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Brian Cain Subject: [PATCH v2 15/17] tests/tcg/hexagon: add rounding conv, sffma:lib, and sfinvsqrta Date: Tue, 15 Sep 2026 09:30:45 -0700 Message-Id: <20260915163047.4180600-16-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260915163047.4180600-1-brian.cain@oss.qualcomm.com> References: <20260915163047.4180600-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: AIff18gLGnp3doVwR4u6erFSYuYoqGn7 X-Proofpoint-Spam-Info: AW1haW4tMjYwOTE1MDI0MCBTYWx0ZWRfX75ZWe2rgbEhf 88R2ZxNgCHVB0H5YGdh+Z0iIE+fp7xJk0cVIzkmoN/sNLYIlHqKN4k+Tq3ZZWWyKmTo3eOthV8m 7V73Z6xQDvWjqikMv5Wr6RPIxtHMRVY= X-Authority-Analysis: v=2.4 cv=dcUVTnXe c=1 sm=1 tr=0 ts=6aa972e0 cx=c_pps a=vVfyC5vLCtgYJKYeQD43oA==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yOCtJkima9RkubShWh1s:22 a=EUspDBNiAAAA:8 a=Yw4lSlXxLJphHwZ-g9MA:9 a=QEXdDO2ut3YA:10 a=rl5im9kqc5Lf4LNbBjHf:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTE1MDI0MCBTYWx0ZWRfX4iZhXxOUaI3o p4efysjvtDgusxX2Y+9PtutM6ZDvBvLb1yscLJcSSUxye75uwov9SM3YB8Muh/Vv7Tf1QyHUjee VkRLCiu6pLUFpmsAc5VdzxJ1gFiWp3Kv5R9Cwu/mXSsV84BgCgkWzcBbedSS3p5B5k7zZ85e+Bs bL/X7O7SUa0mHjoMOYUu3alLvsURKlhN4dP9tvIYi1MkZtLIKtrc5gGCieyDFYFvt917uPY0Ewi wkDkVsNyWaLDJdQcKoUECB/yM5forEKOeHCNBVdaFksPCG560+oMEt4/qHwDTnZmQ+Uk771bvjz M7j4tpXF7Oziq5vxK/IOlnlwrzCzPgPGvYnTPb8zrK4YoW/6St9PzHmoHWqhvnHqbF6mMxtgHiw 23vTijmNMvquwbEC6CobqfdlLDHwTLVL9KtwbYNQq1kmwj/Uic5/fV4tkSRdVxx17HJ3G5cWytG bpkH4SLaGzrJs3MPISQ== X-Proofpoint-GUID: AIff18gLGnp3doVwR4u6erFSYuYoqGn7 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-15_04,2026-09-15_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 bulkscore=0 impostorscore=0 malwarescore=0 phishscore=0 suspectscore=0 clxscore=1015 spamscore=0 lowpriorityscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609150240 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=brian.cain@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, 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: 1789489996961158500 Add round-to-nearest float-to-int conversion tests for the non-:chop varian= ts, sfmpy:lib with Inf-Inf to verify exception suppression, and sfinvsqrta with a denormal input. Reviewed-by: Pierrick Bouvier Signed-off-by: Brian Cain --- tests/tcg/hexagon/fpstuff.c | 99 +++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) diff --git a/tests/tcg/hexagon/fpstuff.c b/tests/tcg/hexagon/fpstuff.c index 0f28a218d84..9ea79c617d9 100644 --- a/tests/tcg/hexagon/fpstuff.c +++ b/tests/tcg/hexagon/fpstuff.c @@ -1017,6 +1017,102 @@ static void check_dfmpyhh(void) check64_ne(df_exp(result), 0x7FF0000000000000ULL); } =20 +/* + * Round-to-nearest float-to-int conversions with normal values. + * These test the non-:chop variants which use the USR rounding mode. + */ +static void check_conv_rnd(void) +{ + uint32_t res32; + uint64_t res64; + + /* convert_sf2w(1.5) rounds to nearest-even =3D 2 */ + asm(CLEAR_FPSTATUS + "%[res] =3D convert_sf2w(%[val])\n\t" + : [res] "=3Dr"(res32) + : [val] "r"(0x3fc00000) /* 1.5f */ + : "r2", "usr"); + check32(res32, 2); + + /* convert_sf2d(1.5) =3D 2 */ + asm(CLEAR_FPSTATUS + "%[res] =3D convert_sf2d(%[val])\n\t" + : [res] "=3Dr"(res64) + : [val] "r"(0x3fc00000) /* 1.5f */ + : "r2", "usr"); + check64(res64, 2ULL); + + /* convert_df2w(1.5) =3D 2 */ + asm(CLEAR_FPSTATUS + "%[res] =3D convert_df2w(%[val])\n\t" + : [res] "=3Dr"(res32) + : [val] "r"(0x3FF8000000000000ULL) /* 1.5 */ + : "r2", "usr"); + check32(res32, 2); + + /* convert_df2d(1.5) =3D 2 */ + asm(CLEAR_FPSTATUS + "%[res] =3D convert_df2d(%[val])\n\t" + : [res] "=3Dr"(res64) + : [val] "r"(0x3FF8000000000000ULL) /* 1.5 */ + : "r2", "usr"); + check64(res64, 2ULL); +} + +/* + * Test sfmpy:lib with Inf-Inf. + * + * Rx +=3D sfmpy(Rs, Rt):lib with Rx =3D -Inf, Rs*Rt -> +Inf + * Inf - Inf is invalid, but the :lib variant suppresses the + * exception and returns zero. + */ +static void check_sffma_lib_inf(void) +{ + uint32_t result; + + /* +Inf +=3D sfmpy(+Inf, 1.0):lib -> Inf (no exception, normal) */ + result =3D SF_INF; + asm(CLEAR_FPSTATUS + "%[res] +=3D sfmpy(%[a], %[b]):lib\n\t" + : [res] "+r"(result) + : [a] "r"(SF_INF), [b] "r"(SF_one) + : "r2", "usr"); + check32(result, SF_INF); + + /* + * -Inf +=3D sfmpy(+Inf, 1.0):lib -> Inf - Inf =3D invalid + * The :lib variant should return zero for Inf - Inf. + */ + result =3D SF_INF | (1u << 31); /* -Inf */ + asm(CLEAR_FPSTATUS + "%[res] +=3D sfmpy(%[a], %[b]):lib\n\t" + : [res] "+r"(result) + : [a] "r"(SF_INF), [b] "r"(SF_one) + : "r2", "usr"); + check32(result, 0); +} + +/* + * Test sfinvsqrta with a denormal input. + */ +static void check_invsqrta_denorm(void) +{ + uint32_t result; + uint32_t predval; + uint32_t exp_bits; + + /* Denormal positive float: 0x00400000 (small denorm) */ + asm volatile("%[res],p0 =3D sfinvsqrta(%[val])\n\t" + "%[pred] =3D p0\n\t" + : [res] "=3Dr"(result), [pred] "=3Dr"(predval) + : [val] "r"(SF_denorm) + : "p0"); + /* Result should be a valid float (not NaN/zero) */ + check32_ne(result, 0); + exp_bits =3D (result >> 23) & 0xff; + check32_ne(exp_bits, 0xff); /* not Inf/NaN */ +} + int main() { check_compare_exception(); @@ -1038,6 +1134,9 @@ int main() check_conv_ud2df(); check_dfmpyfix(); check_dfmpyhh(); + check_conv_rnd(); + check_sffma_lib_inf(); + check_invsqrta_denorm(); =20 puts(err ? "FAIL" : "PASS"); return err ? 1 : 0; --=20 2.34.1 From nobody Sat Sep 26 20:01:26 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=1789489993; cv=none; d=zohomail.com; s=zohoarc; b=MlXOqXuynYbqtWVQ7GiANpHLs4LLmUN3cKhdeJI4Z6lKO1k2BOHUoXVgaXYgKrHwVZuNcXEhKb8HI/iwgKpJQDxTYqg5BXQ5JBWjNFUzD58jMmS8N+y8UcsOvrC4ByPY6VX1qEOodESBtcn3N0/NDGFwY7MkkwIM1OPWwdfUz8I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789489993; h=Content-Type: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=hRpOAAmPkxRy8tVUpIWqs9FFG5bf3DWD2jGR8TiQ8p8=; b=JdCalH+iacBN33sN6Ea80csrPr9GROsV0RfpvvicTo0h47v77cS8xFyw9OyLQVwp8h0z+11zWMrGK35uu2zyDknc7FoBrnBkpE7+pZ/lYY3+9jxN8PFigC1C1IPjSbNmRN5W8fj3X7lgHODnHF6GJAxImklaol1h8tGk3uSn+l4= 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 1789489993463175.90484151557507; Tue, 15 Sep 2026 09:33:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x6W4W-0006GN-PU; Tue, 15 Sep 2026 12:31:52 -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 1x6W4C-0005zp-Os for qemu-devel@nongnu.org; Tue, 15 Sep 2026 12:31:33 -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 1x6W4B-0003sQ-23 for qemu-devel@nongnu.org; Tue, 15 Sep 2026 12:31:32 -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 68FFAdmK2836562 for ; Tue, 15 Sep 2026 16:31:29 GMT Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4gq1qpayp4-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 15 Sep 2026 16:31:29 +0000 (GMT) Received: by mail-pj1-f71.google.com with SMTP id 98e67ed59e1d1-39deb05ef51so3097504a91.3 for ; Tue, 15 Sep 2026 09:31:29 -0700 (PDT) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-39dfdd0baaasm6068590a91.9.2026.09.15.09.31.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Sep 2026 09:31:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= hRpOAAmPkxRy8tVUpIWqs9FFG5bf3DWD2jGR8TiQ8p8=; b=e9xj/Ah6Se5+n3sb kGx1CdQCF1yvQsuN32g8JpafkyZCu3hCdLrAjBlG87PCxVReRlJbIMU8PTF1uTOu h3VDMaX3p/2agMaP6BKGlitoqNtPduQoTz8CqBsjegnLGeYmh6BqPYil5ipSLLyM p+enUieOYWiWmJsyDfmoddrOljYbyAX3GtnRmIJN/va2sKdF4uzXwpnocpgmOYgC 4KGeeiiXelcW+pzYQsGNoCkZTFhd6Xvc91QF4mbMk5bbhuDdgT144YmzKd6ECB2D jv9mI2z8QLxOMrGnXJ/WI1ixUTPvxVUUWkH0Kaht69QThR3A5jDFOPry8X+33J5c c2wJdQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1789489889; x=1790094689; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=hRpOAAmPkxRy8tVUpIWqs9FFG5bf3DWD2jGR8TiQ8p8=; b=J9tjpL4xKvxfGJxtKTB1Bb9pONlAF5pUv/wakHJhRJEMF/yo/ky+67jeZGpvpnhrJa YTFWH2J+puL+3ROOeGL2Dpo6Pn2xvwMs52By6E2lL/gVUxYprxG8zvAFnYlC7SFolIGb 8uoWfHMqX3ofWGh3ub81zM01eYgHgXZhGjxJsdV99QV/K97q/VkWi+6V+Qc/T7+/6I/O 0ivHhSFaI2APIZUDRjnKix0wA2EWgA8TrufSa2nRPBqfHeWMKz3Kf7ylMMkT1wL0YPMh 7sB/9uhkuan1Vs+Ydgw2IawNCqXVQsa+Nthkr6pE+8tX9IiTozOwqMC7s9pqDvRtT4zM nEdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789489889; x=1790094689; h=content-transfer-encoding:content-type: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 :content-type; bh=hRpOAAmPkxRy8tVUpIWqs9FFG5bf3DWD2jGR8TiQ8p8=; b=eKxouQwpEm/ziEmnEA9pOUwQip4AMfyQPh5kIHDr+i2Wx8W//OeD5cjFBwIa4ImoZd /7ip2ogPFUgTwY9IMMFj+nAhzPjYbo9CtGUnMZNgIMiF1RYhjDbXp904PR8rnRsYXg9g r4S802RDRZuHKU4sD1RAnw+9cQ35CWA/BmOXQiaooa4l5EfXm+UAeV5hvx3CJFQJ2CCi TJcLhQtx6PQHioUBOOVE6yXn9C0JKRwl1BJ5zXRi/OOdzGcZTAjSv1DemMcr/yVaYIHA lXlHkJ/IOH5VGwXcSVCA8PA9HF9mqunVvlzJBA5ztuO10hKYOCLrGiZZogusgmEa7E90 c2RQ== X-Gm-Message-State: AFuF++nTVvnGp0Z0d5/ipPIFbessBoCbUXMO7Zvg2owUjbHxMH6p8JZ6 mctU4yLoohXhFDseiieyzGdyILWtCPRr90p57c4RGDPhQUlesW2SKCIfT1ABbGBzraNwCnugUGL /5FsB4K8RUIDKjrEipfH5X8KsnTmmhHV+JCniJcowadTvuRrGEs8MoJwL/T+A2sUXlg== X-Gm-Gg: AYBFou23j1JUqpQDzTkV8qyplacif69hARN3pRNtZkA/0P92QpRQPeHt0hhVe3l1SsA r1nNuwuKiGCuffez/9r0qsnnAhDWPdhrDU8PJo/MHhncxBGIKZYB0zihtvh9rWi4xzSy0S46V4N 5fekRK5OWd5UiXU9P8f7PFt3j3UrQOf1ctNZcjmgMVt3JB2e3GXznODZo8ZUnLP0HvXn4Bln7tU zuRoKaDyXvrCa/3iMWKrtbnCl7dZSF3XP3ECTCZ/MRp+4ntBc83wC6B0Z0r7WYYYJb/BA5gmT8A cRB3Wrwt1F3UTG+zlVap+OnT3no0r2Yp7bkhBg1YZ0wgBqzis6+0OW/Y7j2Mg0WPumPBJoE/4ti 7zwMiwCqeMkMT/Bshw0/tB8UExs22C8OaaUCFPmDDGO3ixFKp X-Received: by 2002:a17:90a:f16:b0:39e:b7:cbe8 with SMTP id 98e67ed59e1d1-39e00b7d278mr6649075a91.5.1789489888834; Tue, 15 Sep 2026 09:31:28 -0700 (PDT) X-Received: by 2002:a17:90a:f16:b0:39e:b7:cbe8 with SMTP id 98e67ed59e1d1-39e00b7d278mr6648996a91.5.1789489888317; Tue, 15 Sep 2026 09:31:28 -0700 (PDT) From: Brian Cain To: qemu-devel@nongnu.org Cc: sid.manning@oss.qualcomm.com, Pierrick Bouvier , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Brian Cain Subject: [PATCH v2 16/17] tests/tcg/hexagon: add scalar+HVX and masked store tests Date: Tue, 15 Sep 2026 09:30:46 -0700 Message-Id: <20260915163047.4180600-17-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260915163047.4180600-1-brian.cain@oss.qualcomm.com> References: <20260915163047.4180600-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Info: AW1haW4tMjYwOTE1MDIzOSBTYWx0ZWRfX+bB/ms1oSRIS LiSi7W+bivyBJwfIGv167UjCmK/n1yBWdchLtARGSWBxrd7Jxx8ZLvmTlnAKcpeR96NaoGX9hEQ yr6vPaLw6EduZYp1ZK8ZbbkjRcXy3Xk= X-Authority-Analysis: v=2.4 cv=I4Xw19gg c=1 sm=1 tr=0 ts=6aa972e1 cx=c_pps a=UNFcQwm+pnOIJct1K4W+Mw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=DJpcGTmdVt4CTyJn9g5Z:22 a=EUspDBNiAAAA:8 a=ZgKQQoYZz-FTevMfDfAA:9 a=QEXdDO2ut3YA:10 a=uKXjsCUrEbL0IQVhDsJ9:22 X-Proofpoint-ORIG-GUID: XpOknXGNity_0mQV1uYTIpWpycNTTii1 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTE1MDIzOSBTYWx0ZWRfXz6fBFPmunon1 PEF2PC/DDLJzO923dHpn6/11DDmu2DCK7HMaRUQzn2B1yy0bouB3vrHe0XYOxlAyS//tm35Gxnp 8NxPKbKifu1J+KL5QTwmkBqqFpdpZNXthLkl1B//nM6R4UKIS9WPWK7AnLdkkn2NIHCdiw9UG/o o/1HRhmzZz20PMzg6YGrFOQrHIsTJnzP4+msfEjnHFKcm/UYHhH4ijrsp0+Xc0HbbtJDkUm98on L+CKPBe6A9G/M0+22F320/o7oZoedC/gWFmwQu34UFKFYz0OgS0fY4NpSIdDmggCtKA64eI0mye aCu6RrKDwXzDJ3BD/m3aD54Iey+LwMEj0+NLzeGb2Q2rGpxQizMi5saLFKb8sIkrpbKK0EmBgZd h72YdOJl4PjB7ItvrfVelBOeVkiJ5Q5sVaFImIKsNirDe8Vf6V6g2hFBfrrsiuiO+Un1iTejuCD NQBecaBh3rEjZmodd1A== X-Proofpoint-GUID: XpOknXGNity_0mQV1uYTIpWpycNTTii1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-15_04,2026-09-15_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 suspectscore=0 phishscore=0 clxscore=1015 priorityscore=1501 bulkscore=0 malwarescore=0 impostorscore=0 adultscore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609150239 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=brian.cain@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, 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: 1789489994845158500 Test a packet with both a scalar store and an HVX store, and test a non-inverted masked store (if (q0) vmem) to verify the invert=3Dfalse path in masked store generation. Reviewed-by: Pierrick Bouvier Signed-off-by: Brian Cain --- tests/tcg/hexagon/hvx_misc.c | 66 ++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/tests/tcg/hexagon/hvx_misc.c b/tests/tcg/hexagon/hvx_misc.c index f20afc8e670..0285886c2a5 100644 --- a/tests/tcg/hexagon/hvx_misc.c +++ b/tests/tcg/hexagon/hvx_misc.c @@ -566,6 +566,69 @@ void test_store_new() check_output_w(__LINE__, 1); } =20 +/* + * Test a packet with both a scalar store and an HVX store. + */ +static uint32_t scalar_store_dst; + +static void test_scalar_hvx_store(void) +{ + scalar_store_dst =3D 0; + memset(&expect[0], 0, sizeof(MMVector)); + + /* Fill v0 with 0xABCD pattern */ + for (int i =3D 0; i < MAX_VEC_SIZE_BYTES / 4; i++) { + expect[0].uw[i] =3D 0xABCDABCD; + } + + asm("r0 =3D #0xABCDABCD\n\t" + "v0 =3D vsplat(r0)\n\t" + "r1 =3D #42\n\t" + "{\n\t" + " memw(%[scalar]) =3D r1\n\t" + " vmem(%[hvx]) =3D v0\n\t" + "}\n\t" + : + : [scalar] "r"(&scalar_store_dst), + [hvx] "r"(&output[0]) + : "r0", "r1", "v0", "memory"); + + check_output_w(__LINE__, 1); + if (scalar_store_dst !=3D 42) { + printf("ERROR at line %d: scalar_store_dst =3D %d, expected 42\n", + __LINE__, scalar_store_dst); + err++; + } +} + +/* + * Test non-inverted masked store: if (Qv) vmem(Rt) =3D Vs. + * Existing tests only cover the inverted form (!Qv). + * Use an all-true Q predicate to unconditionally store. + */ +static void test_masked_store_noninvert(void) +{ + void *p0 =3D buffer0; + void *pout =3D output; + + memset(&output[0], 0xff, sizeof(MMVector)); + + for (int i =3D 0; i < MAX_VEC_SIZE_BYTES / 4; i++) { + expect[0].uw[i] =3D buffer0[0].uw[i]; + } + + asm("v5 =3D vmem(%[src] + #0)\n\t" + "r0 =3D #-1\n\t" + "v6 =3D vsplat(r0)\n\t" + "q0 =3D vand(v6, r0)\n\t" + "if (q0) vmem(%[dst]) =3D v5\n\t" + : + : [src] "r"(p0), [dst] "r"(pout) + : "r0", "v5", "v6", "q0", "memory"); + + check_output_w(__LINE__, 1); +} + int main() { init_buffers(); @@ -615,6 +678,9 @@ int main() =20 test_store_new(); =20 + test_scalar_hvx_store(); + test_masked_store_noninvert(); + puts(err ? "FAIL" : "PASS"); return err ? 1 : 0; } --=20 2.34.1 From nobody Sat Sep 26 20:01:26 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=1789490005; cv=none; d=zohomail.com; s=zohoarc; b=J+GJCSpm7Q780zCiWVtw+hn9jeLXFN/9Gw4PxvSQ2JWA6FlWYaM1Al6zXJuJPrhcS33VdWH/t+ncNqivaem9GuwPgj/TYzadaoIeUuwtwez7xVVwyuXCbB1kBa28+jdxTOhWQTgDtFXmV4q6fB+/N7vFqBxHShPmUJ4X/h9v58I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1789490005; h=Content-Type: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=vLaqIhQngXnaflzIMte6PhwnWM1y756KZYKftZcjSL0=; b=Sp1+D7cJro3w4UlKFWtF+Hs26A/KmT/NyajYy1KYDS1Uvwmhtw4q2zSDE2/8ZBHrbliHtUqcwJUvP3sbkgNs89B8Xex50Sx/aJvVBk6fpRUjOQdgomu5NSJQ5MgAqdS6kANklIG57admb80/dd5U1XyrNYYKSI+iSHemlk3ZM2c= 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 1789490005980814.3019967506422; Tue, 15 Sep 2026 09:33:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1x6W4a-0006NF-8b; Tue, 15 Sep 2026 12:31:56 -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 1x6W4P-000647-P7 for qemu-devel@nongnu.org; Tue, 15 Sep 2026 12:31:46 -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 1x6W4N-0003t1-8G for qemu-devel@nongnu.org; Tue, 15 Sep 2026 12:31:45 -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 68FFAdKL2836564 for ; Tue, 15 Sep 2026 16:31:32 GMT Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4gq1qpaypf-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 15 Sep 2026 16:31:31 +0000 (GMT) Received: by mail-pj1-f71.google.com with SMTP id 98e67ed59e1d1-395543dc382so6297187a91.0 for ; Tue, 15 Sep 2026 09:31:31 -0700 (PDT) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-39dfdd0baaasm6068590a91.9.2026.09.15.09.31.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Sep 2026 09:31:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= vLaqIhQngXnaflzIMte6PhwnWM1y756KZYKftZcjSL0=; b=YcpNGznUUIy3s+v0 KcqkGoXTBd9boJo4l5RhrKXPg4yfcPRjQnY7mSLB00k9qpiq/fYYb2ojHYQibn5u UR3MRW5AOWDDnwwp3ZSkWYqPJtQCmUkZT8Lt7hQewY6TAJGd8QaCuvO5mIaXEEGW FHGFX+otmvLHnH5tV0yXefhoRwVVo36/5zw2B4loMi0hSOmqlBnvGAqtvok5wCsu 8sk3Rau1/xTcwjY4nweTlUi37qCLDjk1dUJGYdocuH/2gcVKNNsopgZpKRqVhcBT f0TqSDedo7RXNJPBGbExUtqDSCIav1aeE7QRmAxy3+si0TO69kmBefi9y68hGwMC 6efW1Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1789489891; x=1790094691; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=vLaqIhQngXnaflzIMte6PhwnWM1y756KZYKftZcjSL0=; b=hvHWQccjbV1ir7qwDLYg4rglKMaOOJCjs70MK6C3wNK4wymh85BcK8dnnyvXHLyFOh sQWdj+90CVS0RbmZOzDh8ldD9nXb5sRJ1oLq/7GAKq8edwrIMPRzbF1fDqdszJiYOS08 +yZSCHoJ5EXhzTlmN+f039GP8q8JL62xYeK7IpcI6jfyPvNF3k5NSB+XPZODTMuxJVul 9HDqsS5pdmyloZDqvnHMtafJ1cINY905O/Uz3Rs/z7jxrAL65Ks3XIcYnBgQmTWyaWmb 6LPP0T6kD7TfxzcNaf7BwolSBqOXQ+ZCe75CEOXpKs+9oa+DsbYsQ/Em7wlA6SoPUSRP u9sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789489891; x=1790094691; h=content-transfer-encoding:content-type: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 :content-type; bh=vLaqIhQngXnaflzIMte6PhwnWM1y756KZYKftZcjSL0=; b=FyrHuJNYcGpbJXc/MKZB3q29/i4W+nv3+hfmlMrAUkBvdKb96VbE2HwAf8whQ7pFha EY8Pbz9obavB9dwmQU7LdvsJzQmMHVithhEEGVmtbvlqJ28aLRPTJfy0GswaHG6wKGI0 6UIanOmLB7smPwe524Owm+cbdf6w0MzJ4VuI2p73KpZZ6KaHBu/AzJaJKS3r4xyV+3OQ j1JngcktEyNM7XqM3yy9aF90T3rWJC+mByrG/vS5OUH8pkdBPGDZN601YchgXQf0IkjX 1wmTCEEE26ppopx5jWyG6ecZXg6diG9kDGoGZLBKK37MXq54uzziD3qj52jP7X/0EJPW FMQg== X-Gm-Message-State: AFuF++ng5Q0gflWJYaeClbEB3bGdygLsv66CdEmXD/XjVOAd+S07jn6L s1cnrXIR2lCz8y7hyleeElbR94MqYLp/dHtyUa1o2N3Y+vIIY2ZJugOv9uLIGQN3ytoZP0l/S/x 9r9hNipHW1pUgPRJd7RcXCLO9tj6OGm2nnhTO5iD3EPNTsfYmYKGRNbd8XbU2zYI6KQ== X-Gm-Gg: AYBFou2HE+DsAW9pXseY+4ID7aCo1le240SCl+1DtT2mBiD9/jilIE21NLffDbU4DrO BfzFPrNZV9DyDrCrHArOUfusCKF0x/jP/9bd5payEGzX6lMGa2DapW585qSUZrBVFXfggI57Tw/ 52OX7/ZllLQYkaryIh9yfq8T/0ZM/n6n0OK2/f/7KvXBNvjtLLtxU1f0sAyflQaBZLxqTwMejYK pBmYrbTkqX4tUXht6wLMoqG3cFJgZoy1KAWg0Gpams7S03KF6AD5rs7wsW8pgHk4WO23pRtJ3iY qA4PgJwaKvBauOtE3PQXdXcpzgTAcM87vG0JUUBXART0I0BrFzi4DLIbyXfx07NWShFIz7M2Hlg X8H9eykfcrDtLbcTNb9mkSy7spmEJxu0BWzEQ5xqUKFZAr/pg X-Received: by 2002:a17:90b:1c81:b0:39d:f66e:1720 with SMTP id 98e67ed59e1d1-39df66e17d0mr13755774a91.13.1789489890661; Tue, 15 Sep 2026 09:31:30 -0700 (PDT) X-Received: by 2002:a17:90b:1c81:b0:39d:f66e:1720 with SMTP id 98e67ed59e1d1-39df66e17d0mr13755652a91.13.1789489890069; Tue, 15 Sep 2026 09:31:30 -0700 (PDT) From: Brian Cain To: qemu-devel@nongnu.org Cc: sid.manning@oss.qualcomm.com, Pierrick Bouvier , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Brian Cain Subject: [PATCH v2 17/17] tests/tcg/hexagon: add decbin MPS test case Date: Tue, 15 Sep 2026 09:30:47 -0700 Message-Id: <20260915163047.4180600-18-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260915163047.4180600-1-brian.cain@oss.qualcomm.com> References: <20260915163047.4180600-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Info: AW1haW4tMjYwOTE1MDIzOSBTYWx0ZWRfX6oSnx0aB5ztr XYTBK/y3nl5E0sShydgtvIzT6sHZlmScDHjPEqrnpR8SBQOfY2EtZx8gNMkqAioQprhMv3P1gVk ot44ZowQNA67STu5XXe2Mzk6PvMpeKI= X-Authority-Analysis: v=2.4 cv=I4Xw19gg c=1 sm=1 tr=0 ts=6aa972e3 cx=c_pps a=UNFcQwm+pnOIJct1K4W+Mw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=DJpcGTmdVt4CTyJn9g5Z:22 a=EUspDBNiAAAA:8 a=QfmX1zfwqVA98Td9WrcA:9 a=QEXdDO2ut3YA:10 a=uKXjsCUrEbL0IQVhDsJ9:22 X-Proofpoint-ORIG-GUID: 2SunhXwzjYk_rvgbPOefAtgSnt-sz2AO X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTE1MDIzOSBTYWx0ZWRfX4iZhBSgkUn1y LtbNnQx3/ofuGHqBzrStSXbTbq6E1itVf7qE0I1AUZlUxAr8EGN5QS37B6p9TBfoKanRawDfoVS 6q5ulfyele1SP8qHX0vAjfsGAZsyoizEFm9FAMw8pQpjO6RCCPwQA5cuASPOU2jHkGwg9BprtbY RdNbAkJboFDtqiN377j1JHV0WUiLgN+oESxwaM1gghldby116sa6fWKItJxOS/XQRCOdjo5D2Vj O+79Bk5/wYysgaAbmr/e4TZ3lfWpO9oHVE44r9UkH5Vx2l+mtP0aehyFIIPpn9Tk6FFN+chkEs8 wUG482BVyhw7Td//F96E1gaxq4RNzK3Qgit0pTdc1HNXzx6gT+3X4vH3zSaVZMa5CWq96STu82N n6b7p2Vva4uDuE5PmKaNlZi19veZEVTzbGjG0g5UUXzQ7ZvJkyoHVKKID/V5hK1gBq3E06pFoVD UNzzVwrvB7k+MbNUKFw== X-Proofpoint-GUID: 2SunhXwzjYk_rvgbPOefAtgSnt-sz2AO X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-15_04,2026-09-15_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 suspectscore=0 phishscore=0 clxscore=1015 priorityscore=1501 bulkscore=0 malwarescore=0 impostorscore=0 adultscore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609150239 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=brian.cain@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, 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: 1789490007104158500 Add a decbin test vector exercising the MPS case Reviewed-by: Pierrick Bouvier Signed-off-by: Brian Cain --- tests/tcg/hexagon/misc.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/tcg/hexagon/misc.c b/tests/tcg/hexagon/misc.c index abb34ab6a65..08845201b59 100644 --- a/tests/tcg/hexagon/misc.c +++ b/tests/tcg/hexagon/misc.c @@ -599,6 +599,15 @@ int main() res64 =3D decbin(0xfLL, 0x1bLL, &pred); check64(res64, 0x78000100LL); check32(pred, true); + + /* + * Test the MPS (most-probable symbol) case in decbin. + * Rss: word0=3Drange=3D0xFF800000, word1=3Doffset=3D0x00000000 + * Rtt: word0=3Dbitpos=3D0, word1=3Dstate=3D0|valMPS=3D1(bit8) + */ + res64 =3D decbin(0x00000000FF800000LL, 0x0000010000000000LL, &pred); + check64(res64, 0x0000000087800101LL); + check32(pred, true); #else puts("Skipping cabac tests"); #endif --=20 2.34.1