From nobody Mon Nov 25 03:04:14 2024 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=none dis=none) header.from=quicinc.com ARC-Seal: i=1; a=rsa-sha256; t=1717894717; cv=none; d=zohomail.com; s=zohoarc; b=DQSA7p1ADLTiiEMs8Q5I+Ir+TmfZTn8YHfwTltfjNKZXII0LR4OHcMYOYbmL9RFUMryMKyfplLaRVLD8q+pVLaPiR6AiTyUIb3z1xXO+F2cjm4CJI+DqKSA7NVxT2NYBRhTn0D7hJ2TOGmKG2VamnCCieDcL0Oz1LR4jj2zPaOo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1717894717; 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=+0YPOUqiirDtqhXzuFbMUEhgklj+jc6YmWswnge7u5c=; b=ap7qAQvAZ/dnTQ+/gAEErgxba3w2g+mroSmkmwS6wR20IgqezqpSim344wJnvifJbyHzPrYAyWG8nTtje/mVHiJwRMN/1lw9UFvkBa6Uou+PYchg2ZRTNY+lf/iPj9K/iU6Qt3OjOE4QSTXdm5vMsmppiL23VUPBqFZko+cdyaU= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1717894717391508.9182415947366; Sat, 8 Jun 2024 17:58:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sG6sI-0007mY-3Y; Sat, 08 Jun 2024 20:57:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sG6sF-0007ku-Ro for qemu-devel@nongnu.org; Sat, 08 Jun 2024 20:57:31 -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 1sG6sC-0003tS-9T for qemu-devel@nongnu.org; Sat, 08 Jun 2024 20:57:29 -0400 Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4590q2ie004598; Sun, 9 Jun 2024 00:57:23 GMT Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3ymea6h5t9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 09 Jun 2024 00:57:23 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA02.qualcomm.com (8.17.1.19/8.17.1.19) with ESMTPS id 4590vKaY005416 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 9 Jun 2024 00:57:20 GMT Received: from hu-bcain-lv.qualcomm.com (10.49.16.6) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Sat, 8 Jun 2024 17:57:20 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= +0YPOUqiirDtqhXzuFbMUEhgklj+jc6YmWswnge7u5c=; b=oDVyLw34veD6LmfJ LNGfq/ADVG+IcXRDxpdRHOAX8tSWZIEEJHOvMIerWwG+F1azj95GLB/GXkIA/BHJ 763uVdChl1MqWrdZTZ0zgKKPWHTRoqkLRgHLYoz+tqXroP44pOqfUmY40gqxnOJH mgWefRzYF4UcQ6B0pxjuHBSqtCucMNBDJcLe6eq8QPJq7PFY8dic07KB5pNmRwND uEIi+jRo94Y5KI0OZgo5yVAsaE/Cq5yVdPxifbJ7gOc+eBnx6I6ZokVCs7oYgxcO yjJGqwDk0gobG9cyn3l+gZTQLwZ5s2KUZcy9yUyabuE5LNkqy3O89jkN4iq1SiyX WH4Gqg== From: Brian Cain To: CC: , , , , , , , , , , Subject: [PULL 1/6] Hexagon: fix HVX store new Date: Sat, 8 Jun 2024 17:57:00 -0700 Message-ID: <20240609005705.2809037-2-bcain@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240609005705.2809037-1-bcain@quicinc.com> References: <20240609005705.2809037-1-bcain@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01a.na.qualcomm.com (10.47.209.196) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: YwqtFjq7zpbtDvQkf8fXZdmmhllx8dTi X-Proofpoint-ORIG-GUID: YwqtFjq7zpbtDvQkf8fXZdmmhllx8dTi X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-08_16,2024-06-06_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 mlxscore=0 spamscore=0 phishscore=0 mlxlogscore=999 clxscore=1015 lowpriorityscore=0 malwarescore=0 suspectscore=0 adultscore=0 bulkscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406090006 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.220.180.131; envelope-from=bcain@quicinc.com; helo=mx0b-0031df01.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @quicinc.com) X-ZM-MESSAGEID: 1717894718703100001 From: Matheus Tavares Bernardino At 09a7e7db0f (Hexagon (target/hexagon) Remove uses of op_regs_generated.h.inc, 2024-03-06), we've changed the logic of check_new_value() to use the new pre-calculated packet->insn[...].dest_idx instead of calculating the index on the fly using opcode_reginfo[...]. The dest_idx index is calculated roughly like the following: for reg in iset[tag]["syntax"]: if reg.is_written(): dest_idx =3D regno break Thus, we take the first register that is writtable. Before that, however, we also used to follow an alphabetical order on the register type: 'd', 'e', 'x', and 'y'. No longer following that makes us select the wrong register index and the HVX store new instruction does not update the memory like expected. Signed-off-by: Matheus Tavares Bernardino Reviewed-by: Brian Cain Reviewed-by: Taylor Simpson Message-Id: Signed-off-by: Brian Cain --- target/hexagon/gen_trans_funcs.py | 9 ++++++--- tests/tcg/hexagon/hvx_misc.c | 23 +++++++++++++++++++++++ 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/target/hexagon/gen_trans_funcs.py b/target/hexagon/gen_trans_f= uncs.py index 9f86b4edbd..30f0c73e0c 100755 --- a/target/hexagon/gen_trans_funcs.py +++ b/target/hexagon/gen_trans_funcs.py @@ -89,6 +89,7 @@ def gen_trans_funcs(f): =20 new_read_idx =3D -1 dest_idx =3D -1 + dest_idx_reg_id =3D None has_pred_dest =3D "false" for regno, (reg_type, reg_id, *_) in enumerate(regs): reg =3D hex_common.get_register(tag, reg_type, reg_id) @@ -97,9 +98,11 @@ def gen_trans_funcs(f): """)) if reg.is_read() and reg.is_new(): new_read_idx =3D regno - # dest_idx should be the first destination, so check for -1 - if reg.is_written() and dest_idx =3D=3D -1: - dest_idx =3D regno + if reg.is_written(): + # dest_idx should be the first destination alphabetically + if dest_idx_reg_id is None or reg_id < dest_idx_reg_id: + dest_idx =3D regno + dest_idx_reg_id =3D reg_id if reg_type =3D=3D "P" and reg.is_written() and not reg.is_rea= d(): has_pred_dest =3D "true" =20 diff --git a/tests/tcg/hexagon/hvx_misc.c b/tests/tcg/hexagon/hvx_misc.c index 1fe14b5158..90c3733da0 100644 --- a/tests/tcg/hexagon/hvx_misc.c +++ b/tests/tcg/hexagon/hvx_misc.c @@ -474,6 +474,27 @@ static void test_vcombine(void) check_output_w(__LINE__, BUFSIZE); } =20 +void test_store_new() +{ + asm volatile( + "r0 =3D #0x12345678\n" + "v0 =3D vsplat(r0)\n" + "r0 =3D #0xff00ff00\n" + "v1 =3D vsplat(r0)\n" + "{\n" + " vdeal(v1,v0,r0)\n" + " vmem(%0) =3D v0.new\n" + "}\n" + : + : "r"(&output[0]) + : "r0", "v0", "v1", "memory" + ); + for (int i =3D 0; i < MAX_VEC_SIZE_BYTES / 4; i++) { + expect[0].w[i] =3D 0x12345678; + } + check_output_w(__LINE__, 1); +} + int main() { init_buffers(); @@ -515,6 +536,8 @@ int main() =20 test_vcombine(); =20 + test_store_new(); + puts(err ? "FAIL" : "PASS"); return err ? 1 : 0; } --=20 2.25.1 From nobody Mon Nov 25 03:04:14 2024 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=none dis=none) header.from=quicinc.com ARC-Seal: i=1; a=rsa-sha256; t=1717894708; cv=none; d=zohomail.com; s=zohoarc; b=SjsBRI2RmtLkt1k5/6PKbwct9MdusQoZh2vqIs/KFi0cOwxaps8bDb1NoHuCoj+1PqXSr1siW9ceSZD6fXpNQUoJ8nO5nTQFh6ALcq8GRQsudWYABV+saX3xerNdCrfDaikB+r8U2oKorzqsRWRcILbzKhMFwCqLXe2PZxP1bd4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1717894708; 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=nSvsNByrYgdOXFRvcnRwCNNIU+k6Il/IpywXJYLC/f4=; b=V98gu+b5mQcduP3o5F05X1Y+l5029de2eV4UhJJwdmesasXdougqfXkaLvqfQAQuoRbbRT4Zh7ae7GsaqYDMVZdB2/c1Xv1RSFlRZRwHLB0o3aBr3T6Wgruin+/P8LHsemGAphj5riZVIQp/s5vXYf7BI1w6IZtMEI6gsOr43NI= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1717894708247237.70492969805093; Sat, 8 Jun 2024 17:58:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sG6sJ-0007mk-L7; Sat, 08 Jun 2024 20:57:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sG6sG-0007lT-BI for qemu-devel@nongnu.org; Sat, 08 Jun 2024 20:57:32 -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 1sG6sC-0003tV-9W for qemu-devel@nongnu.org; Sat, 08 Jun 2024 20:57:30 -0400 Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 458NgI7O031199; Sun, 9 Jun 2024 00:57:23 GMT Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3ymevx94ys-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 09 Jun 2024 00:57:23 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA02.qualcomm.com (8.17.1.19/8.17.1.19) with ESMTPS id 4590vK7Y005424 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 9 Jun 2024 00:57:20 GMT Received: from hu-bcain-lv.qualcomm.com (10.49.16.6) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Sat, 8 Jun 2024 17:57:20 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= nSvsNByrYgdOXFRvcnRwCNNIU+k6Il/IpywXJYLC/f4=; b=VZ7XtISkAp8MK1QZ eaE0suNDafZH6bGatwz/BcsXIAfbJxQU9FCyHGW0h0jkHkZlLU5akRDeQGrGOQ/c EBiJae5KKQpvrvTIasBOxtElkGMnaEVdNtPlppDm5gYPK+Tx7Xdk//BtTYG52CqM b/y7MbBpYBqCjsYu57eLUI+ZGKmKzGUrYrIwGkp5koFc9QkgorRnJFLkRyOUApuY Jpc+0VLq7rV3Tvu5XqCzbqmGRM4kEGj/1iVsr6VCbZJlMM6NjHPQlvaKCGEZD22O 3wBLMu3TjPfkC4qXmWFXsPBLWB5FcZ90eLOsLEHOMIW3DMeJUJHJadkjcztS4Jev JGt6SA== From: Brian Cain To: CC: , , , , , , , , , , , Laurent Vivier Subject: [PULL 2/6] Hexagon: add PC alignment check and exception Date: Sat, 8 Jun 2024 17:57:01 -0700 Message-ID: <20240609005705.2809037-3-bcain@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240609005705.2809037-1-bcain@quicinc.com> References: <20240609005705.2809037-1-bcain@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01a.na.qualcomm.com (10.47.209.196) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: yZpPZestNHS0hN9c99aqZkq2L-5ZFNyc X-Proofpoint-GUID: yZpPZestNHS0hN9c99aqZkq2L-5ZFNyc X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-08_16,2024-06-06_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 mlxscore=0 impostorscore=0 adultscore=0 phishscore=0 malwarescore=0 clxscore=1011 suspectscore=0 priorityscore=1501 spamscore=0 bulkscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406090006 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.220.180.131; envelope-from=bcain@quicinc.com; helo=mx0b-0031df01.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @quicinc.com) X-ZM-MESSAGEID: 1717894708689100001 From: Matheus Tavares Bernardino The Hexagon Programmer's Reference Manual says that the exception 0x1e should be raised upon an unaligned program counter. Let's implement that and also add some tests. Signed-off-by: Matheus Tavares Bernardino Reviewed-by: Richard Henderson Reviewed-by: Taylor Simpson Reviewed-by: Brian Cain Message-Id: <277b7aeda2c717a96d4dde936b3ac77707cb6517.1714755107.git.quic_m= athbern@quicinc.com> Signed-off-by: Brian Cain --- linux-user/hexagon/cpu_loop.c | 4 ++ target/hexagon/cpu.h | 7 ++ target/hexagon/cpu_bits.h | 4 ++ target/hexagon/macros.h | 3 - target/hexagon/op_helper.c | 9 ++- tests/tcg/hexagon/Makefile.target | 2 + tests/tcg/hexagon/unaligned_pc.c | 107 ++++++++++++++++++++++++++++++ 7 files changed, 128 insertions(+), 8 deletions(-) create mode 100644 tests/tcg/hexagon/unaligned_pc.c diff --git a/linux-user/hexagon/cpu_loop.c b/linux-user/hexagon/cpu_loop.c index 7f1499ed28..d41159e52a 100644 --- a/linux-user/hexagon/cpu_loop.c +++ b/linux-user/hexagon/cpu_loop.c @@ -60,6 +60,10 @@ void cpu_loop(CPUHexagonState *env) env->gpr[0] =3D ret; } break; + case HEX_EXCP_PC_NOT_ALIGNED: + force_sig_fault(TARGET_SIGBUS, TARGET_BUS_ADRALN, + env->gpr[HEX_REG_R31]); + break; case EXCP_ATOMIC: cpu_exec_step_atomic(cs); break; diff --git a/target/hexagon/cpu.h b/target/hexagon/cpu.h index 3eef58fe8f..764f3c38cc 100644 --- a/target/hexagon/cpu.h +++ b/target/hexagon/cpu.h @@ -134,6 +134,10 @@ struct ArchCPU { =20 FIELD(TB_FLAGS, IS_TIGHT_LOOP, 0, 1) =20 +G_NORETURN void hexagon_raise_exception_err(CPUHexagonState *env, + uint32_t exception, + uintptr_t pc); + static inline void cpu_get_tb_cpu_state(CPUHexagonState *env, vaddr *pc, uint64_t *cs_base, uint32_t *flags) { @@ -144,6 +148,9 @@ static inline void cpu_get_tb_cpu_state(CPUHexagonState= *env, vaddr *pc, hex_flags =3D FIELD_DP32(hex_flags, TB_FLAGS, IS_TIGHT_LOOP, 1); } *flags =3D hex_flags; + if (*pc & PCALIGN_MASK) { + hexagon_raise_exception_err(env, HEX_EXCP_PC_NOT_ALIGNED, 0); + } } =20 typedef HexagonCPU ArchCPU; diff --git a/target/hexagon/cpu_bits.h b/target/hexagon/cpu_bits.h index 96fef71729..4279281a71 100644 --- a/target/hexagon/cpu_bits.h +++ b/target/hexagon/cpu_bits.h @@ -20,9 +20,13 @@ =20 #include "qemu/bitops.h" =20 +#define PCALIGN 4 +#define PCALIGN_MASK (PCALIGN - 1) + #define HEX_EXCP_FETCH_NO_UPAGE 0x012 #define HEX_EXCP_INVALID_PACKET 0x015 #define HEX_EXCP_INVALID_OPCODE 0x015 +#define HEX_EXCP_PC_NOT_ALIGNED 0x01e #define HEX_EXCP_PRIV_NO_UREAD 0x024 #define HEX_EXCP_PRIV_NO_UWRITE 0x025 =20 diff --git a/target/hexagon/macros.h b/target/hexagon/macros.h index feb798c6c0..ee3d4c88e7 100644 --- a/target/hexagon/macros.h +++ b/target/hexagon/macros.h @@ -22,9 +22,6 @@ #include "hex_regs.h" #include "reg_fields.h" =20 -#define PCALIGN 4 -#define PCALIGN_MASK (PCALIGN - 1) - #define GET_FIELD(FIELD, REGIN) \ fEXTRACTU_BITS(REGIN, reg_field_info[FIELD].width, \ reg_field_info[FIELD].offset) diff --git a/target/hexagon/op_helper.c b/target/hexagon/op_helper.c index da10ac5847..ae5a605513 100644 --- a/target/hexagon/op_helper.c +++ b/target/hexagon/op_helper.c @@ -36,10 +36,9 @@ #define SF_MANTBITS 23 =20 /* Exceptions processing helpers */ -static G_NORETURN -void do_raise_exception_err(CPUHexagonState *env, - uint32_t exception, - uintptr_t pc) +G_NORETURN void hexagon_raise_exception_err(CPUHexagonState *env, + uint32_t exception, + uintptr_t pc) { CPUState *cs =3D env_cpu(env); qemu_log_mask(CPU_LOG_INT, "%s: %d\n", __func__, exception); @@ -49,7 +48,7 @@ void do_raise_exception_err(CPUHexagonState *env, =20 G_NORETURN void HELPER(raise_exception)(CPUHexagonState *env, uint32_t exc= p) { - do_raise_exception_err(env, excp, 0); + hexagon_raise_exception_err(env, excp, 0); } =20 void log_store32(CPUHexagonState *env, target_ulong addr, diff --git a/tests/tcg/hexagon/Makefile.target b/tests/tcg/hexagon/Makefile= .target index f839b2c0d5..e5182c01d8 100644 --- a/tests/tcg/hexagon/Makefile.target +++ b/tests/tcg/hexagon/Makefile.target @@ -51,6 +51,7 @@ HEX_TESTS +=3D scatter_gather HEX_TESTS +=3D hvx_misc HEX_TESTS +=3D hvx_histogram HEX_TESTS +=3D invalid-slots +HEX_TESTS +=3D unaligned_pc =20 run-and-check-exception =3D $(call run-test,$2,$3 2>$2.stderr; \ test $$? -eq 1 && grep -q "exception $(strip $1)" $2.stderr) @@ -107,6 +108,7 @@ overflow: overflow.c hex_test.h preg_alias: preg_alias.c hex_test.h read_write_overlap: read_write_overlap.c hex_test.h reg_mut: reg_mut.c hex_test.h +unaligned_pc: unaligned_pc.c =20 # This test has to be compiled for the -mv67t target usr: usr.c hex_test.h diff --git a/tests/tcg/hexagon/unaligned_pc.c b/tests/tcg/hexagon/unaligned= _pc.c new file mode 100644 index 0000000000..e9dc7cb8b5 --- /dev/null +++ b/tests/tcg/hexagon/unaligned_pc.c @@ -0,0 +1,107 @@ +#include +#include +#include +#include + +/* will be changed in signal handler */ +volatile sig_atomic_t completed_tests; +static jmp_buf after_test; +static int nr_tests; + +void __attribute__((naked)) test_return(void) +{ + asm volatile( + "allocframe(#0x8)\n" + "r0 =3D #0xffffffff\n" + "framekey =3D r0\n" + "dealloc_return\n" + : + : + : "r0", "r29", "r30", "r31", "framekey"); +} + +void test_endloop(void) +{ + asm volatile( + "loop0(1f, #2)\n" + "1: r0 =3D #0x3\n" + "sa0 =3D r0\n" + "{ nop }:endloop0\n" + : + : + : "r0", "sa0", "lc0", "usr"); +} + +asm( + ".pushsection .text.unaligned\n" + ".org 0x3\n" + ".global test_multi_cof_unaligned\n" + "test_multi_cof_unaligned:\n" + " jumpr r31\n" + ".popsection\n" +); + +#define SYS_EXIT 94 + +void test_multi_cof(void) +{ + asm volatile( + "p0 =3D cmp.eq(r0, r0)\n" + "{\n" + " if (p0) jump test_multi_cof_unaligned\n" + " if (!p0) jump 1f\n" + "}\n" + "1:" + " r0 =3D #1\n" + " r6 =3D #%0\n" + " trap0(#1)\n" + : + : "i"(SYS_EXIT) + : "p0", "r0", "r6"); +} + +void sigbus_handler(int signum) +{ + /* retore framekey after test_return */ + asm volatile( + "r0 =3D #0\n" + "framekey =3D r0\n" + : + : + : "r0", "framekey"); + printf("Test %d complete\n", completed_tests); + completed_tests++; + siglongjmp(after_test, 1); +} + +void test_done(void) +{ + int err =3D (completed_tests !=3D nr_tests); + puts(err ? "FAIL" : "PASS"); + exit(err); +} + +typedef void (*test_fn)(void); + +int main() +{ + test_fn tests[] =3D { test_return, test_endloop, test_multi_cof, test_= done }; + nr_tests =3D (sizeof(tests) / sizeof(tests[0])) - 1; + + struct sigaction sa =3D { + .sa_sigaction =3D sigbus_handler, + .sa_flags =3D SA_SIGINFO + }; + + if (sigaction(SIGBUS, &sa, NULL) < 0) { + perror("sigaction"); + return EXIT_FAILURE; + } + + sigsetjmp(after_test, 1); + tests[completed_tests](); + + /* should never get here */ + puts("FAIL"); + return 1; +} --=20 2.25.1 From nobody Mon Nov 25 03:04:14 2024 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=none dis=none) header.from=quicinc.com ARC-Seal: i=1; a=rsa-sha256; t=1717894769; cv=none; d=zohomail.com; s=zohoarc; b=S6qn0xjY6aWQyRF9yi5qq+V8gTBnrTIDsCyLBo1AtxxyTn8eKnxXIUMErO9u9lyMXMUl/+TMaVmFkQekQ/3WBR/1b+K8bkb1JM9VFdfHxER+hzL/U6gB1WwhA/UuDka36f/O1HTS2yL55/pwQBxLzfMiVEbY0ZBYak8taiJkwlY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1717894769; 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=eDsHNaWPkVU37Yv+C7qUcnL0MRskm6pncNLd1vlWLPg=; b=kLI7k4NSUOzGxpL3d8B9abS6olImgjECIxN/MtJ0cJmhcPr64f7QTmg79UNbE73bEuV9K1YzdHuWQSZgnu5emJ4vkECN+3ycRRDLl6Ac6X6+zXQ5Lsq0ZUkkvL2fjmwYK3+UehA8mroHKmX3/yAbiEnyEe8EfeXu6FqMeGBGMDo= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1717894769606534.8673864119273; Sat, 8 Jun 2024 17:59:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sG6sH-0007mM-ES; Sat, 08 Jun 2024 20:57:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sG6sE-0007kN-Nx for qemu-devel@nongnu.org; Sat, 08 Jun 2024 20:57:30 -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 1sG6sA-0003tK-MD for qemu-devel@nongnu.org; Sat, 08 Jun 2024 20:57:29 -0400 Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45908Q5u019232; Sun, 9 Jun 2024 00:57:22 GMT Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3ymcnms9j7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 09 Jun 2024 00:57:22 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA05.qualcomm.com (8.17.1.19/8.17.1.19) with ESMTPS id 4590vLGu012008 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 9 Jun 2024 00:57:21 GMT Received: from hu-bcain-lv.qualcomm.com (10.49.16.6) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Sat, 8 Jun 2024 17:57:20 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= eDsHNaWPkVU37Yv+C7qUcnL0MRskm6pncNLd1vlWLPg=; b=XEcM3CL22yFjB+OJ q8jsGe54P041LQP4e3zTRmqt3G4GvD9PLlD9Y7672hDF/shjjckrlqIbDriLG49M xHfKo6mJjNLIRZKPdkwD3VNRR4Aki4fMUoqXCly2TzWEsXKt5Hx5I95qGh7ObKPY afd/5jmRAAXLmVzDzdQiI1CuqUG+bZCZILzcgc+fNzQa/7h8fShaO6C+K6rXUA3v Q0+0TNOa/9amHKpOgVtWBltN9lnOAVxwC1Yh3LLR3AlFKMoH70s1Xs4GumMEVc8Y ShFbpCQkUsRbOn9MUWCn5Kq30w0snzs8EVmiE1qSKYuaXGioKKfJ7yIERVe7ZDTD HcyQ8g== From: Brian Cain To: CC: , , , , , , , , , , Subject: [PULL 3/6] target/hexagon: idef-parser remove unused defines Date: Sat, 8 Jun 2024 17:57:02 -0700 Message-ID: <20240609005705.2809037-4-bcain@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240609005705.2809037-1-bcain@quicinc.com> References: <20240609005705.2809037-1-bcain@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01a.na.qualcomm.com (10.47.209.196) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: ZufR8sx57KWXN5REkiDhII2gvHVOylaJ X-Proofpoint-ORIG-GUID: ZufR8sx57KWXN5REkiDhII2gvHVOylaJ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-08_16,2024-06-06_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 impostorscore=0 clxscore=1015 adultscore=0 phishscore=0 spamscore=0 priorityscore=1501 malwarescore=0 mlxscore=0 mlxlogscore=708 bulkscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406090006 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.220.180.131; envelope-from=bcain@quicinc.com; helo=mx0b-0031df01.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @quicinc.com) X-ZM-MESSAGEID: 1717894770876100003 From: Anton Johansson Before switching to GArray/g_string_printf we used fixed size arrays for output buffers and instructions arguments among other things. Macros defining the sizes of these buffers were left behind, remove them. Signed-off-by: Anton Johansson Reviewed-by: Taylor Simpson Reviewed-by: Brian Cain Message-Id: <20240523125901.27797-2-anjo@rev.ng> Signed-off-by: Brian Cain --- target/hexagon/idef-parser/idef-parser.h | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/target/hexagon/idef-parser/idef-parser.h b/target/hexagon/idef= -parser/idef-parser.h index 3faa1deecd..8594cbe3a2 100644 --- a/target/hexagon/idef-parser/idef-parser.h +++ b/target/hexagon/idef-parser/idef-parser.h @@ -23,16 +23,6 @@ #include #include =20 -#define TCGV_NAME_SIZE 7 -#define MAX_WRITTEN_REGS 32 -#define OFFSET_STR_LEN 32 -#define ALLOC_LIST_LEN 32 -#define ALLOC_NAME_SIZE 32 -#define INIT_LIST_LEN 32 -#define OUT_BUF_LEN (1024 * 1024) -#define SIGNATURE_BUF_LEN (128 * 1024) -#define HEADER_BUF_LEN (128 * 1024) - /* Variadic macros to wrap the buffer printing functions */ #define EMIT(c, ...) = \ do { = \ --=20 2.25.1 From nobody Mon Nov 25 03:04:14 2024 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=none dis=none) header.from=quicinc.com ARC-Seal: i=1; a=rsa-sha256; t=1717894761; cv=none; d=zohomail.com; s=zohoarc; b=TjoXdTaTLS3D7PqP1BqZ1eJJF6lD/vgKPlhzX/iDi6ug/nFVc2q54AX9Z3E8GDrpeIpc7OHnE4SR7J5jRURH8lbzSGynJcsUHdq6Xt9TnQfHDGWoKEf+UTHs8PcL6KMtMCjCmWAHvGYqNyZWvd4Tj9pOgoBoWcwWLTsRyiGhv+w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1717894761; 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=8lIN+ZmPVHJf317zaz7DXJBQyUma2FK7tT9eAnk9pLU=; b=Wo5n6ykBH2VCguZq0zlbYZKX9hWJt/utjpkJjrU/A9X8j/gzEiXidlIA4TPaZ0CaXKp3A4qVCHd/7IeQ+Iz6Zv5a3DuhhifpcmI1bIDTD93axaT3mjwRDnjLZQSz1KmbGbly/7sP4HmHrBke7s3+dWbrqvablqTx5L3SdFpu224= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 171789476192163.64351212644806; Sat, 8 Jun 2024 17:59:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sG6sD-0007k3-Rz; Sat, 08 Jun 2024 20:57:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sG6sC-0007jo-Jh for qemu-devel@nongnu.org; Sat, 08 Jun 2024 20:57:28 -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 1sG6sA-0003tP-69 for qemu-devel@nongnu.org; Sat, 08 Jun 2024 20:57:28 -0400 Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 458MxaYo008607; Sun, 9 Jun 2024 00:57:23 GMT Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3ymcnms9j8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 09 Jun 2024 00:57:23 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA01.qualcomm.com (8.17.1.19/8.17.1.19) with ESMTPS id 4590vLrq024413 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 9 Jun 2024 00:57:21 GMT Received: from hu-bcain-lv.qualcomm.com (10.49.16.6) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Sat, 8 Jun 2024 17:57:21 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= 8lIN+ZmPVHJf317zaz7DXJBQyUma2FK7tT9eAnk9pLU=; b=hFpwaH3pfNG8o8dD g60Rfn358HDe/NV8Gk1PpCEwixVSq2l4xIApCx89fjW/e2pl/MM6ynaLF6cEcBR2 dN8mwitf/xubuPr2X8P6mmwQrKquoK0OQ8YPECYz9dJKt7OZ4M/7u5WctDr8fLhx W0jCSx4mvudgdS/GKoOyZZiuBh+ozcNKk6K6IAQocxWpNxaGEYG0CZi0ts+jH9ok W0Z2hkYwVeXwbttcct7kQI8k84fA01CUEVsou779BsR+8iMZu51l2kAbqhd/JhFf rw29Rl9+X9F4RINFTunkHvgYcT4epQtOPY4OUXK6nNnNJUge59191n0hf6LZMixD PpbVZw== From: Brian Cain To: CC: , , , , , , , , , , Subject: [PULL 4/6] target/hexagon: idef-parser remove undefined functions Date: Sat, 8 Jun 2024 17:57:03 -0700 Message-ID: <20240609005705.2809037-5-bcain@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240609005705.2809037-1-bcain@quicinc.com> References: <20240609005705.2809037-1-bcain@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01a.na.qualcomm.com (10.47.209.196) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: IDBwS8kKwsaBekt-AThoooVEUi2kifGk X-Proofpoint-ORIG-GUID: IDBwS8kKwsaBekt-AThoooVEUi2kifGk X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-08_16,2024-06-06_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 impostorscore=0 clxscore=1015 adultscore=0 phishscore=0 spamscore=0 priorityscore=1501 malwarescore=0 mlxscore=0 mlxlogscore=815 bulkscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406090006 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.220.180.131; envelope-from=bcain@quicinc.com; helo=mx0b-0031df01.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @quicinc.com) X-ZM-MESSAGEID: 1717894762989100003 From: Anton Johansson Signed-off-by: Anton Johansson Reviewed-by: Taylor Simpson Reviewed-by: Brian Cain Message-Id: <20240523125901.27797-3-anjo@rev.ng> Signed-off-by: Brian Cain --- target/hexagon/idef-parser/parser-helpers.h | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/target/hexagon/idef-parser/parser-helpers.h b/target/hexagon/i= def-parser/parser-helpers.h index 7c58087169..2087d534a9 100644 --- a/target/hexagon/idef-parser/parser-helpers.h +++ b/target/hexagon/idef-parser/parser-helpers.h @@ -143,8 +143,6 @@ void commit(Context *c); =20 #define OUT(c, locp, ...) FOR_EACH((c), (locp), OUT_IMPL, __VA_ARGS__) =20 -const char *cmp_swap(Context *c, YYLTYPE *locp, const char *type); - /** * Temporary values creation */ @@ -236,8 +234,6 @@ HexValue gen_extract_op(Context *c, HexValue *index, HexExtract *extract); =20 -HexValue gen_read_reg(Context *c, YYLTYPE *locp, HexValue *reg); - void gen_write_reg(Context *c, YYLTYPE *locp, HexValue *reg, HexValue *val= ue); =20 void gen_assign(Context *c, @@ -274,13 +270,6 @@ HexValue gen_ctpop_op(Context *c, YYLTYPE *locp, HexVa= lue *src); =20 HexValue gen_rotl(Context *c, YYLTYPE *locp, HexValue *src, HexValue *n); =20 -HexValue gen_deinterleave(Context *c, YYLTYPE *locp, HexValue *mixed); - -HexValue gen_interleave(Context *c, - YYLTYPE *locp, - HexValue *odd, - HexValue *even); - HexValue gen_carry_from_add(Context *c, YYLTYPE *locp, HexValue *op1, @@ -349,8 +338,6 @@ HexValue gen_rvalue_ternary(Context *c, YYLTYPE *locp, = HexValue *cond, =20 const char *cond_to_str(TCGCond cond); =20 -void emit_header(Context *c); - void emit_arg(Context *c, YYLTYPE *locp, HexValue *arg); =20 void emit_footer(Context *c); --=20 2.25.1 From nobody Mon Nov 25 03:04:14 2024 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=none dis=none) header.from=quicinc.com ARC-Seal: i=1; a=rsa-sha256; t=1717894801; cv=none; d=zohomail.com; s=zohoarc; b=Se9VQ3rpKFlA4KWMrG9zfI6fCsGeInaTHr+RQccMB9e2tZ/HPFTeWKJW9gjIANUbFWLKZFvk+nFfQjDnQlshsbPvrgqu44y9kJB7l/PUQt2d1rg7xsr7bi3qtzDcbZimLm5420R++UJURohSV2VFeeZBEwB5A5R+C+0tAzEWC/Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1717894801; 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=W0hv18PH1zmmBiXV+tTS7ii6GGPMv6F2fMonOX/sww4=; b=fmzVEsP2x7EMB2Vxjr2FQjQb5rAP8149EHdxKwyIzbutTty5if8Gy/Zm0Prerlis2Kjxe30WipAteL9AXnGhvbA9kwMAxYz4gziETFiH+zQlgtAYPPHdetC5o1xLRyBqgXHFUcYb0Nhmc/7KSnie5h68tA+mi3BkNZEjfbDjKuA= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1717894801573535.432437292348; Sat, 8 Jun 2024 18:00:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sG6sL-0007nc-5o; Sat, 08 Jun 2024 20:57:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sG6sG-0007lJ-4q for qemu-devel@nongnu.org; Sat, 08 Jun 2024 20:57: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 1sG6sC-0003te-9Y for qemu-devel@nongnu.org; Sat, 08 Jun 2024 20:57:30 -0400 Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4590knpY015215; Sun, 9 Jun 2024 00:57:23 GMT Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3yme8rs9wt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 09 Jun 2024 00:57:23 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA01.qualcomm.com (8.17.1.19/8.17.1.19) with ESMTPS id 4590vLrr024413 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 9 Jun 2024 00:57:21 GMT Received: from hu-bcain-lv.qualcomm.com (10.49.16.6) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Sat, 8 Jun 2024 17:57:21 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= W0hv18PH1zmmBiXV+tTS7ii6GGPMv6F2fMonOX/sww4=; b=LhoXGF+B0RbBhz3C P+i1+UlaKfbyqdfn20wqVc102EeDvyn9yn7dtfKbfnkRkZDzMzIJpee8TCcZMdis DxCnPSKkkgO6cPARfZEEYGmYqnVmFRbWOw1IKvRftVjcMhZWwQCygcyUWbo3MFsX R4rYFZYYINHdaju5lVscBDPRmTrdUTVnFxMzexIlqy5G/LWlrZXg8gBODrZTwG+g +MGn9LuBwKm0xtIlRzY6QJ1sJ0LDCoMKuNuenDQERwFNN+jTsYa9IQZbTGi6LB+K xM6qxWS3bAcfUc54Njh9vBlQDWktx4qQ2OrPAN3Cu/ghdgq77Qcttvvl66W7fg19 2XrU+Q== From: Brian Cain To: CC: , , , , , , , , , , Subject: [PULL 5/6] target/hexagon: idef-parser fix leak of init_list Date: Sat, 8 Jun 2024 17:57:04 -0700 Message-ID: <20240609005705.2809037-6-bcain@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240609005705.2809037-1-bcain@quicinc.com> References: <20240609005705.2809037-1-bcain@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01a.na.qualcomm.com (10.47.209.196) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: vrSY73g2d8-8e49uHa_X2dqb4PO-7nhl X-Proofpoint-GUID: vrSY73g2d8-8e49uHa_X2dqb4PO-7nhl X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-08_16,2024-06-06_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 adultscore=0 suspectscore=0 bulkscore=0 phishscore=0 spamscore=0 lowpriorityscore=0 priorityscore=1501 mlxlogscore=832 impostorscore=0 mlxscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406090006 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.220.168.131; envelope-from=bcain@quicinc.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @quicinc.com) X-ZM-MESSAGEID: 1717894803074100003 From: Anton Johansson gen_inst_init_args() is called for instructions using a predicate as an rvalue. Upon first call, the list of arguments which might need initialization init_list is freed to indicate that they have been processed. For instructions without an rvalue predicate, gen_inst_init_args() isn't called and init_list will never be freed. Free init_list from free_instruction() if it hasn't already been freed. A comment in free_instruction is also updated. Signed-off-by: Anton Johansson Reviewed-by: Taylor Simpson Reviewed-by: Brian Cain Message-Id: <20240523125901.27797-4-anjo@rev.ng> Signed-off-by: Brian Cain --- target/hexagon/idef-parser/parser-helpers.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/target/hexagon/idef-parser/parser-helpers.c b/target/hexagon/i= def-parser/parser-helpers.c index 95f2b43076..c150c308be 100644 --- a/target/hexagon/idef-parser/parser-helpers.c +++ b/target/hexagon/idef-parser/parser-helpers.c @@ -2121,9 +2121,16 @@ void free_instruction(Context *c) g_string_free(g_array_index(c->inst.strings, GString*, i), TRUE); } g_array_free(c->inst.strings, TRUE); + /* + * Free list of arguments that might need initialization, if they have= n't + * already been freed. + */ + if (c->inst.init_list) { + g_array_free(c->inst.init_list, TRUE); + } /* Free INAME token value */ g_string_free(c->inst.name, TRUE); - /* Free variables and registers */ + /* Free declared TCGv variables */ g_array_free(c->inst.allocated, TRUE); /* Initialize instruction-specific portion of the context */ memset(&(c->inst), 0, sizeof(Inst)); --=20 2.25.1 From nobody Mon Nov 25 03:04:14 2024 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=none dis=none) header.from=quicinc.com ARC-Seal: i=1; a=rsa-sha256; t=1717894780; cv=none; d=zohomail.com; s=zohoarc; b=AAe4i3smZquT1ILlb35z52hxlP0yA22gVrc8SdjCjzp01Dspx4ugkrY4sG17Rh0qTdiU1RrUXd1IuCyKfftxTWTcGbTHiMkegUmYKDAbs72B0hFb6Zcl4zc8y8XX8Foe2MjnZGKYXUQxSq4VFfZgrOmQtGChia/kDrC+mmqzy6w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1717894780; 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=/hTHLZvz4KGUdCEfcRHQa8TgJ5Q7rjuwuSRnIqOb6gA=; b=CKARql09i+D7o8IJZ59G4iFnV2wp9lOQaKFC+xYeYFeA6wo8zMvZ+oTbNnSTxfBxu5IgBvgcmSK08Vb2SvOChuyjFWNL4CjPr1ZmISeLRBLOlSkTo75YK0HyGHQaITQu8ZTV/DQLxGw7ROhZk+vSahc/QUE/RI5aiGs1EF804C0= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1717894780300480.5642879601654; Sat, 8 Jun 2024 17:59:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sG6sH-0007mN-Iu; Sat, 08 Jun 2024 20:57:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sG6sG-0007lU-BG for qemu-devel@nongnu.org; Sat, 08 Jun 2024 20:57: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 1sG6sC-0003td-9j for qemu-devel@nongnu.org; Sat, 08 Jun 2024 20:57:30 -0400 Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 458N0TQ1006317; Sun, 9 Jun 2024 00:57:23 GMT Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3ymgfk14yr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 09 Jun 2024 00:57:22 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA01.qualcomm.com (8.17.1.19/8.17.1.19) with ESMTPS id 4590vLrs024413 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 9 Jun 2024 00:57:22 GMT Received: from hu-bcain-lv.qualcomm.com (10.49.16.6) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Sat, 8 Jun 2024 17:57:21 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= /hTHLZvz4KGUdCEfcRHQa8TgJ5Q7rjuwuSRnIqOb6gA=; b=HoAmb10DlPMCarxJ dCX51KCV7tcjb0lW7Mu7ifcZhuD/zc8+LdqeZXSb13UR72kVaFkls+cxMdns1eQA s7A44pzrP0+1D8xf/MMMDrmFJF1D1lEBCbpJe+dZfYkABSwDfCkxEhCl2pjos5P9 E+eaf07nAJ3AqcPxrfdO9bbFu7Hq9M3XWmS2o3EYzyGkE+WrYV88Tpls1YJ8sWk3 Ng3jKi6SYilv0TC2XNIzMIVxQnYDClFlnNsDHvhKO3W423wxscKFeFrccUCE93nC bwasqUU9/KqbKJnnqJznXsRDf8ynBCaeiY+lSYuAIEg8pAH/h5snPs/hiqHkv8fB bv4pfA== From: Brian Cain To: CC: , , , , , , , , , , Subject: [PULL 6/6] target/hexagon: idef-parser simplify predicate init Date: Sat, 8 Jun 2024 17:57:05 -0700 Message-ID: <20240609005705.2809037-7-bcain@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240609005705.2809037-1-bcain@quicinc.com> References: <20240609005705.2809037-1-bcain@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01a.na.qualcomm.com (10.47.209.196) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: GdiOYVNkpe8YoHmL5MW-oW94XVJEFROp X-Proofpoint-ORIG-GUID: GdiOYVNkpe8YoHmL5MW-oW94XVJEFROp X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-08_16,2024-06-06_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 clxscore=1015 priorityscore=1501 phishscore=0 adultscore=0 spamscore=0 malwarescore=0 mlxlogscore=729 suspectscore=0 impostorscore=0 bulkscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406090006 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.220.168.131; envelope-from=bcain@quicinc.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @quicinc.com) X-ZM-MESSAGEID: 1717894781018100001 From: Anton Johansson Only predicate instruction arguments need to be initialized by idef-parser. This commit removes registers from the init_list and simplifies gen_inst_init_args() slightly. Signed-off-by: Anton Johansson Reviewed-by: Taylor Simpson Reviewed-by: Brian Cain Message-Id: <20240523125901.27797-5-anjo@rev.ng> Signed-off-by: Brian Cain --- target/hexagon/idef-parser/idef-parser.y | 2 -- target/hexagon/idef-parser/parser-helpers.c | 26 +++++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/target/hexagon/idef-parser/idef-parser.y b/target/hexagon/idef= -parser/idef-parser.y index cd2612eb8c..9ffb9f9699 100644 --- a/target/hexagon/idef-parser/idef-parser.y +++ b/target/hexagon/idef-parser/idef-parser.y @@ -233,8 +233,6 @@ code : '{' statements '}' argument_decl : REG { emit_arg(c, &@1, &$1); - /* Enqueue register into initialization list */ - g_array_append_val(c->inst.init_list, $1); } | PRED { diff --git a/target/hexagon/idef-parser/parser-helpers.c b/target/hexagon/i= def-parser/parser-helpers.c index c150c308be..a7dcd85fe4 100644 --- a/target/hexagon/idef-parser/parser-helpers.c +++ b/target/hexagon/idef-parser/parser-helpers.c @@ -1652,26 +1652,28 @@ void gen_inst(Context *c, GString *iname) =20 =20 /* - * Initialize declared but uninitialized registers, but only for - * non-conditional instructions + * Initialize declared but uninitialized instruction arguments. Only neede= d for + * predicate arguments, initialization of registers is handled by the Hexa= gon + * frontend. */ void gen_inst_init_args(Context *c, YYLTYPE *locp) { + HexValue *val =3D NULL; + char suffix; + + /* If init_list is NULL arguments have already been initialized */ if (!c->inst.init_list) { return; } =20 for (unsigned i =3D 0; i < c->inst.init_list->len; i++) { - HexValue *val =3D &g_array_index(c->inst.init_list, HexValue, i); - if (val->type =3D=3D REGISTER_ARG) { - /* Nothing to do here */ - } else if (val->type =3D=3D PREDICATE) { - char suffix =3D val->is_dotnew ? 'N' : 'V'; - EMIT_HEAD(c, "tcg_gen_movi_i%u(P%c%c, 0);\n", val->bit_width, - val->pred.id, suffix); - } else { - yyassert(c, locp, false, "Invalid arg type!"); - } + val =3D &g_array_index(c->inst.init_list, HexValue, i); + suffix =3D val->is_dotnew ? 'N' : 'V'; + yyassert(c, locp, val->type =3D=3D PREDICATE, + "Only predicates need to be initialized!"); + yyassert(c, locp, val->bit_width =3D=3D 32, + "Predicates should always be 32 bits"); + EMIT_HEAD(c, "tcg_gen_movi_i32(P%c%c, 0);\n", val->pred.id, suffix= ); } =20 /* Free argument init list once we have initialized everything */ --=20 2.25.1