From nobody Sun May 5 04:04:05 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=quicinc.com ARC-Seal: i=1; a=rsa-sha256; t=1678167490; cv=none; d=zohomail.com; s=zohoarc; b=Z9bnqYwl0upd4fRZZ+j6w/JxbJvB3s5PGay05rZvENz413FEyMuCI1maMsekzBJ0/JM8gOspZvrC2Ec3sdnysuXx90BiVf9LywMLSIbypGa8y63h9XoiGZrmVk5sl9BDO6gVa6RF7XRIdtadgCfj9J+CtoWTaCDGOkF4vu3Ozyc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678167490; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=/EUUh6iT2GLxy/HWzOs1DxQweIHBP1gBOTxdltIXqSs=; b=jVHBiv7TUVPJxsHe7CTSSnwxB4Tp8djxKOkkN+cWvZMNnnt41YzYYxPCusFhr6jCqPuHnthuFV34WViEFXjWB39VRIFUA1fICkdhE6aOhnOW69lLRwg9CV3TdGY07Y3+i7hIEoRiL+vkv+wNl2RKA0SkZ9V4CThxFgWKeupE588= 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+importer2=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 1678167490091194.72806863927576; Mon, 6 Mar 2023 21:38:10 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZPyf-0006pD-Oj; Tue, 07 Mar 2023 00:35:09 -0500 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 1pZPyR-0006bP-Rm for qemu-devel@nongnu.org; Tue, 07 Mar 2023 00:34:56 -0500 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 1pZPyK-0006ZE-1T for qemu-devel@nongnu.org; Tue, 07 Mar 2023 00:34:54 -0500 Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3275DUeB006901; Tue, 7 Mar 2023 05:34:44 GMT Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3p417epx8q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Mar 2023 05:34:44 +0000 Received: from pps.filterd (NALASPPMTA01.qualcomm.com [127.0.0.1]) by NALASPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTP id 3275Yhlu000521; Tue, 7 Mar 2023 05:34:43 GMT Received: from pps.reinject (localhost [127.0.0.1]) by NALASPPMTA01.qualcomm.com (PPS) with ESMTPS id 3p4fhbm8nc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Mar 2023 05:34:43 +0000 Received: from NALASPPMTA01.qualcomm.com (NALASPPMTA01.qualcomm.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3275YhM1000506; Tue, 7 Mar 2023 05:34:43 GMT Received: from hu-devc-sd-u20-a-1.qualcomm.com (hu-tsimpson-lv.qualcomm.com [10.47.204.221]) by NALASPPMTA01.qualcomm.com (PPS) with ESMTPS id 3275YgDW000503 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Mar 2023 05:34:43 +0000 Received: by hu-devc-sd-u20-a-1.qualcomm.com (Postfix, from userid 47164) id 862383B2; Mon, 6 Mar 2023 21:34:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=qcppdkim1; bh=/EUUh6iT2GLxy/HWzOs1DxQweIHBP1gBOTxdltIXqSs=; b=mo9Woy8V5PkygNfWwPNRt5RI8/a+zYtz6az4dKOtTnFqPwHYVjLQnxqMf9Y83f+uvMR9 OGm+f2ZNA0DuAbP4hBI0ldXMBphxj8FvKiu+D775t/1YBIg8NVWAXucfIXGkmH7ZQUb0 EO+mjn/4XjpQcKQRJQz2L8TLy9JsPHavkgVZQEdTXBDAYSrlsTFPzcuHukw6Rr+NRQu2 C+h00PXrLje0msC9o/mU6BPhwa384FjMiqbYTlBWdjSAeSYe0+QcTlFrdAzdzi8vjtMN xD301XsgPZ7ApE27dId4mwMLEPxiOIsTgwE6hCb3tYadwFypSscUkh8Mk+bVeXkH2mfj 9Q== From: Taylor Simpson To: qemu-devel@nongnu.org Cc: tsimpson@quicinc.com, richard.henderson@linaro.org, philmd@linaro.org, peter.maydell@linaro.org, bcain@quicinc.com, quic_mathbern@quicinc.com, stefanha@redhat.com, ale@rev.ng, anjo@rev.ng Subject: [PULL 01/17] Hexagon (target/hexagon) Restore --disable-hexagon-idef-parser build Date: Mon, 6 Mar 2023 21:34:22 -0800 Message-Id: <20230307053438.2416629-2-tsimpson@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230307053438.2416629-1-tsimpson@quicinc.com> References: <20230307053438.2416629-1-tsimpson@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: NKBXWaldSbdo3vgjMBZfZmTe1W45rJIO X-Proofpoint-GUID: NKBXWaldSbdo3vgjMBZfZmTe1W45rJIO X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-06_14,2023-03-06_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 mlxscore=0 impostorscore=0 clxscore=1015 suspectscore=0 lowpriorityscore=0 phishscore=0 adultscore=0 malwarescore=0 priorityscore=1501 mlxlogscore=602 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303070050 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.220.168.131; envelope-from=tsimpson@qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @quicinc.com) X-ZM-MESSAGEID: 1678167491380100003 The --disable-hexagon-idef-parser configuration was broken by this patch 2feacf60c23ba6 (target/hexagon: Drop tcg_temp_free from C code) That config is not tested by CI Fix is simple: Mark a few TCGv variables as unused Signed-off-by: Taylor Simpson Reviewed-by: Anton Johansson Message-Id: <20230306172515.346813-1-tsimpson@quicinc.com> --- target/hexagon/gen_tcg.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/target/hexagon/gen_tcg.h b/target/hexagon/gen_tcg.h index b2e7880b5c..b1955a08f0 100644 --- a/target/hexagon/gen_tcg.h +++ b/target/hexagon/gen_tcg.h @@ -419,16 +419,16 @@ =20 #define fGEN_TCG_STORE(SHORTCODE) \ do { \ - TCGv HALF =3D tcg_temp_new(); \ - TCGv BYTE =3D tcg_temp_new(); \ + TCGv HALF G_GNUC_UNUSED =3D tcg_temp_new(); \ + TCGv BYTE G_GNUC_UNUSED =3D tcg_temp_new(); \ SHORTCODE; \ } while (0) =20 #define fGEN_TCG_STORE_pcr(SHIFT, STORE) \ do { \ TCGv ireg =3D tcg_temp_new(); \ - TCGv HALF =3D tcg_temp_new(); \ - TCGv BYTE =3D tcg_temp_new(); \ + TCGv HALF G_GNUC_UNUSED =3D tcg_temp_new(); \ + TCGv BYTE G_GNUC_UNUSED =3D tcg_temp_new(); \ tcg_gen_mov_tl(EA, RxV); \ gen_read_ireg(ireg, MuV, SHIFT); \ gen_helper_fcircadd(RxV, RxV, ireg, MuV, hex_gpr[HEX_REG_CS0 + MuN= ]); \ --=20 2.25.1 From nobody Sun May 5 04:04:05 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=quicinc.com ARC-Seal: i=1; a=rsa-sha256; t=1678167363; cv=none; d=zohomail.com; s=zohoarc; b=cRUvR9ZB0PmKr2VcwerfdDl/XNr+WF+2pn/ommaEURiCmYF80xMZhC78lfd3jweaTbvmac4/ENBiJKJQDWof+RHAzwIHkllYja81Jfk1WLcq0NZ96twniMR78ydSMWw93NKzwHENJiMwnOBB/0o8H0X6AoDahtGJO2xLhstqbS0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678167363; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=fXUO3+z//s0qOrHjzGePRFosSuJNgVAbZL4I/3MD2fc=; b=SAaPt5LX3Q1bcaC3Hd6AFehgSMcVHccjOpmT8/4XOEM4wZUWMWgcOfdrqaPCCCUGAFmk/6QOkYajQHDpvtfv7QH8VVvAf3/E/mf4XvCqbrzZKlW6QRR8Fe7WH+n+RF+pmEX7ZZUn7cxPqL92nO6U26hV1VYzgPZCUFxKYiFAa7Q= 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+importer2=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 1678167363871318.5567152139139; Mon, 6 Mar 2023 21:36:03 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZPyb-0006mg-HL; Tue, 07 Mar 2023 00:35:05 -0500 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 1pZPyL-0006X7-Vv for qemu-devel@nongnu.org; Tue, 07 Mar 2023 00:34:53 -0500 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 1pZPyJ-0006Yd-2Q for qemu-devel@nongnu.org; Tue, 07 Mar 2023 00:34:48 -0500 Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3274KPP7029385; Tue, 7 Mar 2023 05:34:45 GMT Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3p5x5c847r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Mar 2023 05:34:44 +0000 Received: from pps.filterd (NALASPPMTA04.qualcomm.com [127.0.0.1]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTP id 3275Yh22004489; Tue, 7 Mar 2023 05:34:43 GMT Received: from pps.reinject (localhost [127.0.0.1]) by NALASPPMTA04.qualcomm.com (PPS) with ESMTPS id 3p4few49ku-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Mar 2023 05:34:43 +0000 Received: from NALASPPMTA04.qualcomm.com (NALASPPMTA04.qualcomm.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3275Yhg6004479; Tue, 7 Mar 2023 05:34:43 GMT Received: from hu-devc-sd-u20-a-1.qualcomm.com (hu-tsimpson-lv.qualcomm.com [10.47.204.221]) by NALASPPMTA04.qualcomm.com (PPS) with ESMTPS id 3275YgIH004474 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Mar 2023 05:34:43 +0000 Received: by hu-devc-sd-u20-a-1.qualcomm.com (Postfix, from userid 47164) id 887F5687; Mon, 6 Mar 2023 21:34:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-type : content-transfer-encoding; s=qcppdkim1; bh=fXUO3+z//s0qOrHjzGePRFosSuJNgVAbZL4I/3MD2fc=; b=g3S5MdqAD6haPyxIfGKGlpjuKvjY1Yij5ltf4RgIoRN9wBRREP1fB+cqMSD9W1F2dNI7 xS2twd38VxUaOF++mOTrgt1+yMSHgpl/RlIZ3hP6VySFab+DNYqWcY0vnLrkA2hdrBMv RnlavAO/B1OWxHmTDluQDD8PO/AAS83/fX6atB+/cdXeMF/TDNRbwEojU0nKI2v+eDLd unGutRva0WPtRSI5IuRdekfifw3SRw12iXSIFcqupr3DDhgtWVTe5d0OJ8JqngsJOeXh Hviwjd1lqetBPueeI9Thl6YWa9cIb2D59bGU3ifJ6C2u7DNoyU9TO8iCJCMpbIIrSkpQ xA== From: Taylor Simpson To: qemu-devel@nongnu.org Cc: tsimpson@quicinc.com, richard.henderson@linaro.org, philmd@linaro.org, peter.maydell@linaro.org, bcain@quicinc.com, quic_mathbern@quicinc.com, stefanha@redhat.com, ale@rev.ng, anjo@rev.ng Subject: [PULL 02/17] target/hexagon/idef-parser: Elide mov in gen_pred_assign Date: Mon, 6 Mar 2023 21:34:23 -0800 Message-Id: <20230307053438.2416629-3-tsimpson@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230307053438.2416629-1-tsimpson@quicinc.com> References: <20230307053438.2416629-1-tsimpson@quicinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: V7BclWyuWEKh9_yryZF1CJ-Yjb_U6LOc X-Proofpoint-GUID: V7BclWyuWEKh9_yryZF1CJ-Yjb_U6LOc X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-06_14,2023-03-06_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 lowpriorityscore=0 priorityscore=1501 impostorscore=0 mlxlogscore=351 phishscore=0 suspectscore=0 clxscore=1015 adultscore=0 malwarescore=0 bulkscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303070049 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.220.180.131; envelope-from=tsimpson@qualcomm.com; helo=mx0b-0031df01.pphosted.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @quicinc.com) X-ZM-MESSAGEID: 1678167364632100001 Content-Type: text/plain; charset="utf-8" From: Richard Henderson Merge mov with andi. Suggested-by: Taylor Simpson Signed-off-by: Richard Henderson Signed-off-by: Taylor Simpson Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Taylor Simpson Message-Id: <20230306225724.2105263-1-richard.henderson@linaro.org> --- target/hexagon/idef-parser/parser-helpers.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/target/hexagon/idef-parser/parser-helpers.c b/target/hexagon/i= def-parser/parser-helpers.c index e1a55412c8..7b494c2f9e 100644 --- a/target/hexagon/idef-parser/parser-helpers.c +++ b/target/hexagon/idef-parser/parser-helpers.c @@ -1722,9 +1722,7 @@ void gen_pred_assign(Context *c, YYLTYPE *locp, HexVa= lue *left_pred, *left_pred =3D gen_tmp(c, locp, 32, UNSIGNED); } /* Extract first 8 bits, and store new predicate value */ - OUT(c, locp, "tcg_gen_mov_i32(", left_pred, ", ", &r, ");\n"); - OUT(c, locp, "tcg_gen_andi_i32(", left_pred, ", ", left_pred, - ", 0xff);\n"); + OUT(c, locp, "tcg_gen_andi_i32(", left_pred, ", ", &r, ", 0xff);\n"); if (is_direct) { OUT(c, locp, "gen_log_pred_write(ctx, ", pred_id, ", ", left_pred, ");\n"); --=20 2.25.1 From nobody Sun May 5 04:04:05 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=quicinc.com ARC-Seal: i=1; a=rsa-sha256; t=1678167435; cv=none; d=zohomail.com; s=zohoarc; b=njWff2HW20x/ZnHycPVME9C0mzgWlKlqVFVPJ8F9/F+vpSNWdb+HiYJZ98ADqtytgPq6bG3sq/xtYdQxe8sT7Z+jacKWxJpzkLTZZrt9mI7dv2CIo8NvxEHO+4kF42gUyID6IgETudt6f8o599l5gecirbPxJiyiad6+JqNReVA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678167435; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=GiCW+DLTtd2XkGE1lsYjYSz1SmmxnqnwAhb2J1p8748=; b=mmFl7bIWFrKErrGMJJxkWdWXhes7cFUAp5Ema0VJHO9+4wJLwgK8YO7UeNWoEn9VrK2MNLLJDsD0cwtrUzQDdC1tb+PAM2rPFshaJgXb91KdqhJM6bsFIFqvvVNj/kJxalbeVzXqpGnvoGZ7Y6qFWjL00aU3m9oDuBbRI5qUJ5Y= 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+importer2=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 1678167435839765.6589201047004; Mon, 6 Mar 2023 21:37:15 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZPyc-0006nn-GD; Tue, 07 Mar 2023 00:35:06 -0500 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 1pZPyO-0006XP-Dn for qemu-devel@nongnu.org; Tue, 07 Mar 2023 00:34:53 -0500 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 1pZPyJ-0006Yb-4V for qemu-devel@nongnu.org; Tue, 07 Mar 2023 00:34:52 -0500 Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3273W8mo009753; Tue, 7 Mar 2023 05:34:45 GMT Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3p5wee882w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Mar 2023 05:34:44 +0000 Received: from pps.filterd (NALASPPMTA05.qualcomm.com [127.0.0.1]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTP id 3275YhUb018566; Tue, 7 Mar 2023 05:34:43 GMT Received: from pps.reinject (localhost [127.0.0.1]) by NALASPPMTA05.qualcomm.com (PPS) with ESMTPS id 3p4ffd4g00-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Mar 2023 05:34:43 +0000 Received: from NALASPPMTA05.qualcomm.com (NALASPPMTA05.qualcomm.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3275YhVw018556; Tue, 7 Mar 2023 05:34:43 GMT Received: from hu-devc-sd-u20-a-1.qualcomm.com (hu-tsimpson-lv.qualcomm.com [10.47.204.221]) by NALASPPMTA05.qualcomm.com (PPS) with ESMTPS id 3275Yg3C018549 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Mar 2023 05:34:43 +0000 Received: by hu-devc-sd-u20-a-1.qualcomm.com (Postfix, from userid 47164) id 8B31268C; Mon, 6 Mar 2023 21:34:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=qcppdkim1; bh=GiCW+DLTtd2XkGE1lsYjYSz1SmmxnqnwAhb2J1p8748=; b=W/ye5abLnGoTQirh7kka3/rnlvN36PBKyoumkP/1jLRxiknozY4ah4O0Z91hCRqPX+Ey 3noakOuKJh28Q5UZQawXa1NHTgFGEsGX+O22JFHtNbf4jWBzzyASLsVBYbjINCJ7XXzJ jYkfRUy0l2h5FPSxRmWzKNuUF8stF6A+wjLbHP4W3PpIXb5jnaQ770ic+8+nTb8buyyW wseQrT8YI6sn7q2AZkxjdWWvYWlP1433jkha1FktZiL3IiMwf2y7pLY1WmR11AbuGLIc XWzcfXRmoHnglnlwdj3fD+CVfCG6Y7B+MEK+RlJK/rGS9/zElDGmuG+pydC93wgGfJ+7 Fg== From: Taylor Simpson To: qemu-devel@nongnu.org Cc: tsimpson@quicinc.com, richard.henderson@linaro.org, philmd@linaro.org, peter.maydell@linaro.org, bcain@quicinc.com, quic_mathbern@quicinc.com, stefanha@redhat.com, ale@rev.ng, anjo@rev.ng Subject: [PULL 03/17] target/hexagon/idef-parser: Remove unused code paths Date: Mon, 6 Mar 2023 21:34:24 -0800 Message-Id: <20230307053438.2416629-4-tsimpson@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230307053438.2416629-1-tsimpson@quicinc.com> References: <20230307053438.2416629-1-tsimpson@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: Gp4GLf7TmeWRckCEc-Qm1SgpHwli1RwD X-Proofpoint-ORIG-GUID: Gp4GLf7TmeWRckCEc-Qm1SgpHwli1RwD X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-06_14,2023-03-06_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 suspectscore=0 spamscore=0 lowpriorityscore=0 impostorscore=0 adultscore=0 mlxlogscore=648 priorityscore=1501 phishscore=0 clxscore=1015 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303070049 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.220.180.131; envelope-from=tsimpson@qualcomm.com; helo=mx0b-0031df01.pphosted.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @quicinc.com) X-ZM-MESSAGEID: 1678167437085100001 From: Anton Johansson Removes code paths used by COF instructions, which are no longer processed by idef-parser. Tested-by: Taylor Simpson Reviewed-by: Taylor Simpson Signed-off-by: Taylor Simpson Signed-off-by: Anton Johansson Message-Id: <20230131223133.8592-1-anjo@rev.ng> --- target/hexagon/idef-parser/idef-parser.h | 1 - target/hexagon/idef-parser/parser-helpers.c | 3 -- target/hexagon/idef-parser/idef-parser.lex | 27 +------------ target/hexagon/idef-parser/idef-parser.y | 44 +-------------------- target/hexagon/idef-parser/macros.inc | 9 ----- 5 files changed, 4 insertions(+), 80 deletions(-) diff --git a/target/hexagon/idef-parser/idef-parser.h b/target/hexagon/idef= -parser/idef-parser.h index 17d2ebfaf6..d23e71f13b 100644 --- a/target/hexagon/idef-parser/idef-parser.h +++ b/target/hexagon/idef-parser/idef-parser.h @@ -82,7 +82,6 @@ enum ImmUnionTag { VALUE, QEMU_TMP, IMM_PC, - IMM_NPC, IMM_CONSTEXT, }; =20 diff --git a/target/hexagon/idef-parser/parser-helpers.c b/target/hexagon/i= def-parser/parser-helpers.c index 7b494c2f9e..cc2cd000db 100644 --- a/target/hexagon/idef-parser/parser-helpers.c +++ b/target/hexagon/idef-parser/parser-helpers.c @@ -185,9 +185,6 @@ void imm_print(Context *c, YYLTYPE *locp, HexImm *imm) case IMM_PC: EMIT(c, "ctx->base.pc_next"); break; - case IMM_NPC: - EMIT(c, "ctx->npc"); - break; case IMM_CONSTEXT: EMIT(c, "insn->extension_valid"); break; diff --git a/target/hexagon/idef-parser/idef-parser.lex b/target/hexagon/id= ef-parser/idef-parser.lex index ff87a02c3a..2658d9fb2e 100644 --- a/target/hexagon/idef-parser/idef-parser.lex +++ b/target/hexagon/idef-parser/idef-parser.lex @@ -140,8 +140,6 @@ STRING_LIT \"(\\.|[^"\\])*\" yylval->rvalue.is_dotnew =3D true; yylval->rvalue.signedness =3D SIGNED; return PRED; } -"IV1DEAD()" | -"fPAUSE(uiV);" { return ';'; } "+=3D" { return INC; } "-=3D" { return DEC; } "++" { return PLUSPLUS; } @@ -159,9 +157,8 @@ STRING_LIT \"(\\.|[^"\\])*\" "else" { return ELSE; } "for" { return FOR; } "fREAD_IREG" { return ICIRC; } -"fPART1" { return PART1; } "if" { return IF; } -"fFRAME_SCRAMBLE" { return FSCR; } +"fFRAME_SCRAMBLE" | "fFRAME_UNSCRAMBLE" { return FSCR; } "fFRAMECHECK" { return FCHK; } "Constant_extended" { return CONSTEXT; } @@ -312,11 +309,7 @@ STRING_LIT \"(\\.|[^"\\])*\" "(unsigned int)" { yylval->cast.bit_width =3D 32; yylval->cast.signedness =3D UNSIGNED; return CAST; } -"fREAD_PC()" | -"PC" { return PC; } -"fREAD_NPC()" | -"NPC" { return NPC; } -"fGET_LPCFG" | +"fREAD_PC()" { return PC; } "USR.LPCFG" { return LPCFG; } "LOAD_CANCEL(EA)" { return LOAD_CANCEL; } "STORE_CANCEL(EA)" | @@ -360,14 +353,6 @@ STRING_LIT \"(\\.|[^"\\])*\" yylval->rvalue.bit_width =3D 32; yylval->rvalue.signedness =3D UNSIGNED; return REG; } -"fREAD_LC"[01] { yylval->rvalue.type =3D REGISTER; - yylval->rvalue.reg.type =3D CONTROL; - yylval->rvalue.reg.id =3D HEX_REG_LC0 - + (yytext[8] - '0') * 2; - yylval->rvalue.reg.bit_width =3D 32; - yylval->rvalue.bit_width =3D 32; - yylval->rvalue.signedness =3D UNSIGNED; - return REG; } "LC"[01] { yylval->rvalue.type =3D REGISTER; yylval->rvalue.reg.type =3D CONTROL; yylval->rvalue.reg.id =3D HEX_REG_LC0 @@ -376,14 +361,6 @@ STRING_LIT \"(\\.|[^"\\])*\" yylval->rvalue.bit_width =3D 32; yylval->rvalue.signedness =3D UNSIGNED; return REG; } -"fREAD_SA"[01] { yylval->rvalue.type =3D REGISTER; - yylval->rvalue.reg.type =3D CONTROL; - yylval->rvalue.reg.id =3D HEX_REG_SA0 - + (yytext[8] - '0') * 2; - yylval->rvalue.reg.bit_width =3D 32; - yylval->rvalue.bit_width =3D 32; - yylval->rvalue.signedness =3D UNSIGNED; - return REG; } "SA"[01] { yylval->rvalue.type =3D REGISTER; yylval->rvalue.reg.type =3D CONTROL; yylval->rvalue.reg.id =3D HEX_REG_SA0 diff --git a/target/hexagon/idef-parser/idef-parser.y b/target/hexagon/idef= -parser/idef-parser.y index c784726d41..d7b2199b74 100644 --- a/target/hexagon/idef-parser/idef-parser.y +++ b/target/hexagon/idef-parser/idef-parser.y @@ -52,8 +52,8 @@ %token IN INAME VAR %token ABS CROUND ROUND CIRCADD COUNTONES INC DEC ANDA ORA XORA PLUSPLUS A= SL %token ASR LSR EQ NEQ LTE GTE MIN MAX ANDL FOR ICIRC IF MUN FSCR FCHK SXT -%token ZXT CONSTEXT LOCNT BREV SIGN LOAD STORE PC NPC LPCFG -%token LOAD_CANCEL CANCEL IDENTITY PART1 ROTL INSBITS SETBITS EXTRANGE +%token ZXT CONSTEXT LOCNT BREV SIGN LOAD STORE PC LPCFG +%token LOAD_CANCEL CANCEL IDENTITY ROTL INSBITS SETBITS EXTRANGE %token CAST4_8U FAIL CARRY_FROM_ADD ADDSAT64 LSBNEW %token TYPE_SIZE_T TYPE_INT TYPE_SIGNED TYPE_UNSIGNED TYPE_LONG =20 @@ -336,15 +336,6 @@ assign_statement : lvalue '=3D' rvalue OUT(c, &@1, &$1, " =3D ", &$3, ";\n"); $$ =3D $1; } - | PC '=3D' rvalue - { - @1.last_column =3D @3.last_column; - yyassert(c, &@1, !is_inside_ternary(c), - "Assignment side-effect not modeled!"); - $3 =3D gen_rvalue_truncate(c, &@1, &$3); - $3 =3D rvalue_materialize(c, &@1, &$3); - OUT(c, &@1, "gen_write_new_pc(", &$3, ");\n"); - } | LOAD '(' IMM ',' IMM ',' SIGN ',' var ',' lvalue ')' { @1.last_column =3D @12.last_column; @@ -412,7 +403,6 @@ control_statement : frame_check | cancel_statement | if_statement | for_statement - | fpart1_statement ; =20 frame_check : FCHK '(' rvalue ',' rvalue ')' ';' @@ -462,17 +452,6 @@ for_statement : FOR '(' IMM '=3D' IMM ';' IMM '<' IMM = ';' IMM PLUSPLUS ')' } ; =20 -fpart1_statement : PART1 - { - OUT(c, &@1, "if (insn->part1) {\n"); - } - '(' statements ')' - { - @1.last_column =3D @3.last_column; - OUT(c, &@1, "return; }\n"); - } - ; - if_stmt : IF '(' rvalue ')' { @1.last_column =3D @3.last_column; @@ -512,20 +491,6 @@ rvalue : FAIL rvalue.signedness =3D UNSIGNED; $$ =3D rvalue; } - | NPC - { - /* - * NPC is only read from CALLs, so we can hardcode it - * at translation time - */ - HexValue rvalue; - memset(&rvalue, 0, sizeof(HexValue)); - rvalue.type =3D IMMEDIATE; - rvalue.imm.type =3D IMM_NPC; - rvalue.bit_width =3D 32; - rvalue.signedness =3D UNSIGNED; - $$ =3D rvalue; - } | CONSTEXT { HexValue rvalue; @@ -781,11 +746,6 @@ rvalue : FAIL /* Ones count */ $$ =3D gen_ctpop_op(c, &@1, &$3); } - | LPCFG - { - $$ =3D gen_tmp(c, &@1, 32, UNSIGNED); - OUT(c, &@1, "GET_USR_FIELD(USR_LPCFG, ", &$$, ");\n"); - } | EXTRACT '(' rvalue ',' rvalue ')' { @1.last_column =3D @6.last_column; diff --git a/target/hexagon/idef-parser/macros.inc b/target/hexagon/idef-pa= rser/macros.inc index 6b697da87a..7478d4db17 100644 --- a/target/hexagon/idef-parser/macros.inc +++ b/target/hexagon/idef-parser/macros.inc @@ -97,16 +97,8 @@ #define fWRITE_LR(A) (LR =3D A) #define fWRITE_FP(A) (FP =3D A) #define fWRITE_SP(A) (SP =3D A) -/* - * Note: There is a rule in the parser that matches `PC =3D ...` and emits - * a call to `gen_write_new_pc`. We need to call `gen_write_new_pc` to - * get the correct semantics when there are multiple stores in a packet. - */ -#define fBRANCH(LOC, TYPE) (PC =3D LOC) -#define fJUMPR(REGNO, TARGET, TYPE) (PC =3D TARGET) #define fWRITE_LOOP_REGS0(START, COUNT) SA0 =3D START; (LC0 =3D COUNT) #define fWRITE_LOOP_REGS1(START, COUNT) SA1 =3D START; (LC1 =3D COUNT) -#define fWRITE_LC0(VAL) (LC0 =3D VAL) #define fWRITE_LC1(VAL) (LC1 =3D VAL) #define fSET_LPCFG(VAL) (USR.LPCFG =3D VAL) #define fWRITE_P0(VAL) P0 =3D VAL; @@ -121,7 +113,6 @@ #define fEA_GPI(IMM) (EA =3D fREAD_GP() + IMM) #define fPM_I(REG, IMM) (REG =3D REG + IMM) #define fPM_M(REG, MVAL) (REG =3D REG + MVAL) -#define fWRITE_NPC(VAL) (PC =3D VAL) =20 /* Unary operators */ #define fROUND(A) (A + 0x8000) --=20 2.25.1 From nobody Sun May 5 04:04:05 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=quicinc.com ARC-Seal: i=1; a=rsa-sha256; t=1678167420; cv=none; d=zohomail.com; s=zohoarc; b=To3EhXNtqwzy8Sa7OqIo8ND9jiIKNU0mGke0vx7qrEwt3TkOs2nyyPoX7WsbOFEjHLoXQx3oSwFtyUknRcguXEaKCId0J8qNbcqumgpWgyZ/RXVPwjHYU6ex1CODiMVrzVB/C6n6LvyBvd0Au4HClwW0t9lQ37I8DufSZ9xEWSg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678167420; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=OczhKEgmX9QiOZFj8y6/ABcpVeMnAQsmZmWNEGEE/58=; b=BeILCT51LW8hd0Si+2ejXfkG8zbprJEF1KPIkrO9d1hKHgftKASI/9ViT3upkgwlV3E4cSlFuho3UZ7JEoEw9DMc656BtEwF67SLtDOaceytGegYYQGgDYfGZt1xI/DPGXrj9JASI2zVSMfL33sRjxNCCZZ+Fx+H3owDePbwpso= 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+importer2=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 1678167420644102.60133013736606; Mon, 6 Mar 2023 21:37:00 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZPyV-0006jc-KQ; Tue, 07 Mar 2023 00:34:59 -0500 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 1pZPyM-0006X9-01 for qemu-devel@nongnu.org; Tue, 07 Mar 2023 00:34:53 -0500 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 1pZPyJ-0006Yc-2V for qemu-devel@nongnu.org; Tue, 07 Mar 2023 00:34:48 -0500 Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32751N11001629; Tue, 7 Mar 2023 05:34:45 GMT Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3p5rqjru2s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Mar 2023 05:34:44 +0000 Received: from pps.filterd (NALASPPMTA05.qualcomm.com [127.0.0.1]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTP id 3275VOG8015277; Tue, 7 Mar 2023 05:34:43 GMT Received: from pps.reinject (localhost [127.0.0.1]) by NALASPPMTA05.qualcomm.com (PPS) with ESMTPS id 3p4ffd4fyy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Mar 2023 05:34:43 +0000 Received: from NALASPPMTA05.qualcomm.com (NALASPPMTA05.qualcomm.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3275Tv5f011040; Tue, 7 Mar 2023 05:34:43 GMT Received: from hu-devc-sd-u20-a-1.qualcomm.com (hu-tsimpson-lv.qualcomm.com [10.47.204.221]) by NALASPPMTA05.qualcomm.com (PPS) with ESMTPS id 3275YgFj018550 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Mar 2023 05:34:43 +0000 Received: by hu-devc-sd-u20-a-1.qualcomm.com (Postfix, from userid 47164) id 8DB1369B; Mon, 6 Mar 2023 21:34:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=qcppdkim1; bh=OczhKEgmX9QiOZFj8y6/ABcpVeMnAQsmZmWNEGEE/58=; b=Fb/louahiFqQ06OTrXz8C1ncDVBNipVPgKeRjBzHYFzaquo2do7ZANoNffwMo9W1iNyw dqXED3CQayx7HuY7CvBYRSyPFaLCLTFie6xBqIMgH21Np2DFGeDTsOkwxFOoFo71Gbac JIBZdyRaZCkPEqz4R91c6DJ8/IGAkqLlrSBCE4ZYbua0uc12+Xh//+X7IwCXyM7Zeua2 9sfVHuyzBqdUNua+eDczDMoK0/EzTp0kKbQyqOySt5IMGdk0WM2SyzWX8K+/SITanwyV 8P1qYt9Xm71L40zd8555wv2Jn8ijHPMsEuPitc7ME0W/DsObbv0FCQVC3BHnohXLALvm pA== From: Taylor Simpson To: qemu-devel@nongnu.org Cc: tsimpson@quicinc.com, richard.henderson@linaro.org, philmd@linaro.org, peter.maydell@linaro.org, bcain@quicinc.com, quic_mathbern@quicinc.com, stefanha@redhat.com, ale@rev.ng, anjo@rev.ng Subject: [PULL 04/17] Hexagon (target/hexagon) Add overrides for jumpr31 instructions Date: Mon, 6 Mar 2023 21:34:25 -0800 Message-Id: <20230307053438.2416629-5-tsimpson@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230307053438.2416629-1-tsimpson@quicinc.com> References: <20230307053438.2416629-1-tsimpson@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: gkAgrzXo9BrOam9K6KP6z387ddBWD38K X-Proofpoint-GUID: gkAgrzXo9BrOam9K6KP6z387ddBWD38K X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-06_14,2023-03-06_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 phishscore=0 priorityscore=1501 clxscore=1015 lowpriorityscore=0 adultscore=0 mlxscore=0 spamscore=0 suspectscore=0 bulkscore=0 impostorscore=0 mlxlogscore=511 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303070049 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.220.180.131; envelope-from=tsimpson@qualcomm.com; helo=mx0b-0031df01.pphosted.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @quicinc.com) X-ZM-MESSAGEID: 1678167420963100001 Add overrides for SL2_jumpr31 Unconditional SL2_jumpr31_t Predicated true (old value) SL2_jumpr31_f Predicated false (old value) SL2_jumpr31_tnew Predicated true (new value) SL2_jumpr31_fnew Predicated false (new value) Signed-off-by: Taylor Simpson Reviewed-by: Anton Johansson Message-Id: <20230307025828.1612809-2-tsimpson@quicinc.com> --- target/hexagon/gen_tcg.h | 15 ++++++++++++++- target/hexagon/genptr.c | 9 ++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/target/hexagon/gen_tcg.h b/target/hexagon/gen_tcg.h index b1955a08f0..f898f5b389 100644 --- a/target/hexagon/gen_tcg.h +++ b/target/hexagon/gen_tcg.h @@ -1,5 +1,5 @@ /* - * Copyright(c) 2019-2022 Qualcomm Innovation Center, Inc. All Rights Res= erved. + * Copyright(c) 2019-2023 Qualcomm Innovation Center, Inc. All Rights Res= erved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -986,6 +986,19 @@ #define fGEN_TCG_S2_asl_r_r_sat(SHORTCODE) \ gen_asl_r_r_sat(RdV, RsV, RtV) =20 +#define fGEN_TCG_SL2_jumpr31(SHORTCODE) \ + gen_jumpr(ctx, hex_gpr[HEX_REG_LR]) + +#define fGEN_TCG_SL2_jumpr31_t(SHORTCODE) \ + gen_cond_jumpr31(ctx, TCG_COND_EQ, hex_pred[0]) +#define fGEN_TCG_SL2_jumpr31_f(SHORTCODE) \ + gen_cond_jumpr31(ctx, TCG_COND_NE, hex_pred[0]) + +#define fGEN_TCG_SL2_jumpr31_tnew(SHORTCODE) \ + gen_cond_jumpr31(ctx, TCG_COND_EQ, hex_new_pred_value[0]) +#define fGEN_TCG_SL2_jumpr31_fnew(SHORTCODE) \ + gen_cond_jumpr31(ctx, TCG_COND_NE, hex_new_pred_value[0]) + /* Floating point */ #define fGEN_TCG_F2_conv_sf2df(SHORTCODE) \ gen_helper_conv_sf2df(RddV, cpu_env, RsV) diff --git a/target/hexagon/genptr.c b/target/hexagon/genptr.c index 86bd093ce8..2bbe4e3a68 100644 --- a/target/hexagon/genptr.c +++ b/target/hexagon/genptr.c @@ -1,5 +1,5 @@ /* - * Copyright(c) 2019-2022 Qualcomm Innovation Center, Inc. All Rights Res= erved. + * Copyright(c) 2019-2023 Qualcomm Innovation Center, Inc. All Rights Res= erved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -571,6 +571,13 @@ static void gen_cond_jumpr(DisasContext *ctx, TCGv dst= _pc, gen_write_new_pc_addr(ctx, dst_pc, cond, pred); } =20 +static void gen_cond_jumpr31(DisasContext *ctx, TCGCond cond, TCGv pred) +{ + TCGv LSB =3D tcg_temp_new(); + tcg_gen_andi_tl(LSB, pred, 1); + gen_cond_jumpr(ctx, hex_gpr[HEX_REG_LR], cond, LSB); +} + static void gen_cond_jump(DisasContext *ctx, TCGCond cond, TCGv pred, int pc_off) { --=20 2.25.1 From nobody Sun May 5 04:04:05 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=quicinc.com ARC-Seal: i=1; a=rsa-sha256; t=1678167338; cv=none; d=zohomail.com; s=zohoarc; b=WEjatB6PvVtWEuyoFSnxZN9PXxRkUrCmKtr3pw7xtKs+Ty2lcohlyvDXslZw0e4t6X+fm4dH3WZctnU76ipqSYcV3CJrAL4JKySs+C+i/cgUtmlrho8T1ZL4aAaihjfqDfX6X0yUpSKU4K6HfCpu8LuHtowTYEC3Iazt59jbLz0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678167338; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=3U/xW3K02J7kyq8YaaLnNzWV6Bah1FteImhb1uyq3Fc=; b=BM6fTeqJD7MlbmxMrHohvwCYKhKpqPFum77zpM3E8i+0zO0hqudsPWpeuYDGHtpKXsQGczNRCmhnO35pM8q/qatdpBYu1Cnxn9cTVsb20JTgoHEAysVa+RdUo9xIsMiVTcjc5KBUQfciIwbjFvZBMQqPIoa0omouUjv92RNI+yY= 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+importer2=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 1678167338254801.2053733375177; Mon, 6 Mar 2023 21:35:38 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZPyi-0006qa-B2; Tue, 07 Mar 2023 00:35:12 -0500 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 1pZPyR-0006bO-Qw for qemu-devel@nongnu.org; Tue, 07 Mar 2023 00:34:56 -0500 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 1pZPyL-0006Zm-Hk for qemu-devel@nongnu.org; Tue, 07 Mar 2023 00:34:54 -0500 Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3275B0tQ011833; Tue, 7 Mar 2023 05:34:47 GMT Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3p5usx0exx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Mar 2023 05:34:47 +0000 Received: from pps.filterd (NALASPPMTA03.qualcomm.com [127.0.0.1]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTP id 3275TVTL012156; Tue, 7 Mar 2023 05:34:45 GMT Received: from pps.reinject (localhost [127.0.0.1]) by NALASPPMTA03.qualcomm.com (PPS) with ESMTPS id 3p4fjsvd1e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Mar 2023 05:34:44 +0000 Received: from NALASPPMTA03.qualcomm.com (NALASPPMTA03.qualcomm.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3275TwNS012311; Tue, 7 Mar 2023 05:34:43 GMT Received: from hu-devc-sd-u20-a-1.qualcomm.com (hu-tsimpson-lv.qualcomm.com [10.47.204.221]) by NALASPPMTA03.qualcomm.com (PPS) with ESMTPS id 3275YhvZ020224 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Mar 2023 05:34:43 +0000 Received: by hu-devc-sd-u20-a-1.qualcomm.com (Postfix, from userid 47164) id 901846A6; Mon, 6 Mar 2023 21:34:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=qcppdkim1; bh=3U/xW3K02J7kyq8YaaLnNzWV6Bah1FteImhb1uyq3Fc=; b=QhL5Cmk4Io4wMxpRlmy/owXHtK+qPcCOKjKJcPBdI8pJm1QWwQF7aiXlorWmNFfo9RFM G9zH9tKMR/dEfflBOb9ZMSq6hbEQkl39FLot0AjXKKcQk2pY2M3or8OvgDG3IPX2Sv3L 8ecrW2AwdvIRdoGNuWdAmGjkDLZng60xc8U974P3REOeIX4P6OoO88hVp49Y7z+4bJ7z bxaB9BgkBCuOUdPpkubjw/HfPURXspGq32nfY9sCdaG2O0ArZHVD4/b+A21PpVE8MfUj 3/oLa8Rp3ZzR5zD7azkDPYA1rEp/yryPupLDlYozjraIgyy4kIFYoXU9MYHPGnOFKCqu KA== From: Taylor Simpson To: qemu-devel@nongnu.org Cc: tsimpson@quicinc.com, richard.henderson@linaro.org, philmd@linaro.org, peter.maydell@linaro.org, bcain@quicinc.com, quic_mathbern@quicinc.com, stefanha@redhat.com, ale@rev.ng, anjo@rev.ng Subject: [PULL 05/17] Hexagon (target/hexagon) Add overrides for callr Date: Mon, 6 Mar 2023 21:34:26 -0800 Message-Id: <20230307053438.2416629-6-tsimpson@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230307053438.2416629-1-tsimpson@quicinc.com> References: <20230307053438.2416629-1-tsimpson@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: jXtlOuTN9dLgI6JkL99YOCBDozK1dbfv X-Proofpoint-GUID: jXtlOuTN9dLgI6JkL99YOCBDozK1dbfv X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-06_14,2023-03-06_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 spamscore=0 clxscore=1015 priorityscore=1501 mlxscore=0 bulkscore=0 impostorscore=0 phishscore=0 adultscore=0 mlxlogscore=517 suspectscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303070049 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.220.180.131; envelope-from=tsimpson@qualcomm.com; helo=mx0b-0031df01.pphosted.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @quicinc.com) X-ZM-MESSAGEID: 1678167340506100007 Add overrides for J2_callr J2_callrt J2_callrf Signed-off-by: Taylor Simpson Reviewed-by: Anton Johansson Message-Id: <20230307025828.1612809-3-tsimpson@quicinc.com> --- target/hexagon/gen_tcg.h | 6 ++++++ target/hexagon/macros.h | 12 +----------- target/hexagon/genptr.c | 18 ++++++++++++++++++ 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/target/hexagon/gen_tcg.h b/target/hexagon/gen_tcg.h index f898f5b389..fb23d56d4a 100644 --- a/target/hexagon/gen_tcg.h +++ b/target/hexagon/gen_tcg.h @@ -589,11 +589,17 @@ =20 #define fGEN_TCG_J2_call(SHORTCODE) \ gen_call(ctx, riV) +#define fGEN_TCG_J2_callr(SHORTCODE) \ + gen_callr(ctx, RsV) =20 #define fGEN_TCG_J2_callt(SHORTCODE) \ gen_cond_call(ctx, PuV, TCG_COND_EQ, riV) #define fGEN_TCG_J2_callf(SHORTCODE) \ gen_cond_call(ctx, PuV, TCG_COND_NE, riV) +#define fGEN_TCG_J2_callrt(SHORTCODE) \ + gen_cond_callr(ctx, TCG_COND_EQ, PuV, RsV) +#define fGEN_TCG_J2_callrf(SHORTCODE) \ + gen_cond_callr(ctx, TCG_COND_NE, PuV, RsV) =20 #define fGEN_TCG_J2_endloop0(SHORTCODE) \ gen_endloop0(ctx) diff --git a/target/hexagon/macros.h b/target/hexagon/macros.h index 17facadaad..6974ef6c9e 100644 --- a/target/hexagon/macros.h +++ b/target/hexagon/macros.h @@ -1,5 +1,5 @@ /* - * Copyright(c) 2019-2022 Qualcomm Innovation Center, Inc. All Rights Res= erved. + * Copyright(c) 2019-2023 Qualcomm Innovation Center, Inc. All Rights Res= erved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -415,16 +415,6 @@ static inline TCGv gen_read_ireg(TCGv result, TCGv val= , int shift) #define fBRANCH(LOC, TYPE) fWRITE_NPC(LOC) #define fJUMPR(REGNO, TARGET, TYPE) fBRANCH(TARGET, COF_TYPE_JUMPR) #define fHINTJR(TARGET) { /* Not modelled in qemu */} -#define fCALL(A) \ - do { \ - fWRITE_LR(fREAD_NPC()); \ - fBRANCH(A, COF_TYPE_CALL); \ - } while (0) -#define fCALLR(A) \ - do { \ - fWRITE_LR(fREAD_NPC()); \ - fBRANCH(A, COF_TYPE_CALLR); \ - } while (0) #define fWRITE_LOOP_REGS0(START, COUNT) \ do { \ WRITE_RREG(HEX_REG_LC0, COUNT); \ diff --git a/target/hexagon/genptr.c b/target/hexagon/genptr.c index 2bbe4e3a68..592438f61e 100644 --- a/target/hexagon/genptr.c +++ b/target/hexagon/genptr.c @@ -682,6 +682,13 @@ static void gen_call(DisasContext *ctx, int pc_off) gen_write_new_pc_pcrel(ctx, pc_off, TCG_COND_ALWAYS, NULL); } =20 +static void gen_callr(DisasContext *ctx, TCGv new_pc) +{ + TCGv next_PC =3D tcg_constant_tl(ctx->next_PC); + gen_log_reg_write(HEX_REG_LR, next_PC); + gen_write_new_pc_addr(ctx, new_pc, TCG_COND_ALWAYS, NULL); +} + static void gen_cond_call(DisasContext *ctx, TCGv pred, TCGCond cond, int pc_off) { @@ -697,6 +704,17 @@ static void gen_cond_call(DisasContext *ctx, TCGv pred, gen_set_label(skip); } =20 +static void gen_cond_callr(DisasContext *ctx, + TCGCond cond, TCGv pred, TCGv new_pc) +{ + TCGv lsb =3D tcg_temp_new(); + TCGLabel *skip =3D gen_new_label(); + tcg_gen_andi_tl(lsb, pred, 1); + tcg_gen_brcondi_tl(cond, lsb, 0, skip); + gen_callr(ctx, new_pc); + gen_set_label(skip); +} + static void gen_endloop0(DisasContext *ctx) { TCGv lpcfg =3D tcg_temp_new(); --=20 2.25.1 From nobody Sun May 5 04:04:05 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=quicinc.com ARC-Seal: i=1; a=rsa-sha256; t=1678167458; cv=none; d=zohomail.com; s=zohoarc; b=Z5EZ7XjSUZSIDAvRMPXMbDqOHhn9Vzpk+aSeXVqN/zRqSMpgzLiHGq9Wf+9+D2QzhHK0akj2HZXjxPzcMFNKKralQmEzVugEHmtLLLPFTOh+sYsZX+4VDaW5f4JBlJj9umhZiwnpaHQJ8LZE7KaEt4OIPuhdDMA8TDPPA9cXTu8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678167458; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=48cMBzawn/IWTnsHw0eslJaVfMJmD6dZUGBz+USKKkU=; b=Tkl/m0zEkiiL3yqPirPWjP08k3Ym18i8KU/nDVcDaveYjI1K0LLZMqZ8LiPpV2cBrSGUAXo5Kt60hIA4hRFNaBauNGmNeuQpGxh/oSqfmd2zhGCFt4DqZvZo5nFkzkhbwTbF1qJciv1oJOb4OmyxGV2u2AIwR2N6aG4h1IDMImA= 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+importer2=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 1678167458804275.91617564820956; Mon, 6 Mar 2023 21:37:38 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZPyd-0006nr-Bd; Tue, 07 Mar 2023 00:35:07 -0500 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 1pZPyP-0006Xq-IA for qemu-devel@nongnu.org; Tue, 07 Mar 2023 00:34:53 -0500 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 1pZPyK-0006ZF-08 for qemu-devel@nongnu.org; Tue, 07 Mar 2023 00:34:53 -0500 Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3274HpZE006325; Tue, 7 Mar 2023 05:34:45 GMT Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3p5ukn0fv5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Mar 2023 05:34:45 +0000 Received: from pps.filterd (NALASPPMTA02.qualcomm.com [127.0.0.1]) by NALASPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTP id 3275Yi6K031927; Tue, 7 Mar 2023 05:34:44 GMT Received: from pps.reinject (localhost [127.0.0.1]) by NALASPPMTA02.qualcomm.com (PPS) with ESMTPS id 3p4fg0ca7k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Mar 2023 05:34:44 +0000 Received: from NALASPPMTA02.qualcomm.com (NALASPPMTA02.qualcomm.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3275YhUE031911; Tue, 7 Mar 2023 05:34:43 GMT Received: from hu-devc-sd-u20-a-1.qualcomm.com (hu-tsimpson-lv.qualcomm.com [10.47.204.221]) by NALASPPMTA02.qualcomm.com (PPS) with ESMTPS id 3275Yhq3031903 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Mar 2023 05:34:43 +0000 Received: by hu-devc-sd-u20-a-1.qualcomm.com (Postfix, from userid 47164) id 9295B6AB; Mon, 6 Mar 2023 21:34:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=qcppdkim1; bh=48cMBzawn/IWTnsHw0eslJaVfMJmD6dZUGBz+USKKkU=; b=P7kChcugb12/mNbPoU7U0PXv9XVchP6K/GI0pjEHJVIPaPTNR8pYV/e6hIJ0En2FPWjC mGGdMUJOwBL2Y29AylIBucw8us4iewWjSe264GCmbxS8a1+J6cDZDUYwl8gbUD/TFNso qmOu55QBBMnm2Xow50G7mqbEEl4Ix2UbhtLY5sLJG9Pu5IxMpOM0/f5UZBG2Qwhg0NaC l2f5YJAwRAkrGkpPFYo+CYh3KFqvmyNdEPBHi/TlzU+8UHzwbROj5pOzJO/acloqt2kF VqSH6wq9DObnyV9M2s+n0xFUsEqIsEqtOMS7IIrS+IREwp4N1lO5MLLxj+3jtdzLuPlx nA== From: Taylor Simpson To: qemu-devel@nongnu.org Cc: tsimpson@quicinc.com, richard.henderson@linaro.org, philmd@linaro.org, peter.maydell@linaro.org, bcain@quicinc.com, quic_mathbern@quicinc.com, stefanha@redhat.com, ale@rev.ng, anjo@rev.ng Subject: [PULL 06/17] Hexagon (target/hexagon) Add overrides for endloop1/endloop01 Date: Mon, 6 Mar 2023 21:34:27 -0800 Message-Id: <20230307053438.2416629-7-tsimpson@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230307053438.2416629-1-tsimpson@quicinc.com> References: <20230307053438.2416629-1-tsimpson@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: cyC1M6655rQZfW_VBdFLEPwxfoJzhLks X-Proofpoint-GUID: cyC1M6655rQZfW_VBdFLEPwxfoJzhLks X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-06_14,2023-03-06_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 mlxlogscore=559 spamscore=0 bulkscore=0 priorityscore=1501 suspectscore=0 phishscore=0 malwarescore=0 adultscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303070050 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.220.168.131; envelope-from=tsimpson@qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @quicinc.com) X-ZM-MESSAGEID: 1678167459345100001 Signed-off-by: Taylor Simpson Reviewed-by: Anton Johansson Message-Id: <20230307025828.1612809-4-tsimpson@quicinc.com> --- target/hexagon/gen_tcg.h | 4 +++ target/hexagon/genptr.c | 78 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+) diff --git a/target/hexagon/gen_tcg.h b/target/hexagon/gen_tcg.h index fb23d56d4a..5b7263a82c 100644 --- a/target/hexagon/gen_tcg.h +++ b/target/hexagon/gen_tcg.h @@ -603,6 +603,10 @@ =20 #define fGEN_TCG_J2_endloop0(SHORTCODE) \ gen_endloop0(ctx) +#define fGEN_TCG_J2_endloop1(SHORTCODE) \ + gen_endloop1(ctx) +#define fGEN_TCG_J2_endloop01(SHORTCODE) \ + gen_endloop01(ctx) =20 /* * Compound compare and jump instructions diff --git a/target/hexagon/genptr.c b/target/hexagon/genptr.c index 592438f61e..f7017fd483 100644 --- a/target/hexagon/genptr.c +++ b/target/hexagon/genptr.c @@ -770,6 +770,84 @@ static void gen_endloop0(DisasContext *ctx) } } =20 +static void gen_endloop1(DisasContext *ctx) +{ + /* + * if (hex_gpr[HEX_REG_LC1] > 1) { + * PC =3D hex_gpr[HEX_REG_SA1]; + * hex_new_value[HEX_REG_LC1] =3D hex_gpr[HEX_REG_LC1] - 1; + * } + */ + TCGLabel *label =3D gen_new_label(); + tcg_gen_brcondi_tl(TCG_COND_LEU, hex_gpr[HEX_REG_LC1], 1, label); + { + gen_jumpr(ctx, hex_gpr[HEX_REG_SA1]); + tcg_gen_subi_tl(hex_new_value[HEX_REG_LC1], hex_gpr[HEX_REG_LC1], = 1); + } + gen_set_label(label); +} + +static void gen_endloop01(DisasContext *ctx) +{ + TCGv lpcfg =3D tcg_temp_new(); + TCGLabel *label1 =3D gen_new_label(); + TCGLabel *label2 =3D gen_new_label(); + TCGLabel *label3 =3D gen_new_label(); + TCGLabel *done =3D gen_new_label(); + + GET_USR_FIELD(USR_LPCFG, lpcfg); + + /* + * if (lpcfg =3D=3D 1) { + * hex_new_pred_value[3] =3D 0xff; + * hex_pred_written |=3D 1 << 3; + * } + */ + tcg_gen_brcondi_tl(TCG_COND_NE, lpcfg, 1, label1); + { + tcg_gen_movi_tl(hex_new_pred_value[3], 0xff); + tcg_gen_ori_tl(hex_pred_written, hex_pred_written, 1 << 3); + } + gen_set_label(label1); + + /* + * if (lpcfg) { + * SET_USR_FIELD(USR_LPCFG, lpcfg - 1); + * } + */ + tcg_gen_brcondi_tl(TCG_COND_EQ, lpcfg, 0, label2); + { + tcg_gen_subi_tl(lpcfg, lpcfg, 1); + SET_USR_FIELD(USR_LPCFG, lpcfg); + } + gen_set_label(label2); + + /* + * if (hex_gpr[HEX_REG_LC0] > 1) { + * PC =3D hex_gpr[HEX_REG_SA0]; + * hex_new_value[HEX_REG_LC0] =3D hex_gpr[HEX_REG_LC0] - 1; + * } else { + * if (hex_gpr[HEX_REG_LC1] > 1) { + * hex_next_pc =3D hex_gpr[HEX_REG_SA1]; + * hex_new_value[HEX_REG_LC1] =3D hex_gpr[HEX_REG_LC1] - 1; + * } + * } + */ + tcg_gen_brcondi_tl(TCG_COND_LEU, hex_gpr[HEX_REG_LC0], 1, label3); + { + gen_jumpr(ctx, hex_gpr[HEX_REG_SA0]); + tcg_gen_subi_tl(hex_new_value[HEX_REG_LC0], hex_gpr[HEX_REG_LC0], = 1); + tcg_gen_br(done); + } + gen_set_label(label3); + tcg_gen_brcondi_tl(TCG_COND_LEU, hex_gpr[HEX_REG_LC1], 1, done); + { + gen_jumpr(ctx, hex_gpr[HEX_REG_SA1]); + tcg_gen_subi_tl(hex_new_value[HEX_REG_LC1], hex_gpr[HEX_REG_LC1], = 1); + } + gen_set_label(done); +} + static void gen_cmp_jumpnv(DisasContext *ctx, TCGCond cond, TCGv val, TCGv src, int pc_off) { --=20 2.25.1 From nobody Sun May 5 04:04:05 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=quicinc.com ARC-Seal: i=1; a=rsa-sha256; t=1678167451; cv=none; d=zohomail.com; s=zohoarc; b=Egwt3JXQ0l1uYBMAuvP+fVESll6jNW8O7tXgHcYJ03NRDErSAgtO+O6adtL+vylulpPv1VXMuxcw3AiVqSQl7SXQfGT/dV0ErCWhJh+oTxGwb0qanDI7w3iV+jHb23mcr0W8Almjeb9h3weQ4SvncV/e+v/lypi7tv89PfNeTTw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678167451; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=tnZ4jHG/0b//eTXVFEAY6JpIj/RBox6+k79qRj0D8OM=; b=mHBuV4N/RrVV2oVPHmr8SeWdIa1wzLpZiviKCEi3vqTgM4cA2xCPZv0gBzXq0DYzZ4JWh6KoM0SE/K8vhg5K19EWSFltVJqBxKYRo1oaeeaCW2pt7QM6ZLoJRww6Pp7hJ54v1Fehj7MYiBDSAXCt339tTNyRTtqXZXHhf+orbRU= 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+importer2=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 1678167451460674.66814930943; Mon, 6 Mar 2023 21:37:31 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZPye-0006oT-F5; Tue, 07 Mar 2023 00:35:08 -0500 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 1pZPyM-0006XD-NH for qemu-devel@nongnu.org; Tue, 07 Mar 2023 00:34:53 -0500 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 1pZPyJ-0006Yr-2C for qemu-devel@nongnu.org; Tue, 07 Mar 2023 00:34:49 -0500 Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3274Ktrs001082; Tue, 7 Mar 2023 05:34:45 GMT Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3p5rqjru2t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Mar 2023 05:34:45 +0000 Received: from pps.filterd (NALASPPMTA02.qualcomm.com [127.0.0.1]) by NALASPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTP id 3275Yi4d031930; Tue, 7 Mar 2023 05:34:44 GMT Received: from pps.reinject (localhost [127.0.0.1]) by NALASPPMTA02.qualcomm.com (PPS) with ESMTPS id 3p4fg0ca7m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Mar 2023 05:34:44 +0000 Received: from NALASPPMTA02.qualcomm.com (NALASPPMTA02.qualcomm.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3275YhXK031914; Tue, 7 Mar 2023 05:34:43 GMT Received: from hu-devc-sd-u20-a-1.qualcomm.com (hu-tsimpson-lv.qualcomm.com [10.47.204.221]) by NALASPPMTA02.qualcomm.com (PPS) with ESMTPS id 3275YhtJ031902 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Mar 2023 05:34:43 +0000 Received: by hu-devc-sd-u20-a-1.qualcomm.com (Postfix, from userid 47164) id 953F56AC; Mon, 6 Mar 2023 21:34:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=qcppdkim1; bh=tnZ4jHG/0b//eTXVFEAY6JpIj/RBox6+k79qRj0D8OM=; b=ZWmleaUmC2qC7nUmVDnikPQm2ayPzQLbAJSoeS/1Z/PipxynGgMRl5trLOWjOHEaCRPs v12ctOSnJ6UITCCj7ZWrZe2wiBERRFNUwyE9mCq7Ol5qH5dYHCnjwChrFWs+wy60WGMZ Ko0KUXH+MGjPYtjJL00t2Kegad0OTEINvydulGa43948Rmq8l/VBGfUA6OngpxwHi7zU X5gikPIRftAjFJwNynC/evKOXpltI+NAo9BzZY+fyfjeYEcF2+42AzkOsEK8Eg27WtOF cP5uV9IQB4RnJB2XD0yxDEINm0cyBy4w+mz8EvxVXP0L42kJ6P0pKo2BWDsrkanPlZhC sg== From: Taylor Simpson To: qemu-devel@nongnu.org Cc: tsimpson@quicinc.com, richard.henderson@linaro.org, philmd@linaro.org, peter.maydell@linaro.org, bcain@quicinc.com, quic_mathbern@quicinc.com, stefanha@redhat.com, ale@rev.ng, anjo@rev.ng Subject: [PULL 07/17] Hexagon (target/hexagon) Add overrides for dealloc-return instructions Date: Mon, 6 Mar 2023 21:34:28 -0800 Message-Id: <20230307053438.2416629-8-tsimpson@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230307053438.2416629-1-tsimpson@quicinc.com> References: <20230307053438.2416629-1-tsimpson@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: yvvRL4LVP9iK5zCPUJI0rES0x017ftLz X-Proofpoint-GUID: yvvRL4LVP9iK5zCPUJI0rES0x017ftLz X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-06_14,2023-03-06_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=26 malwarescore=0 phishscore=0 priorityscore=1501 clxscore=1015 lowpriorityscore=0 adultscore=0 mlxscore=26 spamscore=26 suspectscore=0 bulkscore=0 impostorscore=0 mlxlogscore=46 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303070049 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.220.180.131; envelope-from=tsimpson@qualcomm.com; helo=mx0b-0031df01.pphosted.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @quicinc.com) X-ZM-MESSAGEID: 1678167453269100007 These instructions perform a deallocframe+return (jumpr r31) Add overrides for L4_return SL2_return L4_return_t L4_return_f L4_return_tnew_pt L4_return_fnew_pt L4_return_tnew_pnt L4_return_fnew_pnt SL2_return_t SL2_return_f SL2_return_tnew SL2_return_fnew This patch eliminates the last helper that uses write_new_pc, so we remove it from op_helper.c Signed-off-by: Taylor Simpson Reviewed-by: Anton Johansson Message-Id: <20230307025828.1612809-5-tsimpson@quicinc.com> --- target/hexagon/gen_tcg.h | 53 ++++++++++++++++++++++++++ target/hexagon/genptr.c | 77 ++++++++++++++++++++++++++++++++++++++ target/hexagon/op_helper.c | 26 +------------ 3 files changed, 131 insertions(+), 25 deletions(-) diff --git a/target/hexagon/gen_tcg.h b/target/hexagon/gen_tcg.h index 5b7263a82c..e72672e198 100644 --- a/target/hexagon/gen_tcg.h +++ b/target/hexagon/gen_tcg.h @@ -491,6 +491,59 @@ #define fGEN_TCG_S2_storerinew_pcr(SHORTCODE) \ fGEN_TCG_STORE_pcr(2, fSTORE(1, 4, EA, NtN)) =20 +/* + * dealloc_return + * Assembler mapped to + * r31:30 =3D dealloc_return(r30):raw + */ +#define fGEN_TCG_L4_return(SHORTCODE) \ + gen_return(ctx, RddV, RsV) + +/* + * sub-instruction version (no RddV, so handle it manually) + */ +#define fGEN_TCG_SL2_return(SHORTCODE) \ + do { \ + TCGv_i64 RddV =3D tcg_temp_new_i64(); \ + gen_return(ctx, RddV, hex_gpr[HEX_REG_FP]); \ + gen_log_reg_write_pair(HEX_REG_FP, RddV); \ + } while (0) + +/* + * Conditional returns follow this naming convention + * _t predicate true + * _f predicate false + * _tnew_pt predicate.new true predict taken + * _fnew_pt predicate.new false predict taken + * _tnew_pnt predicate.new true predict not taken + * _fnew_pnt predicate.new false predict not taken + * Predictions are not modelled in QEMU + * + * Example: + * if (p1) r31:30 =3D dealloc_return(r30):raw + */ +#define fGEN_TCG_L4_return_t(SHORTCODE) \ + gen_cond_return(ctx, RddV, RsV, PvV, TCG_COND_EQ); +#define fGEN_TCG_L4_return_f(SHORTCODE) \ + gen_cond_return(ctx, RddV, RsV, PvV, TCG_COND_NE) +#define fGEN_TCG_L4_return_tnew_pt(SHORTCODE) \ + gen_cond_return(ctx, RddV, RsV, PvN, TCG_COND_EQ) +#define fGEN_TCG_L4_return_fnew_pt(SHORTCODE) \ + gen_cond_return(ctx, RddV, RsV, PvN, TCG_COND_NE) +#define fGEN_TCG_L4_return_tnew_pnt(SHORTCODE) \ + gen_cond_return(ctx, RddV, RsV, PvN, TCG_COND_EQ) +#define fGEN_TCG_L4_return_fnew_pnt(SHORTCODE) \ + gen_cond_return(ctx, RddV, RsV, PvN, TCG_COND_NE) + +#define fGEN_TCG_SL2_return_t(SHORTCODE) \ + gen_cond_return_subinsn(ctx, TCG_COND_EQ, hex_pred[0]) +#define fGEN_TCG_SL2_return_f(SHORTCODE) \ + gen_cond_return_subinsn(ctx, TCG_COND_NE, hex_pred[0]) +#define fGEN_TCG_SL2_return_tnew(SHORTCODE) \ + gen_cond_return_subinsn(ctx, TCG_COND_EQ, hex_new_pred_value[0]) +#define fGEN_TCG_SL2_return_fnew(SHORTCODE) \ + gen_cond_return_subinsn(ctx, TCG_COND_NE, hex_new_pred_value[0]) + /* * Mathematical operations with more than one definition require * special handling diff --git a/target/hexagon/genptr.c b/target/hexagon/genptr.c index f7017fd483..3490310812 100644 --- a/target/hexagon/genptr.c +++ b/target/hexagon/genptr.c @@ -715,6 +715,83 @@ static void gen_cond_callr(DisasContext *ctx, gen_set_label(skip); } =20 +/* frame ^=3D (int64_t)FRAMEKEY << 32 */ +static void gen_frame_unscramble(TCGv_i64 frame) +{ + TCGv_i64 framekey =3D tcg_temp_new_i64(); + tcg_gen_extu_i32_i64(framekey, hex_gpr[HEX_REG_FRAMEKEY]); + tcg_gen_shli_i64(framekey, framekey, 32); + tcg_gen_xor_i64(frame, frame, framekey); +} + +static void gen_load_frame(DisasContext *ctx, TCGv_i64 frame, TCGv EA) +{ + Insn *insn =3D ctx->insn; /* Needed for CHECK_NOSHUF */ + CHECK_NOSHUF(EA, 8); + tcg_gen_qemu_ld64(frame, EA, ctx->mem_idx); +} + +static void gen_return_base(DisasContext *ctx, TCGv_i64 dst, TCGv src, + TCGv r29) +{ + /* + * frame =3D *src + * dst =3D frame_unscramble(frame) + * SP =3D src + 8 + * PC =3D dst.w[1] + */ + TCGv_i64 frame =3D tcg_temp_new_i64(); + TCGv r31 =3D tcg_temp_new(); + + gen_load_frame(ctx, frame, src); + gen_frame_unscramble(frame); + tcg_gen_mov_i64(dst, frame); + tcg_gen_addi_tl(r29, src, 8); + tcg_gen_extrh_i64_i32(r31, dst); + gen_jumpr(ctx, r31); +} + +static void gen_return(DisasContext *ctx, TCGv_i64 dst, TCGv src) +{ + TCGv r29 =3D tcg_temp_new(); + gen_return_base(ctx, dst, src, r29); + gen_log_reg_write(HEX_REG_SP, r29); +} + +/* if (pred) dst =3D dealloc_return(src):raw */ +static void gen_cond_return(DisasContext *ctx, TCGv_i64 dst, TCGv src, + TCGv pred, TCGCond cond) +{ + TCGv LSB =3D tcg_temp_new(); + TCGv mask =3D tcg_temp_new(); + TCGv r29 =3D tcg_temp_new(); + TCGLabel *skip =3D gen_new_label(); + tcg_gen_andi_tl(LSB, pred, 1); + + /* Initialize the results in case the predicate is false */ + tcg_gen_movi_i64(dst, 0); + tcg_gen_movi_tl(r29, 0); + + /* Set the bit in hex_slot_cancelled if the predicate is flase */ + tcg_gen_movi_tl(mask, 1 << ctx->insn->slot); + tcg_gen_or_tl(mask, hex_slot_cancelled, mask); + tcg_gen_movcond_tl(cond, hex_slot_cancelled, LSB, tcg_constant_tl(0), + mask, hex_slot_cancelled); + + tcg_gen_brcondi_tl(cond, LSB, 0, skip); + gen_return_base(ctx, dst, src, r29); + gen_set_label(skip); + gen_log_predicated_reg_write(HEX_REG_SP, r29, ctx->insn->slot); +} + +/* sub-instruction version (no RddV, so handle it manually) */ +static void gen_cond_return_subinsn(DisasContext *ctx, TCGCond cond, TCGv = pred) +{ + TCGv_i64 RddV =3D tcg_temp_new_i64(); + gen_cond_return(ctx, RddV, hex_gpr[HEX_REG_FP], pred, cond); + gen_log_predicated_reg_write_pair(HEX_REG_FP, RddV, ctx->insn->slot); +} + static void gen_endloop0(DisasContext *ctx) { TCGv lpcfg =3D tcg_temp_new(); diff --git a/target/hexagon/op_helper.c b/target/hexagon/op_helper.c index 35449ef524..38b8aee193 100644 --- a/target/hexagon/op_helper.c +++ b/target/hexagon/op_helper.c @@ -1,5 +1,5 @@ /* - * Copyright(c) 2019-2022 Qualcomm Innovation Center, Inc. All Rights Res= erved. + * Copyright(c) 2019-2023 Qualcomm Innovation Center, Inc. All Rights Res= erved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -105,30 +105,6 @@ void log_store64(CPUHexagonState *env, target_ulong ad= dr, env->mem_log_stores[slot].data64 =3D val; } =20 -void write_new_pc(CPUHexagonState *env, bool pkt_has_multi_cof, - target_ulong addr) -{ - HEX_DEBUG_LOG("write_new_pc(0x" TARGET_FMT_lx ")\n", addr); - - if (pkt_has_multi_cof) { - /* - * If more than one branch is taken in a packet, only the first one - * is actually done. - */ - if (env->branch_taken) { - HEX_DEBUG_LOG("INFO: multiple branches taken in same packet, " - "ignoring the second one\n"); - } else { - fCHECK_PCALIGN(addr); - env->gpr[HEX_REG_PC] =3D addr; - env->branch_taken =3D 1; - } - } else { - fCHECK_PCALIGN(addr); - env->gpr[HEX_REG_PC] =3D addr; - } -} - /* Handy place to set a breakpoint */ void HELPER(debug_start_packet)(CPUHexagonState *env) { --=20 2.25.1 From nobody Sun May 5 04:04:05 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=quicinc.com ARC-Seal: i=1; a=rsa-sha256; t=1678167453; cv=none; d=zohomail.com; s=zohoarc; b=MjtyZwM+Yn5e2zMmu7QK+hZdZcxPx2qyNrt1Fl101rPNkC/UClieBEqaHKA5FSgkn5XoIafjQJcFdxkf3EAdJKmIHqbzEwDWHdXR2T9mZdKhwh0CdbuO4vZBpwNkHzK7LZTz6PrF0h8LQvZLnGVM71igum17SVfXkhKHT1k9KlA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678167453; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=WnUL8CAWCcrIgS9mAFBn0GJef1liHH6Ay4MgRBf1FHk=; b=RWTf9Cj393W3jCdPYFxlSlfRjBZb9Tv5940zlcWr3eq8Vmz06cqgXMJ/DCePEALXVf70y345l+Y7/SfBLhmxvbIn7g+34WUQ7WzGfnGcItsm+EXokxjfAisdOlL75o9Arv+CsnmN8AuOIbKxzSov4h4lsWuaTPHvcd8nWMI0FXk= 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+importer2=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 1678167453087537.0982943397145; Mon, 6 Mar 2023 21:37:33 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZPyl-0006sZ-Rr; Tue, 07 Mar 2023 00:35:15 -0500 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 1pZPyR-0006bV-T6 for qemu-devel@nongnu.org; Tue, 07 Mar 2023 00:34:56 -0500 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 1pZPyJ-0006ZD-Vp for qemu-devel@nongnu.org; Tue, 07 Mar 2023 00:34:54 -0500 Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3275DNn8005143; Tue, 7 Mar 2023 05:34:45 GMT Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3p418771sw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Mar 2023 05:34:45 +0000 Received: from pps.filterd (NALASPPMTA03.qualcomm.com [127.0.0.1]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTP id 3275Yile020259; Tue, 7 Mar 2023 05:34:44 GMT Received: from pps.reinject (localhost [127.0.0.1]) by NALASPPMTA03.qualcomm.com (PPS) with ESMTPS id 3p4fjsvd1d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Mar 2023 05:34:44 +0000 Received: from NALASPPMTA03.qualcomm.com (NALASPPMTA03.qualcomm.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3275YhiZ020230; Tue, 7 Mar 2023 05:34:43 GMT Received: from hu-devc-sd-u20-a-1.qualcomm.com (hu-tsimpson-lv.qualcomm.com [10.47.204.221]) by NALASPPMTA03.qualcomm.com (PPS) with ESMTPS id 3275YhWE020225 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Mar 2023 05:34:43 +0000 Received: by hu-devc-sd-u20-a-1.qualcomm.com (Postfix, from userid 47164) id 97BD76AD; Mon, 6 Mar 2023 21:34:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=qcppdkim1; bh=WnUL8CAWCcrIgS9mAFBn0GJef1liHH6Ay4MgRBf1FHk=; b=VsSl/TTspQLj5dp8ELoNYRGr9Ruj6D9A5ycQie6kqHQ/AKV41UvOSsq449983SL8X62T j/KXBDzFeOwGNBfTBargMOc26NNeISkH0zo3oTirIY7St8AieNrPU2miM0/H/IYOHXXT QKrWpr/iGlEnvwM7jhzhDVM6ECOX+MlmJ5fc61nSqNiAZ9tYN6VdTvX4j4kLi/Xe1U/4 iEsgf0nzIb7Tx4g8DdJGg+NZ42nMEv6ACW/OH8sZSP0/JjEoiG1ErV3q1Li5zqZFcmRK VuSjC0jzdTCOUSxMZjAKm4v9h4GaxF4+dD7bhgRSJonKQB/3ObyJJf8SN8LeAIK/xEaZ 6w== From: Taylor Simpson To: qemu-devel@nongnu.org Cc: tsimpson@quicinc.com, richard.henderson@linaro.org, philmd@linaro.org, peter.maydell@linaro.org, bcain@quicinc.com, quic_mathbern@quicinc.com, stefanha@redhat.com, ale@rev.ng, anjo@rev.ng Subject: [PULL 08/17] Hexagon (target/hexagon) Analyze packet before generating TCG Date: Mon, 6 Mar 2023 21:34:29 -0800 Message-Id: <20230307053438.2416629-9-tsimpson@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230307053438.2416629-1-tsimpson@quicinc.com> References: <20230307053438.2416629-1-tsimpson@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: VWByU_0jwwD9DJ0nYUHbP-Ujp3B_agLe X-Proofpoint-ORIG-GUID: VWByU_0jwwD9DJ0nYUHbP-Ujp3B_agLe X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-06_14,2023-03-06_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 adultscore=0 priorityscore=1501 mlxscore=0 phishscore=0 lowpriorityscore=0 malwarescore=0 mlxlogscore=654 bulkscore=0 suspectscore=0 spamscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303070050 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.220.168.131; envelope-from=tsimpson@qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @quicinc.com) X-ZM-MESSAGEID: 1678167455319100011 We create a new generator that creates an analyze_ function for each instruction. Currently, these functions record the writes to R, P, and C registers by calling ctx_log_reg_write[_pair] or ctx_log_pred_write. During gen_start_packet, we invoke the analyze_ function for each instruction in the packet, and we mark the implicit register and predicate writes. Doing the analysis up front has several advantages - We remove calls to ctx_log_* from gen_tcg_funcs.py and genptr.c - After the analysis is performed, we can initialize hex_new_value for each of the predicated assignments rather than during TCG generation for the instructions - This is a stepping stone for future work where the analysis will include the set of registers that are read. In cases where the packet doesn't have an overlap between the registers that are written and registers that are read, we can avoid the intermediate step of writing to hex_new_value. Note that other checks will also be needed (e.g., no instructions can raise an exception). Signed-off-by: Taylor Simpson Reviewed-by: Anton Johansson Message-Id: <20230307025828.1612809-6-tsimpson@quicinc.com> --- target/hexagon/translate.h | 46 ++-- target/hexagon/genptr.c | 5 +- target/hexagon/idef-parser/parser-helpers.c | 7 +- target/hexagon/translate.c | 162 +++++++------ target/hexagon/README | 10 +- target/hexagon/gen_analyze_funcs.py | 237 ++++++++++++++++++++ target/hexagon/gen_tcg_funcs.py | 23 +- target/hexagon/meson.build | 11 +- 8 files changed, 383 insertions(+), 118 deletions(-) create mode 100755 target/hexagon/gen_analyze_funcs.py diff --git a/target/hexagon/translate.h b/target/hexagon/translate.h index d971f4f095..d45d3a4bb0 100644 --- a/target/hexagon/translate.h +++ b/target/hexagon/translate.h @@ -1,5 +1,5 @@ /* - * Copyright(c) 2019-2022 Qualcomm Innovation Center, Inc. All Rights Res= erved. + * Copyright(c) 2019-2023 Qualcomm Innovation Center, Inc. All Rights Res= erved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -38,6 +38,7 @@ typedef struct DisasContext { int reg_log[REG_WRITES_MAX]; int reg_log_idx; DECLARE_BITMAP(regs_written, TOTAL_PER_THREAD_REGS); + DECLARE_BITMAP(predicated_regs, TOTAL_PER_THREAD_REGS); int preg_log[PRED_WRITES_MAX]; int preg_log_idx; DECLARE_BITMAP(pregs_written, NUM_PREGS); @@ -62,32 +63,39 @@ typedef struct DisasContext { bool is_tight_loop; } DisasContext; =20 -static inline void ctx_log_reg_write(DisasContext *ctx, int rnum) +static inline void ctx_log_pred_write(DisasContext *ctx, int pnum) { - if (test_bit(rnum, ctx->regs_written)) { - HEX_DEBUG_LOG("WARNING: Multiple writes to r%d\n", rnum); + if (!test_bit(pnum, ctx->pregs_written)) { + ctx->preg_log[ctx->preg_log_idx] =3D pnum; + ctx->preg_log_idx++; + set_bit(pnum, ctx->pregs_written); } - ctx->reg_log[ctx->reg_log_idx] =3D rnum; - ctx->reg_log_idx++; - set_bit(rnum, ctx->regs_written); -} - -static inline void ctx_log_reg_write_pair(DisasContext *ctx, int rnum) -{ - ctx_log_reg_write(ctx, rnum); - ctx_log_reg_write(ctx, rnum + 1); } =20 -static inline void ctx_log_pred_write(DisasContext *ctx, int pnum) +static inline void ctx_log_reg_write(DisasContext *ctx, int rnum, + bool is_predicated) { - ctx->preg_log[ctx->preg_log_idx] =3D pnum; - ctx->preg_log_idx++; - set_bit(pnum, ctx->pregs_written); + if (rnum =3D=3D HEX_REG_P3_0_ALIASED) { + for (int i =3D 0; i < NUM_PREGS; i++) { + ctx_log_pred_write(ctx, i); + } + } else { + if (!test_bit(rnum, ctx->regs_written)) { + ctx->reg_log[ctx->reg_log_idx] =3D rnum; + ctx->reg_log_idx++; + set_bit(rnum, ctx->regs_written); + } + if (is_predicated) { + set_bit(rnum, ctx->predicated_regs); + } + } } =20 -static inline bool is_preloaded(DisasContext *ctx, int num) +static inline void ctx_log_reg_write_pair(DisasContext *ctx, int rnum, + bool is_predicated) { - return test_bit(num, ctx->regs_written); + ctx_log_reg_write(ctx, rnum, is_predicated); + ctx_log_reg_write(ctx, rnum + 1, is_predicated); } =20 static inline bool is_vreg_preloaded(DisasContext *ctx, int num) diff --git a/target/hexagon/genptr.c b/target/hexagon/genptr.c index 3490310812..61ab9af9e4 100644 --- a/target/hexagon/genptr.c +++ b/target/hexagon/genptr.c @@ -180,6 +180,7 @@ void gen_log_pred_write(DisasContext *ctx, int pnum, TC= Gv val) hex_new_pred_value[pnum], base_val); } tcg_gen_ori_tl(hex_pred_written, hex_pred_written, 1 << pnum); + set_bit(pnum, ctx->pregs_written); } =20 static inline void gen_read_p3_0(TCGv control_reg) @@ -256,7 +257,6 @@ static void gen_write_p3_0(DisasContext *ctx, TCGv cont= rol_reg) for (int i =3D 0; i < NUM_PREGS; i++) { tcg_gen_extract_tl(hex_p8, control_reg, i * 8, 8); gen_log_pred_write(ctx, i, hex_p8); - ctx_log_pred_write(ctx, i); } } =20 @@ -274,7 +274,6 @@ static inline void gen_write_ctrl_reg(DisasContext *ctx= , int reg_num, gen_write_p3_0(ctx, val); } else { gen_log_reg_write(reg_num, val); - ctx_log_reg_write(ctx, reg_num); if (reg_num =3D=3D HEX_REG_QEMU_PKT_CNT) { ctx->num_packets =3D 0; } @@ -296,10 +295,8 @@ static inline void gen_write_ctrl_reg_pair(DisasContex= t *ctx, int reg_num, gen_write_p3_0(ctx, val32); tcg_gen_extrh_i64_i32(val32, val); gen_log_reg_write(reg_num + 1, val32); - ctx_log_reg_write(ctx, reg_num + 1); } else { gen_log_reg_write_pair(reg_num, val); - ctx_log_reg_write_pair(ctx, reg_num); if (reg_num =3D=3D HEX_REG_QEMU_PKT_CNT) { ctx->num_packets =3D 0; ctx->num_insns =3D 0; diff --git a/target/hexagon/idef-parser/parser-helpers.c b/target/hexagon/i= def-parser/parser-helpers.c index cc2cd000db..4e0c643cae 100644 --- a/target/hexagon/idef-parser/parser-helpers.c +++ b/target/hexagon/idef-parser/parser-helpers.c @@ -1,5 +1,5 @@ /* - * Copyright(c) 2019-2022 rev.ng Labs Srl. All Rights Reserved. + * Copyright(c) 2019-2023 rev.ng Labs Srl. All Rights Reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1320,10 +1320,6 @@ void gen_write_reg(Context *c, YYLTYPE *locp, HexVal= ue *reg, HexValue *value) locp, "gen_log_reg_write(", ®->reg.id, ", ", &value_m, ");\n"); - OUT(c, - locp, - "ctx_log_reg_write(ctx, ", ®->reg.id, - ");\n"); } =20 void gen_assign(Context *c, @@ -1723,7 +1719,6 @@ void gen_pred_assign(Context *c, YYLTYPE *locp, HexVa= lue *left_pred, if (is_direct) { OUT(c, locp, "gen_log_pred_write(ctx, ", pred_id, ", ", left_pred, ");\n"); - OUT(c, locp, "ctx_log_pred_write(ctx, ", pred_id, ");\n"); } } =20 diff --git a/target/hexagon/translate.c b/target/hexagon/translate.c index 93fd1b55e3..9e5fcee1ee 100644 --- a/target/hexagon/translate.c +++ b/target/hexagon/translate.c @@ -1,5 +1,5 @@ /* - * Copyright(c) 2019-2022 Qualcomm Innovation Center, Inc. All Rights Res= erved. + * Copyright(c) 2019-2023 Qualcomm Innovation Center, Inc. All Rights Res= erved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,6 +29,15 @@ #include "translate.h" #include "printinsn.h" =20 +#include "analyze_funcs_generated.c.inc" + +typedef void (*AnalyzeInsn)(DisasContext *ctx); +static const AnalyzeInsn opcode_analyze[XX_LAST_OPCODE] =3D { +#define OPCODE(X) [X] =3D analyze_##X +#include "opcodes_def_generated.h.inc" +#undef OPCODE +}; + TCGv hex_gpr[TOTAL_PER_THREAD_REGS]; TCGv hex_pred[NUM_PREGS]; TCGv hex_this_PC; @@ -265,6 +274,76 @@ static bool need_next_PC(DisasContext *ctx) return false; } =20 +/* + * The opcode_analyze functions mark most of the writes in a packet + * However, there are some implicit writes marked as attributes + * of the applicable instructions. + */ +static void mark_implicit_reg_write(DisasContext *ctx, int attrib, int rnu= m) +{ + uint16_t opcode =3D ctx->insn->opcode; + if (GET_ATTRIB(opcode, attrib)) { + /* + * USR is used to set overflow and FP exceptions, + * so treat it as conditional + */ + bool is_predicated =3D GET_ATTRIB(opcode, A_CONDEXEC) || + rnum =3D=3D HEX_REG_USR; + + /* LC0/LC1 is conditionally written by endloop instructions */ + if ((rnum =3D=3D HEX_REG_LC0 || rnum =3D=3D HEX_REG_LC1) && + (opcode =3D=3D J2_endloop0 || + opcode =3D=3D J2_endloop1 || + opcode =3D=3D J2_endloop01)) { + is_predicated =3D true; + } + + ctx_log_reg_write(ctx, rnum, is_predicated); + } +} + +static void mark_implicit_reg_writes(DisasContext *ctx) +{ + mark_implicit_reg_write(ctx, A_IMPLICIT_WRITES_FP, HEX_REG_FP); + mark_implicit_reg_write(ctx, A_IMPLICIT_WRITES_SP, HEX_REG_SP); + mark_implicit_reg_write(ctx, A_IMPLICIT_WRITES_LR, HEX_REG_LR); + mark_implicit_reg_write(ctx, A_IMPLICIT_WRITES_LC0, HEX_REG_LC0); + mark_implicit_reg_write(ctx, A_IMPLICIT_WRITES_SA0, HEX_REG_SA0); + mark_implicit_reg_write(ctx, A_IMPLICIT_WRITES_LC1, HEX_REG_LC1); + mark_implicit_reg_write(ctx, A_IMPLICIT_WRITES_SA1, HEX_REG_SA1); + mark_implicit_reg_write(ctx, A_IMPLICIT_WRITES_USR, HEX_REG_USR); + mark_implicit_reg_write(ctx, A_FPOP, HEX_REG_USR); +} + +static void mark_implicit_pred_write(DisasContext *ctx, int attrib, int pn= um) +{ + if (GET_ATTRIB(ctx->insn->opcode, attrib)) { + ctx_log_pred_write(ctx, pnum); + } +} + +static void mark_implicit_pred_writes(DisasContext *ctx) +{ + mark_implicit_pred_write(ctx, A_IMPLICIT_WRITES_P0, 0); + mark_implicit_pred_write(ctx, A_IMPLICIT_WRITES_P1, 1); + mark_implicit_pred_write(ctx, A_IMPLICIT_WRITES_P2, 2); + mark_implicit_pred_write(ctx, A_IMPLICIT_WRITES_P3, 3); +} + +static void analyze_packet(DisasContext *ctx) +{ + Packet *pkt =3D ctx->pkt; + for (int i =3D 0; i < pkt->num_insns; i++) { + Insn *insn =3D &pkt->insn[i]; + ctx->insn =3D insn; + if (opcode_analyze[insn->opcode]) { + opcode_analyze[insn->opcode](ctx); + } + mark_implicit_reg_writes(ctx); + mark_implicit_pred_writes(ctx); + } +} + static void gen_start_packet(DisasContext *ctx) { Packet *pkt =3D ctx->pkt; @@ -275,6 +354,7 @@ static void gen_start_packet(DisasContext *ctx) ctx->next_PC =3D next_PC; ctx->reg_log_idx =3D 0; bitmap_zero(ctx->regs_written, TOTAL_PER_THREAD_REGS); + bitmap_zero(ctx->predicated_regs, TOTAL_PER_THREAD_REGS); ctx->preg_log_idx =3D 0; bitmap_zero(ctx->pregs_written, NUM_PREGS); ctx->future_vregs_idx =3D 0; @@ -291,6 +371,14 @@ static void gen_start_packet(DisasContext *ctx) ctx->s1_store_processed =3D false; ctx->pre_commit =3D true; =20 + analyze_packet(ctx); + + /* + * pregs_written is used both in the analyze phase as well as the code + * gen phase, so clear it again. + */ + bitmap_zero(ctx->pregs_written, NUM_PREGS); + if (HEX_DEBUG) { /* Handy place to set a breakpoint before the packet executes */ gen_helper_debug_start_packet(cpu_env); @@ -313,6 +401,16 @@ static void gen_start_packet(DisasContext *ctx) tcg_gen_movi_tl(hex_pred_written, 0); } =20 + /* Preload the predicated registers into hex_new_value[i] */ + if (!bitmap_empty(ctx->predicated_regs, TOTAL_PER_THREAD_REGS)) { + int i =3D find_first_bit(ctx->predicated_regs, TOTAL_PER_THREAD_RE= GS); + while (i < TOTAL_PER_THREAD_REGS) { + tcg_gen_mov_tl(hex_new_value[i], hex_gpr[i]); + i =3D find_next_bit(ctx->predicated_regs, TOTAL_PER_THREAD_REG= S, + i + 1); + } + } + if (pkt->pkt_has_hvx) { tcg_gen_movi_tl(hex_VRegs_updated, 0); tcg_gen_movi_tl(hex_QRegs_updated, 0); @@ -336,66 +434,6 @@ bool is_gather_store_insn(DisasContext *ctx) return false; } =20 -/* - * The LOG_*_WRITE macros mark most of the writes in a packet - * However, there are some implicit writes marked as attributes - * of the applicable instructions. - */ -static void mark_implicit_reg_write(DisasContext *ctx, int attrib, int rnu= m) -{ - uint16_t opcode =3D ctx->insn->opcode; - if (GET_ATTRIB(opcode, attrib)) { - /* - * USR is used to set overflow and FP exceptions, - * so treat it as conditional - */ - bool is_predicated =3D GET_ATTRIB(opcode, A_CONDEXEC) || - rnum =3D=3D HEX_REG_USR; - - /* LC0/LC1 is conditionally written by endloop instructions */ - if ((rnum =3D=3D HEX_REG_LC0 || rnum =3D=3D HEX_REG_LC1) && - (opcode =3D=3D J2_endloop0 || - opcode =3D=3D J2_endloop1 || - opcode =3D=3D J2_endloop01)) { - is_predicated =3D true; - } - - if (is_predicated && !is_preloaded(ctx, rnum)) { - tcg_gen_mov_tl(hex_new_value[rnum], hex_gpr[rnum]); - } - - ctx_log_reg_write(ctx, rnum); - } -} - -static void mark_implicit_pred_write(DisasContext *ctx, int attrib, int pn= um) -{ - if (GET_ATTRIB(ctx->insn->opcode, attrib)) { - ctx_log_pred_write(ctx, pnum); - } -} - -static void mark_implicit_reg_writes(DisasContext *ctx) -{ - mark_implicit_reg_write(ctx, A_IMPLICIT_WRITES_FP, HEX_REG_FP); - mark_implicit_reg_write(ctx, A_IMPLICIT_WRITES_SP, HEX_REG_SP); - mark_implicit_reg_write(ctx, A_IMPLICIT_WRITES_LR, HEX_REG_LR); - mark_implicit_reg_write(ctx, A_IMPLICIT_WRITES_LC0, HEX_REG_LC0); - mark_implicit_reg_write(ctx, A_IMPLICIT_WRITES_SA0, HEX_REG_SA0); - mark_implicit_reg_write(ctx, A_IMPLICIT_WRITES_LC1, HEX_REG_LC1); - mark_implicit_reg_write(ctx, A_IMPLICIT_WRITES_SA1, HEX_REG_SA1); - mark_implicit_reg_write(ctx, A_IMPLICIT_WRITES_USR, HEX_REG_USR); - mark_implicit_reg_write(ctx, A_FPOP, HEX_REG_USR); -} - -static void mark_implicit_pred_writes(DisasContext *ctx) -{ - mark_implicit_pred_write(ctx, A_IMPLICIT_WRITES_P0, 0); - mark_implicit_pred_write(ctx, A_IMPLICIT_WRITES_P1, 1); - mark_implicit_pred_write(ctx, A_IMPLICIT_WRITES_P2, 2); - mark_implicit_pred_write(ctx, A_IMPLICIT_WRITES_P3, 3); -} - static void mark_store_width(DisasContext *ctx) { uint16_t opcode =3D ctx->insn->opcode; @@ -423,9 +461,7 @@ static void mark_store_width(DisasContext *ctx) static void gen_insn(DisasContext *ctx) { if (ctx->insn->generate) { - mark_implicit_reg_writes(ctx); ctx->insn->generate(ctx); - mark_implicit_pred_writes(ctx); mark_store_width(ctx); } else { gen_exception_end_tb(ctx, HEX_EXCP_INVALID_OPCODE); diff --git a/target/hexagon/README b/target/hexagon/README index 251960b862..365606f1e6 100644 --- a/target/hexagon/README +++ b/target/hexagon/README @@ -52,6 +52,7 @@ header files in /target/hexagon gen_tcg_func_table.py -> tcg_func_table_generated.c.inc gen_helper_funcs.py -> helper_funcs_generated.c.inc gen_idef_parser_funcs.py -> idef_parser_input.h + gen_analyze_funcs.py -> analyze_funcs_generated.c.inc =20 Qemu helper functions have 3 parts DEF_HELPER declaration indicates the signature of the helper @@ -87,7 +88,6 @@ tcg_funcs_generated.c.inc TCGv RtV =3D hex_gpr[insn->regno[2]]; gen_helper_A2_add(RdV, cpu_env, RsV, RtV); gen_log_reg_write(RdN, RdV); - ctx_log_reg_write(ctx, RdN); } =20 helper_funcs_generated.c.inc @@ -160,7 +160,6 @@ istruction. TCGv slot =3D tcg_constant_tl(insn->slot); gen_helper_V6_vaddw(cpu_env, VdV, VuV, VvV, slot); gen_log_vreg_write(ctx, VdV_off, VdN, EXT_DFL, insn->slot, false); - ctx_log_vreg_write(ctx, VdN, EXT_DFL, false); } =20 Notice that we also generate a variable named _off for each opera= nd of @@ -190,9 +189,14 @@ when the override is present. vreg_src_off(ctx, VvN); fGEN_TCG_V6_vaddw({ fHIDE(int i;) fVFOREACH(32, i) { VdV.w[i] =3D = VuV.w[i] + VvV.w[i] ; } }); gen_log_vreg_write(ctx, VdV_off, VdN, EXT_DFL, insn->slot, false); - ctx_log_vreg_write(ctx, VdN, EXT_DFL, false); } =20 +We also generate an analyze_ function for each instruction. Currentl= y, +these functions record the writes to registers by calling ctx_log_*. Duri= ng +gen_start_packet, we invoke the analyze_ function for each instructio= n in +the packet, and we mark the implicit writes. After the analysis is perfor= med, +we initialize hex_new_value for each of the predicated assignments. + In addition to instruction semantics, we use a generator to create the dec= ode tree. This generation is also a two step process. The first step is to r= un target/hexagon/gen_dectree_import.c to produce diff --git a/target/hexagon/gen_analyze_funcs.py b/target/hexagon/gen_analy= ze_funcs.py new file mode 100755 index 0000000000..37c166dc0d --- /dev/null +++ b/target/hexagon/gen_analyze_funcs.py @@ -0,0 +1,237 @@ +#!/usr/bin/env python3 + +## +## Copyright(c) 2022-2023 Qualcomm Innovation Center, Inc. All Rights Res= erved. +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, see . +## + +import sys +import re +import string +import hex_common + +## +## Helpers for gen_analyze_func +## +def is_predicated(tag): + return 'A_CONDEXEC' in hex_common.attribdict[tag] + +def analyze_opn_old(f, tag, regtype, regid, regno): + regN =3D "%s%sN" % (regtype, regid) + predicated =3D "true" if is_predicated(tag) else "false" + if (regtype =3D=3D "R"): + if (regid in {"ss", "tt"}): + f.write("// const int %s =3D insn->regno[%d];\n" % \ + (regN, regno)) + elif (regid in {"dd", "ee", "xx", "yy"}): + f.write(" const int %s =3D insn->regno[%d];\n" % (regN, reg= no)) + f.write(" ctx_log_reg_write_pair(ctx, %s, %s);\n" % \ + (regN, predicated)) + elif (regid in {"s", "t", "u", "v"}): + f.write("// const int %s =3D insn->regno[%d];\n" % \ + (regN, regno)) + elif (regid in {"d", "e", "x", "y"}): + f.write(" const int %s =3D insn->regno[%d];\n" % (regN, reg= no)) + f.write(" ctx_log_reg_write(ctx, %s, %s);\n" % \ + (regN, predicated)) + else: + print("Bad register parse: ", regtype, regid) + elif (regtype =3D=3D "P"): + if (regid in {"s", "t", "u", "v"}): + f.write("// const int %s =3D insn->regno[%d];\n" % \ + (regN, regno)) + elif (regid in {"d", "e", "x"}): + f.write(" const int %s =3D insn->regno[%d];\n" % (regN, reg= no)) + f.write(" ctx_log_pred_write(ctx, %s);\n" % (regN)) + else: + print("Bad register parse: ", regtype, regid) + elif (regtype =3D=3D "C"): + if (regid =3D=3D "ss"): + f.write("// const int %s =3D insn->regno[%d] + HEX_REG_SA0;= \n" % \ + (regN, regno)) + elif (regid =3D=3D "dd"): + f.write(" const int %s =3D insn->regno[%d] + HEX_REG_SA0;\n= " % \ + (regN, regno)) + f.write(" ctx_log_reg_write_pair(ctx, %s, %s);\n" % \ + (regN, predicated)) + elif (regid =3D=3D "s"): + f.write("// const int %s =3D insn->regno[%d] + HEX_REG_SA0;= \n" % \ + (regN, regno)) + elif (regid =3D=3D "d"): + f.write(" const int %s =3D insn->regno[%d] + HEX_REG_SA0;\n= " % \ + (regN, regno)) + f.write(" ctx_log_reg_write(ctx, %s, %s);\n" % \ + (regN, predicated)) + else: + print("Bad register parse: ", regtype, regid) + elif (regtype =3D=3D "M"): + if (regid =3D=3D "u"): + f.write("// const int %s =3D insn->regno[%d];\n"% \ + (regN, regno)) + else: + print("Bad register parse: ", regtype, regid) + elif (regtype =3D=3D "V"): + if (regid in {"dd", "xx"}): + f.write("// const int %s =3D insn->regno[%d];\n" %\ + (regN, regno)) + elif (regid in {"uu", "vv"}): + f.write("// const int %s =3D insn->regno[%d];\n" % \ + (regN, regno)) + elif (regid in {"s", "u", "v", "w"}): + f.write("// const int %s =3D insn->regno[%d];\n" % \ + (regN, regno)) + elif (regid in {"d", "x", "y"}): + f.write("// const int %s =3D insn->regno[%d];\n" % \ + (regN, regno)) + else: + print("Bad register parse: ", regtype, regid) + elif (regtype =3D=3D "Q"): + if (regid in {"d", "e", "x"}): + f.write("// const int %s =3D insn->regno[%d];\n" % \ + (regN, regno)) + elif (regid in {"s", "t", "u", "v"}): + f.write("// const int %s =3D insn->regno[%d];\n" % \ + (regN, regno)) + else: + print("Bad register parse: ", regtype, regid) + elif (regtype =3D=3D "G"): + if (regid in {"dd"}): + f.write("// const int %s =3D insn->regno[%d];\n" % \ + (regN, regno)) + elif (regid in {"d"}): + f.write("// const int %s =3D insn->regno[%d];\n" % \ + (regN, regno)) + elif (regid in {"ss"}): + f.write("// const int %s =3D insn->regno[%d];\n" % \ + (regN, regno)) + elif (regid in {"s"}): + f.write("// const int %s =3D insn->regno[%d];\n" % \ + (regN, regno)) + else: + print("Bad register parse: ", regtype, regid) + elif (regtype =3D=3D "S"): + if (regid in {"dd"}): + f.write("// const int %s =3D insn->regno[%d];\n" % \ + (regN, regno)) + elif (regid in {"d"}): + f.write("// const int %s =3D insn->regno[%d];\n" % \ + (regN, regno)) + elif (regid in {"ss"}): + f.write("// const int %s =3D insn->regno[%d];\n" % \ + (regN, regno)) + elif (regid in {"s"}): + f.write("// const int %s =3D insn->regno[%d];\n" % \ + (regN, regno)) + else: + print("Bad register parse: ", regtype, regid) + else: + print("Bad register parse: ", regtype, regid) + +def analyze_opn_new(f, tag, regtype, regid, regno): + regN =3D "%s%sN" % (regtype, regid) + if (regtype =3D=3D "N"): + if (regid in {"s", "t"}): + f.write("// const int %s =3D insn->regno[%d];\n" % \ + (regN, regno)) + else: + print("Bad register parse: ", regtype, regid) + elif (regtype =3D=3D "P"): + if (regid in {"t", "u", "v"}): + f.write("// const int %s =3D insn->regno[%d];\n" % \ + (regN, regno)) + else: + print("Bad register parse: ", regtype, regid) + elif (regtype =3D=3D "O"): + if (regid =3D=3D "s"): + f.write("// const int %s =3D insn->regno[%d];\n" % \ + (regN, regno)) + else: + print("Bad register parse: ", regtype, regid) + else: + print("Bad register parse: ", regtype, regid) + +def analyze_opn(f, tag, regtype, regid, toss, numregs, i): + if (hex_common.is_pair(regid)): + analyze_opn_old(f, tag, regtype, regid, i) + elif (hex_common.is_single(regid)): + if hex_common.is_old_val(regtype, regid, tag): + analyze_opn_old(f,tag, regtype, regid, i) + elif hex_common.is_new_val(regtype, regid, tag): + analyze_opn_new(f, tag, regtype, regid, i) + else: + print("Bad register parse: ", regtype, regid, toss, numregs) + else: + print("Bad register parse: ", regtype, regid, toss, numregs) + +## +## Generate the code to analyze the instruction +## For A2_add: Rd32=3Dadd(Rs32,Rt32), { RdV=3DRsV+RtV;} +## We produce: +## static void analyze_A2_add(DisasContext *ctx) +## { +## Insn *insn G_GNUC_UNUSED =3D ctx->insn; +## const int RdN =3D insn->regno[0]; +## ctx_log_reg_write(ctx, RdN, false); +## // const int RsN =3D insn->regno[1]; +## // const int RtN =3D insn->regno[2]; +## } +## +def gen_analyze_func(f, tag, regs, imms): + f.write("static void analyze_%s(DisasContext *ctx)\n" %tag) + f.write('{\n') + + f.write(" Insn *insn G_GNUC_UNUSED =3D ctx->insn;\n") + + i=3D0 + ## Analyze all the registers + for regtype, regid, toss, numregs in regs: + analyze_opn(f, tag, regtype, regid, toss, numregs, i) + i +=3D 1 + + + f.write("}\n\n") + +def main(): + hex_common.read_semantics_file(sys.argv[1]) + hex_common.read_attribs_file(sys.argv[2]) + hex_common.read_overrides_file(sys.argv[3]) + hex_common.read_overrides_file(sys.argv[4]) + ## Whether or not idef-parser is enabled is + ## determined by the number of arguments to + ## this script: + ## + ## 5 args. -> not enabled, + ## 6 args. -> idef-parser enabled. + ## + ## The 6:th arg. then holds a list of the successfully + ## parsed instructions. + is_idef_parser_enabled =3D len(sys.argv) > 6 + if is_idef_parser_enabled: + hex_common.read_idef_parser_enabled_file(sys.argv[5]) + hex_common.calculate_attribs() + tagregs =3D hex_common.get_tagregs() + tagimms =3D hex_common.get_tagimms() + + with open(sys.argv[-1], 'w') as f: + f.write("#ifndef HEXAGON_TCG_FUNCS_H\n") + f.write("#define HEXAGON_TCG_FUNCS_H\n\n") + + for tag in hex_common.tags: + gen_analyze_func(f, tag, tagregs[tag], tagimms[tag]) + + f.write("#endif /* HEXAGON_TCG_FUNCS_H */\n") + +if __name__ =3D=3D "__main__": + main() diff --git a/target/hexagon/gen_tcg_funcs.py b/target/hexagon/gen_tcg_funcs= .py index 02cb52c21e..02fa65c5c9 100755 --- a/target/hexagon/gen_tcg_funcs.py +++ b/target/hexagon/gen_tcg_funcs.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 =20 ## -## Copyright(c) 2019-2022 Qualcomm Innovation Center, Inc. All Rights Res= erved. +## Copyright(c) 2019-2023 Qualcomm Innovation Center, Inc. All Rights Res= erved. ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -37,15 +37,6 @@ def genptr_decl_pair_writable(f, tag, regtype, regid, re= gno): (regN, regno)) else: f.write(" const int %s =3D insn->regno[%d];\n" % (regN, regno)) - if ('A_CONDEXEC' in hex_common.attribdict[tag]): - f.write(" if (!is_preloaded(ctx, %s)) {\n" % regN) - f.write(" tcg_gen_mov_tl(hex_new_value[%s], hex_gpr[%s]);\n= " % \ - (regN, regN)) - f.write(" }\n") - f.write(" if (!is_preloaded(ctx, %s + 1)) {\n" % regN) - f.write(" tcg_gen_mov_tl(hex_new_value[%s + 1], hex_gpr[%s = + 1]);\n" % \ - (regN, regN)) - f.write(" }\n") =20 def genptr_decl_writable(f, tag, regtype, regid, regno): regN=3D"%s%sN" % (regtype,regid) @@ -56,11 +47,6 @@ def genptr_decl_writable(f, tag, regtype, regid, regno): (regN, regno)) else: f.write(" const int %s =3D insn->regno[%d];\n" % (regN, regno)) - if ('A_CONDEXEC' in hex_common.attribdict[tag]): - f.write(" if (!is_preloaded(ctx, %s)) {\n" % regN) - f.write(" tcg_gen_mov_tl(hex_new_value[%s], hex_gpr[%s]);\n= " % \ - (regN, regN)) - f.write(" }\n") =20 def genptr_decl(f, tag, regtype, regid, regno): regN=3D"%s%sN" % (regtype,regid) @@ -391,8 +377,6 @@ def genptr_dst_write_pair(f, tag, regtype, regid): else: f.write(" gen_log_reg_write_pair(%s%sN, %s%sV);\n" % \ (regtype, regid, regtype, regid)) - f.write(" ctx_log_reg_write_pair(ctx, %s%sN);\n" % \ - (regtype, regid)) =20 def genptr_dst_write(f, tag, regtype, regid): if (regtype =3D=3D "R"): @@ -406,16 +390,12 @@ def genptr_dst_write(f, tag, regtype, regid): else: f.write(" gen_log_reg_write(%s%sN, %s%sV);\n" % \ (regtype, regid, regtype, regid)) - f.write(" ctx_log_reg_write(ctx, %s%sN);\n" % \ - (regtype, regid)) else: print("Bad register parse: ", regtype, regid) elif (regtype =3D=3D "P"): if (regid in {"d", "e", "x"}): f.write(" gen_log_pred_write(ctx, %s%sN, %s%sV);\n" % \ (regtype, regid, regtype, regid)) - f.write(" ctx_log_pred_write(ctx, %s%sN);\n" % \ - (regtype, regid)) else: print("Bad register parse: ", regtype, regid) elif (regtype =3D=3D "C"): @@ -507,7 +487,6 @@ def genptr_dst_write_opn(f,regtype, regid, tag): ## TCGv RtV =3D hex_gpr[insn->regno[2]]; ## ## gen_log_reg_write(RdN, RdV); -## ctx_log_reg_write(ctx, RdN); ## } ## ## where depends on hex_common.skip_qemu_helper(tag) diff --git a/target/hexagon/meson.build b/target/hexagon/meson.build index c9d31d095c..48c9f53cfa 100644 --- a/target/hexagon/meson.build +++ b/target/hexagon/meson.build @@ -1,5 +1,5 @@ ## -## Copyright(c) 2020-2021 Qualcomm Innovation Center, Inc. All Rights Res= erved. +## Copyright(c) 2020-2023 Qualcomm Innovation Center, Inc. All Rights Res= erved. ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -276,4 +276,13 @@ tcg_funcs_generated =3D custom_target( ) hexagon_ss.add(tcg_funcs_generated) =20 +analyze_funcs_generated =3D custom_target( + 'analyze_funcs_generated.c.inc', + output: 'analyze_funcs_generated.c.inc', + depends: helper_dep, + depend_files: [hex_common_py, attribs_def, gen_tcg_h, gen_tcg_hvx_h], + command: [python, files('gen_analyze_funcs.py'), helper_in, '@OUTPUT@'= ], +) +hexagon_ss.add(analyze_funcs_generated) + target_arch +=3D {'hexagon': hexagon_ss} --=20 2.25.1 From nobody Sun May 5 04:04:05 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=quicinc.com ARC-Seal: i=1; a=rsa-sha256; t=1678167450; cv=none; d=zohomail.com; s=zohoarc; b=TmqCSOG3qP/PTWBwTut2Ghae8yIIvAwxV3vqghiNa1rxVxYUaERY6LOgSH2+3NhAznE2ig8ZXi/+yIykshI9apCX4xhkCmxv0+CdFLiaHtjOj1+ZnajCj/g8uuxW883RBsxlybn8BEc+Z97athEYmHLd4QdqPPi4jt/MvCyqzO8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678167450; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Ogf3UYBlzmf/pVCuj1e7sq0k8AVVkVCj28FDcUQH7GM=; b=aegXxfA15T9WKMRUTJO4hCdLRYjhuwU9NBAXGy7CgQ4hNYoq2oX99LXsoCU6949Y+qQ+3XrruT47OlUc677UGJb1lFXLlsUwwM2JnJmWIP73d+3MX7T3v+Tr2p+JVNL0IQ8vD96ouvydv0MGVorR/4H/ibkdGHwWG44RdhJ0zVU= 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+importer2=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 167816745078613.489218818212066; Mon, 6 Mar 2023 21:37:30 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZPyc-0006nq-TE; Tue, 07 Mar 2023 00:35:06 -0500 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 1pZPyR-0006bU-Sp for qemu-devel@nongnu.org; Tue, 07 Mar 2023 00:34:56 -0500 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 1pZPyK-0006ZC-0P for qemu-devel@nongnu.org; Tue, 07 Mar 2023 00:34:53 -0500 Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3275FNFA016737; Tue, 7 Mar 2023 05:34:45 GMT Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3p419d6yb6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Mar 2023 05:34:45 +0000 Received: from pps.filterd (NALASPPMTA01.qualcomm.com [127.0.0.1]) by NALASPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTP id 3275UIcq026157; Tue, 7 Mar 2023 05:34:44 GMT Received: from pps.reinject (localhost [127.0.0.1]) by NALASPPMTA01.qualcomm.com (PPS) with ESMTPS id 3p4fhbm8nj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Mar 2023 05:34:44 +0000 Received: from NALASPPMTA01.qualcomm.com (NALASPPMTA01.qualcomm.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3275YhQk000515; Tue, 7 Mar 2023 05:34:43 GMT Received: from hu-devc-sd-u20-a-1.qualcomm.com (hu-tsimpson-lv.qualcomm.com [10.47.204.221]) by NALASPPMTA01.qualcomm.com (PPS) with ESMTPS id 3275YhdO000507 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Mar 2023 05:34:43 +0000 Received: by hu-devc-sd-u20-a-1.qualcomm.com (Postfix, from userid 47164) id 9A2B16EA; Mon, 6 Mar 2023 21:34:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=qcppdkim1; bh=Ogf3UYBlzmf/pVCuj1e7sq0k8AVVkVCj28FDcUQH7GM=; b=Cv06zTf0kQsDcykgy5E4VAH+GIvSm3EM836Gi9hq9BvxqdhZnAbd9AeVg55tkT169pH6 WrEkZpt/AJLdMqNCK2SN0rhWaIrfoeEtPH04PzYxzvg6tU5bKd/HHqaHlRE1tYTT/IOF k0r+l2IrsaeRaIrjkM6e2SFsBCCFsPV7pnwf5s3RUkYXCQbSdc18AKOxvvo92clMdQGf vrRK7fkD2DULGUu8U3GkAq4Dha6aEF8fXyvYVAJMgvi/AXR+jfYgohGWUDlyi7FMz5i6 be2TNN8aPImAbQiOt8N22BsJ17eHTcw8UE2FEdprk9ZFuiwVkOkQO0U8Jkt1HPNGyt5m pA== From: Taylor Simpson To: qemu-devel@nongnu.org Cc: tsimpson@quicinc.com, richard.henderson@linaro.org, philmd@linaro.org, peter.maydell@linaro.org, bcain@quicinc.com, quic_mathbern@quicinc.com, stefanha@redhat.com, ale@rev.ng, anjo@rev.ng Subject: [PULL 09/17] Hexagon (target/hexagon) Don't set pkt_has_store_s1 when not needed Date: Mon, 6 Mar 2023 21:34:30 -0800 Message-Id: <20230307053438.2416629-10-tsimpson@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230307053438.2416629-1-tsimpson@quicinc.com> References: <20230307053438.2416629-1-tsimpson@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: mg5G4Ml2_zhUaSPXXfxMoSA7TjUycI_I X-Proofpoint-GUID: mg5G4Ml2_zhUaSPXXfxMoSA7TjUycI_I X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-06_14,2023-03-06_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 lowpriorityscore=0 phishscore=0 malwarescore=0 impostorscore=0 priorityscore=1501 clxscore=1015 suspectscore=0 mlxlogscore=437 adultscore=0 bulkscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303070050 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.220.168.131; envelope-from=tsimpson@qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @quicinc.com) X-ZM-MESSAGEID: 1678167451235100001 The pkt_has_store_s1 field in CPUHexagonState is only needed in generated helpers for scalar load instructions. See check_noshuf and mem_load[1248] in op_helper.c. We add logic in gen_analyze_funcs.py to set need_pkt_has_store_s1 in DisasContext when it is needed at runtime. Signed-off-by: Taylor Simpson Reviewed-by: Anton Johansson Message-Id: <20230307025828.1612809-7-tsimpson@quicinc.com> --- target/hexagon/translate.h | 1 + target/hexagon/attribs_def.h.inc | 1 + target/hexagon/translate.c | 6 +++++- target/hexagon/gen_analyze_funcs.py | 5 +++++ target/hexagon/hex_common.py | 1 + 5 files changed, 13 insertions(+), 1 deletion(-) diff --git a/target/hexagon/translate.h b/target/hexagon/translate.h index d45d3a4bb0..34368b2186 100644 --- a/target/hexagon/translate.h +++ b/target/hexagon/translate.h @@ -61,6 +61,7 @@ typedef struct DisasContext { TCGCond branch_cond; target_ulong branch_dest; bool is_tight_loop; + bool need_pkt_has_store_s1; } DisasContext; =20 static inline void ctx_log_pred_write(DisasContext *ctx, int pnum) diff --git a/target/hexagon/attribs_def.h.inc b/target/hexagon/attribs_def.= h.inc index 5d2a102c18..9874d1658f 100644 --- a/target/hexagon/attribs_def.h.inc +++ b/target/hexagon/attribs_def.h.inc @@ -44,6 +44,7 @@ DEF_ATTRIB(MEMSIZE_1B, "Memory width is 1 byte", "", "") DEF_ATTRIB(MEMSIZE_2B, "Memory width is 2 bytes", "", "") DEF_ATTRIB(MEMSIZE_4B, "Memory width is 4 bytes", "", "") DEF_ATTRIB(MEMSIZE_8B, "Memory width is 8 bytes", "", "") +DEF_ATTRIB(SCALAR_LOAD, "Load is scalar", "", "") DEF_ATTRIB(SCALAR_STORE, "Store is scalar", "", "") DEF_ATTRIB(REGWRSIZE_1B, "Memory width is 1 byte", "", "") DEF_ATTRIB(REGWRSIZE_2B, "Memory width is 2 bytes", "", "") diff --git a/target/hexagon/translate.c b/target/hexagon/translate.c index 9e5fcee1ee..01671d5451 100644 --- a/target/hexagon/translate.c +++ b/target/hexagon/translate.c @@ -333,6 +333,7 @@ static void mark_implicit_pred_writes(DisasContext *ctx) static void analyze_packet(DisasContext *ctx) { Packet *pkt =3D ctx->pkt; + ctx->need_pkt_has_store_s1 =3D false; for (int i =3D 0; i < pkt->num_insns; i++) { Insn *insn =3D &pkt->insn[i]; ctx->insn =3D insn; @@ -367,12 +368,15 @@ static void gen_start_packet(DisasContext *ctx) for (i =3D 0; i < STORES_MAX; i++) { ctx->store_width[i] =3D 0; } - tcg_gen_movi_tl(hex_pkt_has_store_s1, pkt->pkt_has_store_s1); ctx->s1_store_processed =3D false; ctx->pre_commit =3D true; =20 analyze_packet(ctx); =20 + if (ctx->need_pkt_has_store_s1) { + tcg_gen_movi_tl(hex_pkt_has_store_s1, pkt->pkt_has_store_s1); + } + /* * pregs_written is used both in the analyze phase as well as the code * gen phase, so clear it again. diff --git a/target/hexagon/gen_analyze_funcs.py b/target/hexagon/gen_analy= ze_funcs.py index 37c166dc0d..7e1f221b3c 100755 --- a/target/hexagon/gen_analyze_funcs.py +++ b/target/hexagon/gen_analyze_funcs.py @@ -200,6 +200,11 @@ def gen_analyze_func(f, tag, regs, imms): analyze_opn(f, tag, regtype, regid, toss, numregs, i) i +=3D 1 =20 + has_generated_helper =3D (not hex_common.skip_qemu_helper(tag) and + not hex_common.is_idef_parser_enabled(tag)) + if (has_generated_helper and + 'A_SCALAR_LOAD' in hex_common.attribdict[tag]): + f.write(" ctx->need_pkt_has_store_s1 =3D true;\n") =20 f.write("}\n\n") =20 diff --git a/target/hexagon/hex_common.py b/target/hexagon/hex_common.py index a29f61bb4f..76da362c11 100755 --- a/target/hexagon/hex_common.py +++ b/target/hexagon/hex_common.py @@ -89,6 +89,7 @@ def calculate_attribs(): add_qemu_macro_attrib('fWRITE_P3', 'A_WRITES_PRED_REG') add_qemu_macro_attrib('fSET_OVERFLOW', 'A_IMPLICIT_WRITES_USR') add_qemu_macro_attrib('fSET_LPCFG', 'A_IMPLICIT_WRITES_USR') + add_qemu_macro_attrib('fLOAD', 'A_SCALAR_LOAD') add_qemu_macro_attrib('fSTORE', 'A_SCALAR_STORE') =20 # Recurse down macros, find attributes from sub-macros --=20 2.25.1 From nobody Sun May 5 04:04:05 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=quicinc.com ARC-Seal: i=1; a=rsa-sha256; t=1678167351; cv=none; d=zohomail.com; s=zohoarc; b=kTsgdZ4vASkE5uy3bJu7wFu3cf5t6JUsY9uv0MhNt53Ht/mbSNCiKTy1xnd9ODpp3HQr1fUsTEk+IdSAKOGyMhcVJ24xa8h1enkCyIZnwAFeN0Af23JgYf7HYXi2a7Kug41GG83SwL9QT/wW4blzofr47WKRImr5Z2vM+EJAqNg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678167351; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=dScYJt0u2ueJeaV/bE7zmVLbnYTHqzemw+GFu4lEWr8=; b=jkE8tp+VFmRji4sG/nKDTY7ZTsNnUXhbD+QpKetCYvDBPM+1irmdgxkXePqAF5APOU3KqGsNEGk9WLWspVHnscpAJOPsQ69eI9We7+xYU9dVnB9PzZIGy1eFzcH3ohTA0y4bn6QJLwzuBZWS6dwUtHX2zS8JIFvlNWv3m4So26c= 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+importer2=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 1678167351054215.1107476246276; Mon, 6 Mar 2023 21:35:51 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZPyZ-0006lq-AQ; Tue, 07 Mar 2023 00:35:03 -0500 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 1pZPyN-0006XE-8E for qemu-devel@nongnu.org; Tue, 07 Mar 2023 00:34:53 -0500 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 1pZPyJ-0006Z9-Gx for qemu-devel@nongnu.org; Tue, 07 Mar 2023 00:34:51 -0500 Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 326McPvw022029; Tue, 7 Mar 2023 05:34:46 GMT Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3p5rqjru2u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Mar 2023 05:34:46 +0000 Received: from pps.filterd (NALASPPMTA01.qualcomm.com [127.0.0.1]) by NALASPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTP id 3275Yis2000546; Tue, 7 Mar 2023 05:34:45 GMT Received: from pps.reinject (localhost [127.0.0.1]) by NALASPPMTA01.qualcomm.com (PPS) with ESMTPS id 3p4fhbm8nh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Mar 2023 05:34:44 +0000 Received: from NALASPPMTA01.qualcomm.com (NALASPPMTA01.qualcomm.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3275Yh1t000514; Tue, 7 Mar 2023 05:34:43 GMT Received: from hu-devc-sd-u20-a-1.qualcomm.com (hu-tsimpson-lv.qualcomm.com [10.47.204.221]) by NALASPPMTA01.qualcomm.com (PPS) with ESMTPS id 3275Yh9c000508 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Mar 2023 05:34:43 +0000 Received: by hu-devc-sd-u20-a-1.qualcomm.com (Postfix, from userid 47164) id 9CB15A77; Mon, 6 Mar 2023 21:34:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=qcppdkim1; bh=dScYJt0u2ueJeaV/bE7zmVLbnYTHqzemw+GFu4lEWr8=; b=ZWKtQgXnSvDWjWuoEPzYv/UX+0fLx1NRQ7Dgg3fBADoxbk4QZmr1FWI9w+QjTdboWF0/ FLBHUNU/FlOt0cZSVU+yjqbUsAmGqI4M7FyuaSHP+Cq4vaQow2TyCUgLzn+7sku9jp5R PHjrNx5L+qSkfUihrdym8h5ZP2qO4eIIKy0rkpKmWHLGrKYA+rfFnHAAiNo/KAFcAmZv XHQwxQN1YGAIff6Ckg3vQLdE7hopwifR4VM9LZmJbsj4M56JPscUD3++uHtO732iSQMv O0Kdv+NtkvOBKbbebhFNisnqggg7PEcIVlwxkdaZa0LMKF8QxhK/+wHDU8p4eDA6UBgA Qg== From: Taylor Simpson To: qemu-devel@nongnu.org Cc: tsimpson@quicinc.com, richard.henderson@linaro.org, philmd@linaro.org, peter.maydell@linaro.org, bcain@quicinc.com, quic_mathbern@quicinc.com, stefanha@redhat.com, ale@rev.ng, anjo@rev.ng Subject: [PULL 10/17] Hexagon (target/hexagon) Analyze packet for HVX Date: Mon, 6 Mar 2023 21:34:31 -0800 Message-Id: <20230307053438.2416629-11-tsimpson@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230307053438.2416629-1-tsimpson@quicinc.com> References: <20230307053438.2416629-1-tsimpson@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: 4ylsx4ppPKuyp7flaPBCBSlUFpZL_87_ X-Proofpoint-GUID: 4ylsx4ppPKuyp7flaPBCBSlUFpZL_87_ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-06_14,2023-03-06_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 phishscore=0 priorityscore=1501 clxscore=1015 lowpriorityscore=0 adultscore=0 mlxscore=0 spamscore=0 suspectscore=0 bulkscore=0 impostorscore=0 mlxlogscore=527 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303070049 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.220.180.131; envelope-from=tsimpson@qualcomm.com; helo=mx0b-0031df01.pphosted.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @quicinc.com) X-ZM-MESSAGEID: 1678167352571100001 Extend the analyze_ functions for HVX vector and predicate writes Remove calls to ctx_log_vreg_write[_pair] from gen_tcg_funcs.py During gen_start_packet, reload the predicated HVX registers into fugure_VRegs and tmp_VRegs Signed-off-by: Taylor Simpson Reviewed-by: Anton Johansson Message-Id: <20230307025828.1612809-8-tsimpson@quicinc.com> --- target/hexagon/translate.h | 14 ++++++++------ target/hexagon/translate.c | 30 +++++++++++++++++++++++++++++ target/hexagon/gen_analyze_funcs.py | 17 +++++++++++++--- target/hexagon/gen_tcg_funcs.py | 18 ----------------- 4 files changed, 52 insertions(+), 27 deletions(-) diff --git a/target/hexagon/translate.h b/target/hexagon/translate.h index 34368b2186..765f2c6a22 100644 --- a/target/hexagon/translate.h +++ b/target/hexagon/translate.h @@ -54,6 +54,8 @@ typedef struct DisasContext { DECLARE_BITMAP(vregs_updated_tmp, NUM_VREGS); DECLARE_BITMAP(vregs_updated, NUM_VREGS); DECLARE_BITMAP(vregs_select, NUM_VREGS); + DECLARE_BITMAP(predicated_future_vregs, NUM_VREGS); + DECLARE_BITMAP(predicated_tmp_vregs, NUM_VREGS); int qreg_log[NUM_QREGS]; bool qreg_is_predicated[NUM_QREGS]; int qreg_log_idx; @@ -99,12 +101,6 @@ static inline void ctx_log_reg_write_pair(DisasContext = *ctx, int rnum, ctx_log_reg_write(ctx, rnum + 1, is_predicated); } =20 -static inline bool is_vreg_preloaded(DisasContext *ctx, int num) -{ - return test_bit(num, ctx->vregs_updated) || - test_bit(num, ctx->vregs_updated_tmp); -} - intptr_t ctx_future_vreg_off(DisasContext *ctx, int regnum, int num, bool alloc_ok); intptr_t ctx_tmp_vreg_off(DisasContext *ctx, int regnum, @@ -120,12 +116,18 @@ static inline void ctx_log_vreg_write(DisasContext *c= tx, ctx->vreg_log_idx++; =20 set_bit(rnum, ctx->vregs_updated); + if (is_predicated) { + set_bit(rnum, ctx->predicated_future_vregs); + } } if (type =3D=3D EXT_NEW) { set_bit(rnum, ctx->vregs_select); } if (type =3D=3D EXT_TMP) { set_bit(rnum, ctx->vregs_updated_tmp); + if (is_predicated) { + set_bit(rnum, ctx->predicated_tmp_vregs); + } } } =20 diff --git a/target/hexagon/translate.c b/target/hexagon/translate.c index 01671d5451..493bc75d27 100644 --- a/target/hexagon/translate.c +++ b/target/hexagon/translate.c @@ -364,6 +364,8 @@ static void gen_start_packet(DisasContext *ctx) bitmap_zero(ctx->vregs_updated_tmp, NUM_VREGS); bitmap_zero(ctx->vregs_updated, NUM_VREGS); bitmap_zero(ctx->vregs_select, NUM_VREGS); + bitmap_zero(ctx->predicated_future_vregs, NUM_VREGS); + bitmap_zero(ctx->predicated_tmp_vregs, NUM_VREGS); ctx->qreg_log_idx =3D 0; for (i =3D 0; i < STORES_MAX; i++) { ctx->store_width[i] =3D 0; @@ -415,6 +417,34 @@ static void gen_start_packet(DisasContext *ctx) } } =20 + /* Preload the predicated HVX registers into future_VRegs and tmp_VReg= s */ + if (!bitmap_empty(ctx->predicated_future_vregs, NUM_VREGS)) { + int i =3D find_first_bit(ctx->predicated_future_vregs, NUM_VREGS); + while (i < NUM_VREGS) { + const intptr_t VdV_off =3D + ctx_future_vreg_off(ctx, i, 1, true); + intptr_t src_off =3D offsetof(CPUHexagonState, VRegs[i]); + tcg_gen_gvec_mov(MO_64, VdV_off, + src_off, + sizeof(MMVector), + sizeof(MMVector)); + i =3D find_next_bit(ctx->predicated_future_vregs, NUM_VREGS, i= + 1); + } + } + if (!bitmap_empty(ctx->predicated_tmp_vregs, NUM_VREGS)) { + int i =3D find_first_bit(ctx->predicated_tmp_vregs, NUM_VREGS); + while (i < NUM_VREGS) { + const intptr_t VdV_off =3D + ctx_tmp_vreg_off(ctx, i, 1, true); + intptr_t src_off =3D offsetof(CPUHexagonState, VRegs[i]); + tcg_gen_gvec_mov(MO_64, VdV_off, + src_off, + sizeof(MMVector), + sizeof(MMVector)); + i =3D find_next_bit(ctx->predicated_tmp_vregs, NUM_VREGS, i + = 1); + } + } + if (pkt->pkt_has_hvx) { tcg_gen_movi_tl(hex_VRegs_updated, 0); tcg_gen_movi_tl(hex_QRegs_updated, 0); diff --git a/target/hexagon/gen_analyze_funcs.py b/target/hexagon/gen_analy= ze_funcs.py index 7e1f221b3c..0bb4fcb476 100755 --- a/target/hexagon/gen_analyze_funcs.py +++ b/target/hexagon/gen_analyze_funcs.py @@ -83,9 +83,16 @@ def analyze_opn_old(f, tag, regtype, regid, regno): else: print("Bad register parse: ", regtype, regid) elif (regtype =3D=3D "V"): + newv =3D "EXT_DFL" + if (hex_common.is_new_result(tag)): + newv =3D "EXT_NEW" + elif (hex_common.is_tmp_result(tag)): + newv =3D "EXT_TMP" if (regid in {"dd", "xx"}): - f.write("// const int %s =3D insn->regno[%d];\n" %\ + f.write(" const int %s =3D insn->regno[%d];\n" %\ (regN, regno)) + f.write(" ctx_log_vreg_write_pair(ctx, %s, %s, %s);\n" % \ + (regN, newv, predicated)) elif (regid in {"uu", "vv"}): f.write("// const int %s =3D insn->regno[%d];\n" % \ (regN, regno)) @@ -93,14 +100,18 @@ def analyze_opn_old(f, tag, regtype, regid, regno): f.write("// const int %s =3D insn->regno[%d];\n" % \ (regN, regno)) elif (regid in {"d", "x", "y"}): - f.write("// const int %s =3D insn->regno[%d];\n" % \ + f.write(" const int %s =3D insn->regno[%d];\n" % \ (regN, regno)) + f.write(" ctx_log_vreg_write(ctx, %s, %s, %s);\n" % \ + (regN, newv, predicated)) else: print("Bad register parse: ", regtype, regid) elif (regtype =3D=3D "Q"): if (regid in {"d", "e", "x"}): - f.write("// const int %s =3D insn->regno[%d];\n" % \ + f.write(" const int %s =3D insn->regno[%d];\n" % \ (regN, regno)) + f.write(" ctx_log_qreg_write(ctx, %s, %s);\n" % \ + (regN, predicated)) elif (regid in {"s", "t", "u", "v"}): f.write("// const int %s =3D insn->regno[%d];\n" % \ (regN, regno)) diff --git a/target/hexagon/gen_tcg_funcs.py b/target/hexagon/gen_tcg_funcs= .py index 02fa65c5c9..22bcb56917 100755 --- a/target/hexagon/gen_tcg_funcs.py +++ b/target/hexagon/gen_tcg_funcs.py @@ -152,17 +152,6 @@ def genptr_decl(f, tag, regtype, regid, regno): f.write(" ctx_future_vreg_off(ctx, %s%sN," % \ (regtype, regid)) f.write(" 1, true);\n"); - if 'A_CONDEXEC' in hex_common.attribdict[tag]: - f.write(" if (!is_vreg_preloaded(ctx, %s)) {\n" % (regN= )) - f.write(" intptr_t src_off =3D") - f.write(" offsetof(CPUHexagonState, VRegs[%s%sN]);\n"% \ - (regtype, regid)) - f.write(" tcg_gen_gvec_mov(MO_64, %s%sV_off,\n" % \ - (regtype, regid)) - f.write(" src_off,\n") - f.write(" sizeof(MMVector),\n") - f.write(" sizeof(MMVector));\n") - f.write(" }\n") =20 if (not hex_common.skip_qemu_helper(tag)): f.write(" TCGv_ptr %s%sV =3D tcg_temp_new_ptr();\n" % \ @@ -421,9 +410,6 @@ def genptr_dst_write_ext(f, tag, regtype, regid, newv= =3D"EXT_DFL"): (regtype, regid, regtype, regid)) f.write("%s, insn->slot, %s);\n" % \ (newv, is_predicated)) - f.write(" ctx_log_vreg_write_pair(ctx, %s%sN, %s,\n" % \ - (regtype, regid, newv)) - f.write(" %s);\n" % (is_predicated)) elif (regid in {"d", "x", "y"}): if ('A_CONDEXEC' in hex_common.attribdict[tag]): is_predicated =3D "true" @@ -433,8 +419,6 @@ def genptr_dst_write_ext(f, tag, regtype, regid, newv= =3D"EXT_DFL"): (regtype, regid, regtype, regid, newv)) f.write("insn->slot, %s);\n" % \ (is_predicated)) - f.write(" ctx_log_vreg_write(ctx, %s%sN, %s, %s);\n" % \ - (regtype, regid, newv, is_predicated)) else: print("Bad register parse: ", regtype, regid) elif (regtype =3D=3D "Q"): @@ -446,8 +430,6 @@ def genptr_dst_write_ext(f, tag, regtype, regid, newv= =3D"EXT_DFL"): f.write(" gen_log_qreg_write(%s%sV_off, %s%sN, %s, " % \ (regtype, regid, regtype, regid, newv)) f.write("insn->slot, %s);\n" % (is_predicated)) - f.write(" ctx_log_qreg_write(ctx, %s%sN, %s);\n" % \ - (regtype, regid, is_predicated)) else: print("Bad register parse: ", regtype, regid) else: --=20 2.25.1 From nobody Sun May 5 04:04:05 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=quicinc.com ARC-Seal: i=1; a=rsa-sha256; t=1678167339; cv=none; d=zohomail.com; s=zohoarc; b=Wp/rkpiPIyAmmtfHyyh1BaVZUmOAe6oi7ZGYVWEG8Mb5z4+JaZnhwzL9fhccmFYR8nRRhv7bYXqVrsMKd2ZsE5bXGzHK+tS6z/KrrGBzbvNiTGiPG0pDPU6i6gRPq/85M8VKplghdqN9IChqgKcgoWEFsWn3tAHLnOXlcu+1ODc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678167339; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=DftNTCunuaGpy0SCoHtJ8V095xA9SonOkeK36BnATak=; b=MqIh32+bUt01J1s7IE7iUaQCsqLVcAWFxDaSkB6ofzNyr8rhfAlGhi0cle0jSt1Brw7hlUBS8xvZNIDnQgjIgI6oQgksiH+TKjF+3EOWYYtO0lTLwx0nuamtBVUV6ggGW146VlSZVwknILSrt8+YyLg37yChG5x8bKend5JttsU= 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+importer2=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 167816733918972.84289792567188; Mon, 6 Mar 2023 21:35:39 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZPyg-0006pJ-0U; Tue, 07 Mar 2023 00:35:10 -0500 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 1pZPyR-0006bR-RQ for qemu-devel@nongnu.org; Tue, 07 Mar 2023 00:34:56 -0500 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 1pZPyL-0006Zx-Hx for qemu-devel@nongnu.org; Tue, 07 Mar 2023 00:34:55 -0500 Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3275FFli010266; Tue, 7 Mar 2023 05:34:47 GMT Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3p418771t1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Mar 2023 05:34:47 +0000 Received: from pps.filterd (NALASPPMTA03.qualcomm.com [127.0.0.1]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTP id 3275TVTM012156; Tue, 7 Mar 2023 05:34:46 GMT Received: from pps.reinject (localhost [127.0.0.1]) by NALASPPMTA03.qualcomm.com (PPS) with ESMTPS id 3p4fjsvd1j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Mar 2023 05:34:46 +0000 Received: from NALASPPMTA03.qualcomm.com (NALASPPMTA03.qualcomm.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3275YhPA020238; Tue, 7 Mar 2023 05:34:43 GMT Received: from hu-devc-sd-u20-a-1.qualcomm.com (hu-tsimpson-lv.qualcomm.com [10.47.204.221]) by NALASPPMTA03.qualcomm.com (PPS) with ESMTPS id 3275Yhui020226 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Mar 2023 05:34:43 +0000 Received: by hu-devc-sd-u20-a-1.qualcomm.com (Postfix, from userid 47164) id 9F403A79; Mon, 6 Mar 2023 21:34:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=qcppdkim1; bh=DftNTCunuaGpy0SCoHtJ8V095xA9SonOkeK36BnATak=; b=CcQ9ASzqD15cANGLMi25Z7Mary+i8OdAK01788G3a2qpkodiNr8FhQ6+cId5U3rQTi5u sBmxVxP4htUaJhFbJ9BsnxRcz7dWPBcDYNNno2rHXedjA70Zdje66BqACpOTQjuariLR rKeXtWnXXshLkRWVlQfSa5F9kqnmM9+FLNun+FS+k2lW3qqv3CI2k9kBwzct3Ab8ZXKD o2hoL0NbWXwNBB1ONo+36h5tR5+kt/eq4qnkUsvcDZA01R7QzcVu4SB5FjFUtt3RAePd 867bgmSqfhpFNMo/xeqA8KWU2IsnOiXqn5wh7f6JyfogYfDrNPWHqrvmcXDAikI9C42F lA== From: Taylor Simpson To: qemu-devel@nongnu.org Cc: tsimpson@quicinc.com, richard.henderson@linaro.org, philmd@linaro.org, peter.maydell@linaro.org, bcain@quicinc.com, quic_mathbern@quicinc.com, stefanha@redhat.com, ale@rev.ng, anjo@rev.ng Subject: [PULL 11/17] Hexagon (tests/tcg/hexagon) Update preg_alias.c Date: Mon, 6 Mar 2023 21:34:32 -0800 Message-Id: <20230307053438.2416629-12-tsimpson@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230307053438.2416629-1-tsimpson@quicinc.com> References: <20230307053438.2416629-1-tsimpson@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: JimDxN4L6VeqgcMC27r090QsVVjR50Bg X-Proofpoint-ORIG-GUID: JimDxN4L6VeqgcMC27r090QsVVjR50Bg X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-06_14,2023-03-06_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 adultscore=0 priorityscore=1501 mlxscore=0 phishscore=0 lowpriorityscore=0 malwarescore=0 mlxlogscore=524 bulkscore=0 suspectscore=0 spamscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303070050 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.220.168.131; envelope-from=tsimpson@qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @quicinc.com) X-ZM-MESSAGEID: 1678167340585100009 Add control registers (c4, c5) to clobbers list Made possible by new toolchain container Signed-off-by: Taylor Simpson Reviewed-by: Anton Johansson Message-Id: <20230307025828.1612809-9-tsimpson@quicinc.com> --- tests/tcg/hexagon/preg_alias.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/tcg/hexagon/preg_alias.c b/tests/tcg/hexagon/preg_alias.c index b44a8112b4..8798fbcaf3 100644 --- a/tests/tcg/hexagon/preg_alias.c +++ b/tests/tcg/hexagon/preg_alias.c @@ -1,5 +1,5 @@ /* - * Copyright(c) 2019-2022 Qualcomm Innovation Center, Inc. All Rights Res= erved. + * Copyright(c) 2019-2023 Qualcomm Innovation Center, Inc. All Rights Res= erved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -65,7 +65,7 @@ static inline void creg_alias(int cval, PRegs *pregs) : "=3Dr"(pregs->pregs.p0), "=3Dr"(pregs->pregs.p1), "=3Dr"(pregs->pregs.p2), "=3Dr"(pregs->pregs.p3) : "r"(cval) - : "p0", "p1", "p2", "p3"); + : "c4", "p0", "p1", "p2", "p3"); } =20 int err; @@ -92,7 +92,7 @@ static inline void creg_alias_pair(unsigned int cval, PRe= gs *pregs) : "=3Dr"(pregs->pregs.p0), "=3Dr"(pregs->pregs.p1), "=3Dr"(pregs->pregs.p2), "=3Dr"(pregs->pregs.p3), "=3Dr"(c5) : "r"(cval_pair) - : "p0", "p1", "p2", "p3"); + : "c4", "c5", "p0", "p1", "p2", "p3"); =20 check(c5, 0xdeadbeef); } @@ -117,7 +117,7 @@ static void test_packet(void) "}\n\t" : "+r"(result) : "r"(0xffffffff), "r"(0xff00ffff), "r"(0x837ed653) - : "p0", "p1", "p2", "p3"); + : "c4", "p0", "p1", "p2", "p3"); check(result, old_val); =20 /* Test a predicated store */ @@ -129,7 +129,7 @@ static void test_packet(void) "}\n\t" : : "r"(0), "r"(0xffffffff), "r"(&result) - : "p0", "p1", "p2", "p3", "memory"); + : "c4", "p0", "p1", "p2", "p3", "memory"); check(result, 0x0); } =20 --=20 2.25.1 From nobody Sun May 5 04:04:05 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=quicinc.com ARC-Seal: i=1; a=rsa-sha256; t=1678167421; cv=none; d=zohomail.com; s=zohoarc; b=GF4jSGb+6skzzpwSMdABs3g1xYd0Hxd1lcALvA61Q6L6zbaoT7m2c7n8cVUdfmpmeFYlZBR4ZuskP+Dx4AO2x0HmbhoM5lrF+1EZ/GGS48ukd9PxxJdjmmdoZb92K6kStODglOKTaNHJhmiFyhdSvamMjfND80pxtODl0SGbz0g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678167421; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=hWo/YAs+ZJCiDdk4rMgoyCzcTGXFJPwabXnn4Vmj87c=; b=j0mBrlJaPGnAu+OJIxRV+RIQfoaHGoL+eKTmtdVFwmNpdnbYzsGbUR41tEOBbJ75DezIUXUe/dIpMO9SuiumCqyLvSBsqLEHOXQ1V8rvHIUHXMtmuEU+Nv1hDhNWBUeogXqNRvZISc47UmJcdlHcK4VKnr+ty/R6zdRcWENR4mE= 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+importer2=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 1678167421355112.76688926627469; Mon, 6 Mar 2023 21:37:01 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZPyq-0006t8-Fh; Tue, 07 Mar 2023 00:35:20 -0500 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 1pZPyR-0006bT-RS for qemu-devel@nongnu.org; Tue, 07 Mar 2023 00:34:56 -0500 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 1pZPyJ-0006ZG-WD for qemu-devel@nongnu.org; Tue, 07 Mar 2023 00:34:54 -0500 Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32750aZb009925; Tue, 7 Mar 2023 05:34:45 GMT Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3p5xrb824y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Mar 2023 05:34:45 +0000 Received: from pps.filterd (NALASPPMTA04.qualcomm.com [127.0.0.1]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTP id 3275YiuY004505; Tue, 7 Mar 2023 05:34:44 GMT Received: from pps.reinject (localhost [127.0.0.1]) by NALASPPMTA04.qualcomm.com (PPS) with ESMTPS id 3p4few49m1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Mar 2023 05:34:44 +0000 Received: from NALASPPMTA04.qualcomm.com (NALASPPMTA04.qualcomm.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3275YhFS004491; Tue, 7 Mar 2023 05:34:43 GMT Received: from hu-devc-sd-u20-a-1.qualcomm.com (hu-tsimpson-lv.qualcomm.com [10.47.204.221]) by NALASPPMTA04.qualcomm.com (PPS) with ESMTPS id 3275YhV7004484 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Mar 2023 05:34:43 +0000 Received: by hu-devc-sd-u20-a-1.qualcomm.com (Postfix, from userid 47164) id A1E36A7D; Mon, 6 Mar 2023 21:34:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=qcppdkim1; bh=hWo/YAs+ZJCiDdk4rMgoyCzcTGXFJPwabXnn4Vmj87c=; b=dDzj2Sjj11yY4sAMzL22l9P8vLXxIPPJShHcN0waVYKXKyCEGJ/NP7HojOwgQswUXrSz /7SWNrRe/1SWL83BwkNKiUV2LtSyYU1gUXd+RNLlBt1dsRy2d2zoiYMK85Osf7m62/fG VykRx/Q0CvL6Y2zi8l9xMbCSDxn7PojTu9N7OueCOywkcBCoBhHdbeZ5+NW2ngDnFOyi X+0Hv61Ykgk15Y1nAjPLqyCeDWh/Di0K+5Ruw5bFtznHAj3XOksORmABijDIhSMAA4pO 9tw4E7qB7obhwak6V5k5Rr9XZOmBufvpTZ8gWL2iTVTW+kLiVLgMKj+PEHcim5wGYz3I VA== From: Taylor Simpson To: qemu-devel@nongnu.org Cc: tsimpson@quicinc.com, richard.henderson@linaro.org, philmd@linaro.org, peter.maydell@linaro.org, bcain@quicinc.com, quic_mathbern@quicinc.com, stefanha@redhat.com, ale@rev.ng, anjo@rev.ng Subject: [PULL 12/17] Hexagon (tests/tcg/hexagon) Remove __builtin from scatter_gather Date: Mon, 6 Mar 2023 21:34:33 -0800 Message-Id: <20230307053438.2416629-13-tsimpson@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230307053438.2416629-1-tsimpson@quicinc.com> References: <20230307053438.2416629-1-tsimpson@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: JE33cTbUJEI_OMaXhcTjU46BU0BZfYLw X-Proofpoint-GUID: JE33cTbUJEI_OMaXhcTjU46BU0BZfYLw X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-06_14,2023-03-06_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 phishscore=0 lowpriorityscore=0 adultscore=0 suspectscore=0 mlxlogscore=866 priorityscore=1501 impostorscore=0 mlxscore=0 spamscore=0 bulkscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303070050 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.220.168.131; envelope-from=tsimpson@qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @quicinc.com) X-ZM-MESSAGEID: 1678167423045100007 Replace __builtin_* with inline assembly The __builtin's are subject to change with different compiler releases, so might break Mark arrays as aligned when accessed as HVX vectors Clean up comments Signed-off-by: Taylor Simpson Reviewed-by: Anton Johansson Message-Id: <20230307025828.1612809-10-tsimpson@quicinc.com> --- tests/tcg/hexagon/scatter_gather.c | 513 +++++++++++++++-------------- 1 file changed, 271 insertions(+), 242 deletions(-) diff --git a/tests/tcg/hexagon/scatter_gather.c b/tests/tcg/hexagon/scatter= _gather.c index b93eb18133..bf8b5e0317 100644 --- a/tests/tcg/hexagon/scatter_gather.c +++ b/tests/tcg/hexagon/scatter_gather.c @@ -1,5 +1,5 @@ /* - * Copyright(c) 2019-2021 Qualcomm Innovation Center, Inc. All Rights Res= erved. + * Copyright(c) 2019-2023 Qualcomm Innovation Center, Inc. All Rights Res= erved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -40,47 +40,6 @@ typedef long HVX_VectorPair __attribute__((__vector_si= ze__(256))) typedef long HVX_VectorPred __attribute__((__vector_size__(128))) __attribute__((aligned(128))); =20 -#define VSCATTER_16(BASE, RGN, OFF, VALS) \ - __builtin_HEXAGON_V6_vscattermh_128B((int)BASE, RGN, OFF, VALS) -#define VSCATTER_16_MASKED(MASK, BASE, RGN, OFF, VALS) \ - __builtin_HEXAGON_V6_vscattermhq_128B(MASK, (int)BASE, RGN, OFF, VALS) -#define VSCATTER_32(BASE, RGN, OFF, VALS) \ - __builtin_HEXAGON_V6_vscattermw_128B((int)BASE, RGN, OFF, VALS) -#define VSCATTER_32_MASKED(MASK, BASE, RGN, OFF, VALS) \ - __builtin_HEXAGON_V6_vscattermwq_128B(MASK, (int)BASE, RGN, OFF, VALS) -#define VSCATTER_16_32(BASE, RGN, OFF, VALS) \ - __builtin_HEXAGON_V6_vscattermhw_128B((int)BASE, RGN, OFF, VALS) -#define VSCATTER_16_32_MASKED(MASK, BASE, RGN, OFF, VALS) \ - __builtin_HEXAGON_V6_vscattermhwq_128B(MASK, (int)BASE, RGN, OFF, VALS) -#define VSCATTER_16_ACC(BASE, RGN, OFF, VALS) \ - __builtin_HEXAGON_V6_vscattermh_add_128B((int)BASE, RGN, OFF, VALS) -#define VSCATTER_32_ACC(BASE, RGN, OFF, VALS) \ - __builtin_HEXAGON_V6_vscattermw_add_128B((int)BASE, RGN, OFF, VALS) -#define VSCATTER_16_32_ACC(BASE, RGN, OFF, VALS) \ - __builtin_HEXAGON_V6_vscattermhw_add_128B((int)BASE, RGN, OFF, VALS) - -#define VGATHER_16(DSTADDR, BASE, RGN, OFF) \ - __builtin_HEXAGON_V6_vgathermh_128B(DSTADDR, (int)BASE, RGN, OFF) -#define VGATHER_16_MASKED(DSTADDR, MASK, BASE, RGN, OFF) \ - __builtin_HEXAGON_V6_vgathermhq_128B(DSTADDR, MASK, (int)BASE, RGN, OF= F) -#define VGATHER_32(DSTADDR, BASE, RGN, OFF) \ - __builtin_HEXAGON_V6_vgathermw_128B(DSTADDR, (int)BASE, RGN, OFF) -#define VGATHER_32_MASKED(DSTADDR, MASK, BASE, RGN, OFF) \ - __builtin_HEXAGON_V6_vgathermwq_128B(DSTADDR, MASK, (int)BASE, RGN, OF= F) -#define VGATHER_16_32(DSTADDR, BASE, RGN, OFF) \ - __builtin_HEXAGON_V6_vgathermhw_128B(DSTADDR, (int)BASE, RGN, OFF) -#define VGATHER_16_32_MASKED(DSTADDR, MASK, BASE, RGN, OFF) \ - __builtin_HEXAGON_V6_vgathermhwq_128B(DSTADDR, MASK, (int)BASE, RGN, O= FF) - -#define VSHUFF_H(V) \ - __builtin_HEXAGON_V6_vshuffh_128B(V) -#define VSPLAT_H(X) \ - __builtin_HEXAGON_V6_lvsplath_128B(X) -#define VAND_VAL(PRED, VAL) \ - __builtin_HEXAGON_V6_vandvrt_128B(PRED, VAL) -#define VDEAL_H(V) \ - __builtin_HEXAGON_V6_vdealh_128B(V) - int err; =20 /* define the number of rows/cols in a square matrix */ @@ -108,22 +67,22 @@ unsigned short vscatter16_32_ref[SCATTER_BUFFER_SIZE]; unsigned short vgather16_32_ref[MATRIX_SIZE]; =20 /* declare the arrays of offsets */ -unsigned short half_offsets[MATRIX_SIZE]; -unsigned int word_offsets[MATRIX_SIZE]; +unsigned short half_offsets[MATRIX_SIZE] __attribute__((aligned(128))); +unsigned int word_offsets[MATRIX_SIZE] __attribute__((aligned(128))); =20 /* declare the arrays of values */ -unsigned short half_values[MATRIX_SIZE]; -unsigned short half_values_acc[MATRIX_SIZE]; -unsigned short half_values_masked[MATRIX_SIZE]; -unsigned int word_values[MATRIX_SIZE]; -unsigned int word_values_acc[MATRIX_SIZE]; -unsigned int word_values_masked[MATRIX_SIZE]; +unsigned short half_values[MATRIX_SIZE] __attribute__((aligned(128))); +unsigned short half_values_acc[MATRIX_SIZE] __attribute__((aligned(128))); +unsigned short half_values_masked[MATRIX_SIZE] __attribute__((aligned(128)= )); +unsigned int word_values[MATRIX_SIZE] __attribute__((aligned(128))); +unsigned int word_values_acc[MATRIX_SIZE] __attribute__((aligned(128))); +unsigned int word_values_masked[MATRIX_SIZE] __attribute__((aligned(128)= )); =20 /* declare the arrays of predicates */ -unsigned short half_predicates[MATRIX_SIZE]; -unsigned int word_predicates[MATRIX_SIZE]; +unsigned short half_predicates[MATRIX_SIZE] __attribute__((aligned(128))); +unsigned int word_predicates[MATRIX_SIZE] __attribute__((aligned(128))); =20 -/* make this big enough for all the intrinsics */ +/* make this big enough for all the operations */ const size_t region_len =3D sizeof(vtcm); =20 /* optionally add sync instructions */ @@ -261,164 +220,201 @@ void create_offsets_values_preds_16_32(void) } } =20 -/* scatter the 16 bit elements using intrinsics */ +/* scatter the 16 bit elements using HVX */ void vector_scatter_16(void) { - /* copy the offsets and values to vectors */ - HVX_Vector offsets =3D *(HVX_Vector *)half_offsets; - HVX_Vector values =3D *(HVX_Vector *)half_values; - - VSCATTER_16(&vtcm.vscatter16, region_len, offsets, values); + asm ("m0 =3D %1\n\t" + "v0 =3D vmem(%2 + #0)\n\t" + "v1 =3D vmem(%3 + #0)\n\t" + "vscatter(%0, m0, v0.h).h =3D v1\n\t" + : : "r"(vtcm.vscatter16), "r"(region_len), + "r"(half_offsets), "r"(half_values) + : "m0", "v0", "v1", "memory"); =20 sync_scatter(vtcm.vscatter16); } =20 -/* scatter-accumulate the 16 bit elements using intrinsics */ +/* scatter-accumulate the 16 bit elements using HVX */ void vector_scatter_16_acc(void) { - /* copy the offsets and values to vectors */ - HVX_Vector offsets =3D *(HVX_Vector *)half_offsets; - HVX_Vector values =3D *(HVX_Vector *)half_values_acc; - - VSCATTER_16_ACC(&vtcm.vscatter16, region_len, offsets, values); + asm ("m0 =3D %1\n\t" + "v0 =3D vmem(%2 + #0)\n\t" + "v1 =3D vmem(%3 + #0)\n\t" + "vscatter(%0, m0, v0.h).h +=3D v1\n\t" + : : "r"(vtcm.vscatter16), "r"(region_len), + "r"(half_offsets), "r"(half_values_acc) + : "m0", "v0", "v1", "memory"); =20 sync_scatter(vtcm.vscatter16); } =20 -/* scatter the 16 bit elements using intrinsics */ +/* masked scatter the 16 bit elements using HVX */ void vector_scatter_16_masked(void) { - /* copy the offsets and values to vectors */ - HVX_Vector offsets =3D *(HVX_Vector *)half_offsets; - HVX_Vector values =3D *(HVX_Vector *)half_values_masked; - HVX_Vector pred_reg =3D *(HVX_Vector *)half_predicates; - HVX_VectorPred preds =3D VAND_VAL(pred_reg, ~0); - - VSCATTER_16_MASKED(preds, &vtcm.vscatter16, region_len, offsets, value= s); + asm ("r1 =3D #-1\n\t" + "v0 =3D vmem(%0 + #0)\n\t" + "q0 =3D vand(v0, r1)\n\t" + "m0 =3D %2\n\t" + "v0 =3D vmem(%3 + #0)\n\t" + "v1 =3D vmem(%4 + #0)\n\t" + "if (q0) vscatter(%1, m0, v0.h).h =3D v1\n\t" + : : "r"(half_predicates), "r"(vtcm.vscatter16), "r"(region_len), + "r"(half_offsets), "r"(half_values_masked) + : "r1", "q0", "m0", "q0", "v0", "v1", "memory"); =20 sync_scatter(vtcm.vscatter16); } =20 -/* scatter the 32 bit elements using intrinsics */ +/* scatter the 32 bit elements using HVX */ void vector_scatter_32(void) { - /* copy the offsets and values to vectors */ - HVX_Vector offsetslo =3D *(HVX_Vector *)word_offsets; - HVX_Vector offsetshi =3D *(HVX_Vector *)&word_offsets[MATRIX_SIZE / 2]; - HVX_Vector valueslo =3D *(HVX_Vector *)word_values; - HVX_Vector valueshi =3D *(HVX_Vector *)&word_values[MATRIX_SIZE / 2]; - - VSCATTER_32(&vtcm.vscatter32, region_len, offsetslo, valueslo); - VSCATTER_32(&vtcm.vscatter32, region_len, offsetshi, valueshi); + HVX_Vector *offsetslo =3D (HVX_Vector *)word_offsets; + HVX_Vector *offsetshi =3D (HVX_Vector *)&word_offsets[MATRIX_SIZE / 2]; + HVX_Vector *valueslo =3D (HVX_Vector *)word_values; + HVX_Vector *valueshi =3D (HVX_Vector *)&word_values[MATRIX_SIZE / 2]; + + asm ("m0 =3D %1\n\t" + "v0 =3D vmem(%2 + #0)\n\t" + "v1 =3D vmem(%3 + #0)\n\t" + "vscatter(%0, m0, v0.w).w =3D v1\n\t" + : : "r"(vtcm.vscatter32), "r"(region_len), + "r"(offsetslo), "r"(valueslo) + : "m0", "v0", "v1", "memory"); + asm ("m0 =3D %1\n\t" + "v0 =3D vmem(%2 + #0)\n\t" + "v1 =3D vmem(%3 + #0)\n\t" + "vscatter(%0, m0, v0.w).w =3D v1\n\t" + : : "r"(vtcm.vscatter32), "r"(region_len), + "r"(offsetshi), "r"(valueshi) + : "m0", "v0", "v1", "memory"); =20 sync_scatter(vtcm.vscatter32); } =20 -/* scatter-acc the 32 bit elements using intrinsics */ +/* scatter-accumulate the 32 bit elements using HVX */ void vector_scatter_32_acc(void) { - /* copy the offsets and values to vectors */ - HVX_Vector offsetslo =3D *(HVX_Vector *)word_offsets; - HVX_Vector offsetshi =3D *(HVX_Vector *)&word_offsets[MATRIX_SIZE / 2]; - HVX_Vector valueslo =3D *(HVX_Vector *)word_values_acc; - HVX_Vector valueshi =3D *(HVX_Vector *)&word_values_acc[MATRIX_SIZE / = 2]; - - VSCATTER_32_ACC(&vtcm.vscatter32, region_len, offsetslo, valueslo); - VSCATTER_32_ACC(&vtcm.vscatter32, region_len, offsetshi, valueshi); + HVX_Vector *offsetslo =3D (HVX_Vector *)word_offsets; + HVX_Vector *offsetshi =3D (HVX_Vector *)&word_offsets[MATRIX_SIZE / 2]; + HVX_Vector *valueslo =3D (HVX_Vector *)word_values_acc; + HVX_Vector *valueshi =3D (HVX_Vector *)&word_values_acc[MATRIX_SIZE / = 2]; + + asm ("m0 =3D %1\n\t" + "v0 =3D vmem(%2 + #0)\n\t" + "v1 =3D vmem(%3 + #0)\n\t" + "vscatter(%0, m0, v0.w).w +=3D v1\n\t" + : : "r"(vtcm.vscatter32), "r"(region_len), + "r"(offsetslo), "r"(valueslo) + : "m0", "v0", "v1", "memory"); + asm ("m0 =3D %1\n\t" + "v0 =3D vmem(%2 + #0)\n\t" + "v1 =3D vmem(%3 + #0)\n\t" + "vscatter(%0, m0, v0.w).w +=3D v1\n\t" + : : "r"(vtcm.vscatter32), "r"(region_len), + "r"(offsetshi), "r"(valueshi) + : "m0", "v0", "v1", "memory"); =20 sync_scatter(vtcm.vscatter32); } =20 -/* scatter the 32 bit elements using intrinsics */ +/* masked scatter the 32 bit elements using HVX */ void vector_scatter_32_masked(void) { - /* copy the offsets and values to vectors */ - HVX_Vector offsetslo =3D *(HVX_Vector *)word_offsets; - HVX_Vector offsetshi =3D *(HVX_Vector *)&word_offsets[MATRIX_SIZE / 2]; - HVX_Vector valueslo =3D *(HVX_Vector *)word_values_masked; - HVX_Vector valueshi =3D *(HVX_Vector *)&word_values_masked[MATRIX_SIZE= / 2]; - HVX_Vector pred_reglo =3D *(HVX_Vector *)word_predicates; - HVX_Vector pred_reghi =3D *(HVX_Vector *)&word_predicates[MATRIX_SIZE = / 2]; - HVX_VectorPred predslo =3D VAND_VAL(pred_reglo, ~0); - HVX_VectorPred predshi =3D VAND_VAL(pred_reghi, ~0); - - VSCATTER_32_MASKED(predslo, &vtcm.vscatter32, region_len, offsetslo, - valueslo); - VSCATTER_32_MASKED(predshi, &vtcm.vscatter32, region_len, offsetshi, - valueshi); + HVX_Vector *offsetslo =3D (HVX_Vector *)word_offsets; + HVX_Vector *offsetshi =3D (HVX_Vector *)&word_offsets[MATRIX_SIZE / 2]; + HVX_Vector *valueslo =3D (HVX_Vector *)word_values_masked; + HVX_Vector *valueshi =3D (HVX_Vector *)&word_values_masked[MATRIX_SIZE= / 2]; + HVX_Vector *predslo =3D (HVX_Vector *)word_predicates; + HVX_Vector *predshi =3D (HVX_Vector *)&word_predicates[MATRIX_SIZE / 2= ]; + + asm ("r1 =3D #-1\n\t" + "v0 =3D vmem(%0 + #0)\n\t" + "q0 =3D vand(v0, r1)\n\t" + "m0 =3D %2\n\t" + "v0 =3D vmem(%3 + #0)\n\t" + "v1 =3D vmem(%4 + #0)\n\t" + "if (q0) vscatter(%1, m0, v0.w).w =3D v1\n\t" + : : "r"(predslo), "r"(vtcm.vscatter32), "r"(region_len), + "r"(offsetslo), "r"(valueslo) + : "r1", "q0", "m0", "q0", "v0", "v1", "memory"); + asm ("r1 =3D #-1\n\t" + "v0 =3D vmem(%0 + #0)\n\t" + "q0 =3D vand(v0, r1)\n\t" + "m0 =3D %2\n\t" + "v0 =3D vmem(%3 + #0)\n\t" + "v1 =3D vmem(%4 + #0)\n\t" + "if (q0) vscatter(%1, m0, v0.w).w =3D v1\n\t" + : : "r"(predshi), "r"(vtcm.vscatter32), "r"(region_len), + "r"(offsetshi), "r"(valueshi) + : "r1", "q0", "m0", "q0", "v0", "v1", "memory"); =20 - sync_scatter(vtcm.vscatter16); + sync_scatter(vtcm.vscatter32); } =20 -/* scatter the 16 bit elements with 32 bit offsets using intrinsics */ +/* scatter the 16 bit elements with 32 bit offsets using HVX */ void vector_scatter_16_32(void) { - HVX_VectorPair offsets; - HVX_Vector values; - - /* get the word offsets in a vector pair */ - offsets =3D *(HVX_VectorPair *)word_offsets; - - /* these values need to be shuffled for the scatter */ - values =3D *(HVX_Vector *)half_values; - values =3D VSHUFF_H(values); - - VSCATTER_16_32(&vtcm.vscatter16_32, region_len, offsets, values); + asm ("m0 =3D %1\n\t" + "v0 =3D vmem(%2 + #0)\n\t" + "v1 =3D vmem(%2 + #1)\n\t" + "v2 =3D vmem(%3 + #0)\n\t" + "v2.h =3D vshuff(v2.h)\n\t" /* shuffle the values for the scatte= r */ + "vscatter(%0, m0, v1:0.w).h =3D v2\n\t" + : : "r"(vtcm.vscatter16_32), "r"(region_len), + "r"(word_offsets), "r"(half_values) + : "m0", "v0", "v1", "v2", "memory"); =20 sync_scatter(vtcm.vscatter16_32); } =20 -/* scatter-acc the 16 bit elements with 32 bit offsets using intrinsics */ +/* scatter-accumulate the 16 bit elements with 32 bit offsets using HVX */ void vector_scatter_16_32_acc(void) { - HVX_VectorPair offsets; - HVX_Vector values; - - /* get the word offsets in a vector pair */ - offsets =3D *(HVX_VectorPair *)word_offsets; - - /* these values need to be shuffled for the scatter */ - values =3D *(HVX_Vector *)half_values_acc; - values =3D VSHUFF_H(values); - - VSCATTER_16_32_ACC(&vtcm.vscatter16_32, region_len, offsets, values); + asm ("m0 =3D %1\n\t" + "v0 =3D vmem(%2 + #0)\n\t" + "v1 =3D vmem(%2 + #1)\n\t" + "v2 =3D vmem(%3 + #0)\n\t" \ + "v2.h =3D vshuff(v2.h)\n\t" /* shuffle the values for the scatte= r */ + "vscatter(%0, m0, v1:0.w).h +=3D v2\n\t" + : : "r"(vtcm.vscatter16_32), "r"(region_len), + "r"(word_offsets), "r"(half_values_acc) + : "m0", "v0", "v1", "v2", "memory"); =20 sync_scatter(vtcm.vscatter16_32); } =20 -/* masked scatter the 16 bit elements with 32 bit offsets using intrinsics= */ +/* masked scatter the 16 bit elements with 32 bit offsets using HVX */ void vector_scatter_16_32_masked(void) { - HVX_VectorPair offsets; - HVX_Vector values; - HVX_Vector pred_reg; - - /* get the word offsets in a vector pair */ - offsets =3D *(HVX_VectorPair *)word_offsets; - - /* these values need to be shuffled for the scatter */ - values =3D *(HVX_Vector *)half_values_masked; - values =3D VSHUFF_H(values); - - pred_reg =3D *(HVX_Vector *)half_predicates; - pred_reg =3D VSHUFF_H(pred_reg); - HVX_VectorPred preds =3D VAND_VAL(pred_reg, ~0); - - VSCATTER_16_32_MASKED(preds, &vtcm.vscatter16_32, region_len, offsets, - values); + asm ("r1 =3D #-1\n\t" + "v0 =3D vmem(%0 + #0)\n\t" + "v0.h =3D vshuff(v0.h)\n\t" /* shuffle the predicates */ + "q0 =3D vand(v0, r1)\n\t" + "m0 =3D %2\n\t" + "v0 =3D vmem(%3 + #0)\n\t" + "v1 =3D vmem(%3 + #1)\n\t" + "v2 =3D vmem(%4 + #0)\n\t" \ + "v2.h =3D vshuff(v2.h)\n\t" /* shuffle the values for the scatte= r */ + "if (q0) vscatter(%1, m0, v1:0.w).h =3D v2\n\t" + : : "r"(half_predicates), "r"(vtcm.vscatter16_32), "r"(region_len= ), + "r"(word_offsets), "r"(half_values_masked) + : "r1", "q0", "m0", "v0", "v1", "v2", "memory"); =20 sync_scatter(vtcm.vscatter16_32); } =20 -/* gather the elements from the scatter16 buffer */ +/* gather the elements from the scatter16 buffer using HVX */ void vector_gather_16(void) { - HVX_Vector *vgather =3D (HVX_Vector *)&vtcm.vgather16; - HVX_Vector offsets =3D *(HVX_Vector *)half_offsets; - - VGATHER_16(vgather, &vtcm.vscatter16, region_len, offsets); - - sync_gather(vgather); + asm ("m0 =3D %1\n\t" + "v0 =3D vmem(%2 + #0)\n\t" + "{ vtmp.h =3D vgather(%0, m0, v0.h).h\n\t" + " vmem(%3 + #0) =3D vtmp.new }\n\t" + : : "r"(vtcm.vscatter16), "r"(region_len), + "r"(half_offsets), "r"(vtcm.vgather16) + : "m0", "v0", "memory"); + + sync_gather(vtcm.vgather16); } =20 static unsigned short gather_16_masked_init(void) @@ -427,31 +423,51 @@ static unsigned short gather_16_masked_init(void) return letter | (letter << 8); } =20 +/* masked gather the elements from the scatter16 buffer using HVX */ void vector_gather_16_masked(void) { - HVX_Vector *vgather =3D (HVX_Vector *)&vtcm.vgather16; - HVX_Vector offsets =3D *(HVX_Vector *)half_offsets; - HVX_Vector pred_reg =3D *(HVX_Vector *)half_predicates; - HVX_VectorPred preds =3D VAND_VAL(pred_reg, ~0); - - *vgather =3D VSPLAT_H(gather_16_masked_init()); - VGATHER_16_MASKED(vgather, preds, &vtcm.vscatter16, region_len, offset= s); - - sync_gather(vgather); + unsigned short init =3D gather_16_masked_init(); + + asm ("v0.h =3D vsplat(%5)\n\t" + "vmem(%4 + #0) =3D v0\n\t" /* initialize the write area */ + "r1 =3D #-1\n\t" + "v0 =3D vmem(%0 + #0)\n\t" + "q0 =3D vand(v0, r1)\n\t" + "m0 =3D %2\n\t" + "v0 =3D vmem(%3 + #0)\n\t" + "{ if (q0) vtmp.h =3D vgather(%1, m0, v0.h).h\n\t" + " vmem(%4 + #0) =3D vtmp.new }\n\t" + : : "r"(half_predicates), "r"(vtcm.vscatter16), "r"(region_len), + "r"(half_offsets), "r"(vtcm.vgather16), "r"(init) + : "r1", "q0", "m0", "v0", "memory"); + + sync_gather(vtcm.vgather16); } =20 -/* gather the elements from the scatter32 buffer */ +/* gather the elements from the scatter32 buffer using HVX */ void vector_gather_32(void) { - HVX_Vector *vgatherlo =3D (HVX_Vector *)&vtcm.vgather32; - HVX_Vector *vgatherhi =3D - (HVX_Vector *)((int)&vtcm.vgather32 + (MATRIX_SIZE * 2)); - HVX_Vector offsetslo =3D *(HVX_Vector *)word_offsets; - HVX_Vector offsetshi =3D *(HVX_Vector *)&word_offsets[MATRIX_SIZE / 2]; - - VGATHER_32(vgatherlo, &vtcm.vscatter32, region_len, offsetslo); - VGATHER_32(vgatherhi, &vtcm.vscatter32, region_len, offsetshi); + HVX_Vector *vgatherlo =3D (HVX_Vector *)vtcm.vgather32; + HVX_Vector *vgatherhi =3D (HVX_Vector *)&vtcm.vgather32[MATRIX_SIZE / = 2]; + HVX_Vector *offsetslo =3D (HVX_Vector *)word_offsets; + HVX_Vector *offsetshi =3D (HVX_Vector *)&word_offsets[MATRIX_SIZE / 2]; + + asm ("m0 =3D %1\n\t" + "v0 =3D vmem(%2 + #0)\n\t" + "{ vtmp.w =3D vgather(%0, m0, v0.w).w\n\t" + " vmem(%3 + #0) =3D vtmp.new }\n\t" + : : "r"(vtcm.vscatter32), "r"(region_len), + "r"(offsetslo), "r"(vgatherlo) + : "m0", "v0", "memory"); + asm ("m0 =3D %1\n\t" + "v0 =3D vmem(%2 + #0)\n\t" + "{ vtmp.w =3D vgather(%0, m0, v0.w).w\n\t" + " vmem(%3 + #0) =3D vtmp.new }\n\t" + : : "r"(vtcm.vscatter32), "r"(region_len), + "r"(offsetshi), "r"(vgatherhi) + : "m0", "v0", "memory"); =20 + sync_gather(vgatherlo); sync_gather(vgatherhi); } =20 @@ -461,79 +477,88 @@ static unsigned int gather_32_masked_init(void) return letter | (letter << 8) | (letter << 16) | (letter << 24); } =20 +/* masked gather the elements from the scatter32 buffer using HVX */ void vector_gather_32_masked(void) { - HVX_Vector *vgatherlo =3D (HVX_Vector *)&vtcm.vgather32; - HVX_Vector *vgatherhi =3D - (HVX_Vector *)((int)&vtcm.vgather32 + (MATRIX_SIZE * 2)); - HVX_Vector offsetslo =3D *(HVX_Vector *)word_offsets; - HVX_Vector offsetshi =3D *(HVX_Vector *)&word_offsets[MATRIX_SIZE / 2]; - HVX_Vector pred_reglo =3D *(HVX_Vector *)word_predicates; - HVX_VectorPred predslo =3D VAND_VAL(pred_reglo, ~0); - HVX_Vector pred_reghi =3D *(HVX_Vector *)&word_predicates[MATRIX_SIZE = / 2]; - HVX_VectorPred predshi =3D VAND_VAL(pred_reghi, ~0); - - *vgatherlo =3D VSPLAT_H(gather_32_masked_init()); - *vgatherhi =3D VSPLAT_H(gather_32_masked_init()); - VGATHER_32_MASKED(vgatherlo, predslo, &vtcm.vscatter32, region_len, - offsetslo); - VGATHER_32_MASKED(vgatherhi, predshi, &vtcm.vscatter32, region_len, - offsetshi); + unsigned int init =3D gather_32_masked_init(); + HVX_Vector *vgatherlo =3D (HVX_Vector *)vtcm.vgather32; + HVX_Vector *vgatherhi =3D (HVX_Vector *)&vtcm.vgather32[MATRIX_SIZE / = 2]; + HVX_Vector *offsetslo =3D (HVX_Vector *)word_offsets; + HVX_Vector *offsetshi =3D (HVX_Vector *)&word_offsets[MATRIX_SIZE / 2]; + HVX_Vector *predslo =3D (HVX_Vector *)word_predicates; + HVX_Vector *predshi =3D (HVX_Vector *)&word_predicates[MATRIX_SIZE / 2= ]; + + asm ("v0.h =3D vsplat(%5)\n\t" + "vmem(%4 + #0) =3D v0\n\t" /* initialize the write area */ + "r1 =3D #-1\n\t" + "v0 =3D vmem(%0 + #0)\n\t" + "q0 =3D vand(v0, r1)\n\t" + "m0 =3D %2\n\t" + "v0 =3D vmem(%3 + #0)\n\t" + "{ if (q0) vtmp.w =3D vgather(%1, m0, v0.w).w\n\t" + " vmem(%4 + #0) =3D vtmp.new }\n\t" + : : "r"(predslo), "r"(vtcm.vscatter32), "r"(region_len), + "r"(offsetslo), "r"(vgatherlo), "r"(init) + : "r1", "q0", "m0", "v0", "memory"); + asm ("v0.h =3D vsplat(%5)\n\t" + "vmem(%4 + #0) =3D v0\n\t" /* initialize the write area */ + "r1 =3D #-1\n\t" + "v0 =3D vmem(%0 + #0)\n\t" + "q0 =3D vand(v0, r1)\n\t" + "m0 =3D %2\n\t" + "v0 =3D vmem(%3 + #0)\n\t" + "{ if (q0) vtmp.w =3D vgather(%1, m0, v0.w).w\n\t" + " vmem(%4 + #0) =3D vtmp.new }\n\t" + : : "r"(predshi), "r"(vtcm.vscatter32), "r"(region_len), + "r"(offsetshi), "r"(vgatherhi), "r"(init) + : "r1", "q0", "m0", "v0", "memory"); =20 sync_gather(vgatherlo); sync_gather(vgatherhi); } =20 -/* gather the elements from the scatter16_32 buffer */ +/* gather the elements from the scatter16_32 buffer using HVX */ void vector_gather_16_32(void) { - HVX_Vector *vgather; - HVX_VectorPair offsets; - HVX_Vector values; - - /* get the vtcm address to gather from */ - vgather =3D (HVX_Vector *)&vtcm.vgather16_32; - - /* get the word offsets in a vector pair */ - offsets =3D *(HVX_VectorPair *)word_offsets; - - VGATHER_16_32(vgather, &vtcm.vscatter16_32, region_len, offsets); - - /* deal the elements to get the order back */ - values =3D *(HVX_Vector *)vgather; - values =3D VDEAL_H(values); - - /* write it back to vtcm address */ - *(HVX_Vector *)vgather =3D values; + asm ("m0 =3D %1\n\t" + "v0 =3D vmem(%2 + #0)\n\t" + "v1 =3D vmem(%2 + #1)\n\t" + "{ vtmp.h =3D vgather(%0, m0, v1:0.w).h\n\t" + " vmem(%3 + #0) =3D vtmp.new }\n\t" + "v0 =3D vmem(%3 + #0)\n\t" + "v0.h =3D vdeal(v0.h)\n\t" /* deal the elements to get the order= back */ + "vmem(%3 + #0) =3D v0\n\t" + : : "r"(vtcm.vscatter16_32), "r"(region_len), + "r"(word_offsets), "r"(vtcm.vgather16_32) + : "m0", "v0", "v1", "memory"); + + sync_gather(vtcm.vgather16_32); } =20 +/* masked gather the elements from the scatter16_32 buffer using HVX */ void vector_gather_16_32_masked(void) { - HVX_Vector *vgather; - HVX_VectorPair offsets; - HVX_Vector pred_reg; - HVX_VectorPred preds; - HVX_Vector values; - - /* get the vtcm address to gather from */ - vgather =3D (HVX_Vector *)&vtcm.vgather16_32; - - /* get the word offsets in a vector pair */ - offsets =3D *(HVX_VectorPair *)word_offsets; - pred_reg =3D *(HVX_Vector *)half_predicates; - pred_reg =3D VSHUFF_H(pred_reg); - preds =3D VAND_VAL(pred_reg, ~0); - - *vgather =3D VSPLAT_H(gather_16_masked_init()); - VGATHER_16_32_MASKED(vgather, preds, &vtcm.vscatter16_32, region_len, - offsets); - - /* deal the elements to get the order back */ - values =3D *(HVX_Vector *)vgather; - values =3D VDEAL_H(values); - - /* write it back to vtcm address */ - *(HVX_Vector *)vgather =3D values; + unsigned short init =3D gather_16_masked_init(); + + asm ("v0.h =3D vsplat(%5)\n\t" + "vmem(%4 + #0) =3D v0\n\t" /* initialize the write area */ + "r1 =3D #-1\n\t" + "v0 =3D vmem(%0 + #0)\n\t" + "v0.h =3D vshuff(v0.h)\n\t" /* shuffle the predicates */ + "q0 =3D vand(v0, r1)\n\t" + "m0 =3D %2\n\t" + "v0 =3D vmem(%3 + #0)\n\t" + "v1 =3D vmem(%3 + #1)\n\t" + "{ if (q0) vtmp.h =3D vgather(%1, m0, v1:0.w).h\n\t" + " vmem(%4 + #0) =3D vtmp.new }\n\t" + "v0 =3D vmem(%4 + #0)\n\t" + "v0.h =3D vdeal(v0.h)\n\t" /* deal the elements to get the order= back */ + "vmem(%4 + #0) =3D v0\n\t" + : : "r"(half_predicates), "r"(vtcm.vscatter16_32), "r"(region_len= ), + "r"(word_offsets), "r"(vtcm.vgather16_32), "r"(init) + : "r1", "q0", "m0", "v0", "v1", "memory"); + + sync_gather(vtcm.vgather16_32); } =20 static void check_buffer(const char *name, void *c, void *r, size_t size) @@ -579,6 +604,7 @@ void scalar_scatter_16_acc(unsigned short *vscatter16) } } =20 +/* scatter-accumulate the 16 bit elements using C */ void check_scatter_16_acc() { memset(vscatter16_ref, FILL_CHAR, @@ -589,7 +615,7 @@ void check_scatter_16_acc() SCATTER_BUFFER_SIZE * sizeof(unsigned short)); } =20 -/* scatter the 16 bit elements using C */ +/* masked scatter the 16 bit elements using C */ void scalar_scatter_16_masked(unsigned short *vscatter16) { for (int i =3D 0; i < MATRIX_SIZE; i++) { @@ -628,7 +654,7 @@ void check_scatter_32() SCATTER_BUFFER_SIZE * sizeof(unsigned int)); } =20 -/* scatter the 32 bit elements using C */ +/* scatter-accumulate the 32 bit elements using C */ void scalar_scatter_32_acc(unsigned int *vscatter32) { for (int i =3D 0; i < MATRIX_SIZE; ++i) { @@ -646,7 +672,7 @@ void check_scatter_32_acc() SCATTER_BUFFER_SIZE * sizeof(unsigned int)); } =20 -/* scatter the 32 bit elements using C */ +/* masked scatter the 32 bit elements using C */ void scalar_scatter_32_masked(unsigned int *vscatter32) { for (int i =3D 0; i < MATRIX_SIZE; i++) { @@ -667,7 +693,7 @@ void check_scatter_32_masked() SCATTER_BUFFER_SIZE * sizeof(unsigned int)); } =20 -/* scatter the 32 bit elements using C */ +/* scatter the 16 bit elements with 32 bit offsets using C */ void scalar_scatter_16_32(unsigned short *vscatter16_32) { for (int i =3D 0; i < MATRIX_SIZE; ++i) { @@ -684,7 +710,7 @@ void check_scatter_16_32() SCATTER_BUFFER_SIZE * sizeof(unsigned short)); } =20 -/* scatter the 32 bit elements using C */ +/* scatter-accumulate the 16 bit elements with 32 bit offsets using C */ void scalar_scatter_16_32_acc(unsigned short *vscatter16_32) { for (int i =3D 0; i < MATRIX_SIZE; ++i) { @@ -702,6 +728,7 @@ void check_scatter_16_32_acc() SCATTER_BUFFER_SIZE * sizeof(unsigned short)); } =20 +/* masked scatter the 16 bit elements with 32 bit offsets using C */ void scalar_scatter_16_32_masked(unsigned short *vscatter16_32) { for (int i =3D 0; i < MATRIX_SIZE; i++) { @@ -738,6 +765,7 @@ void check_gather_16() MATRIX_SIZE * sizeof(unsigned short)); } =20 +/* masked gather the elements from the scatter buffer using C */ void scalar_gather_16_masked(unsigned short *vgather16) { for (int i =3D 0; i < MATRIX_SIZE; ++i) { @@ -756,7 +784,7 @@ void check_gather_16_masked() MATRIX_SIZE * sizeof(unsigned short)); } =20 -/* gather the elements from the scatter buffer using C */ +/* gather the elements from the scatter32 buffer using C */ void scalar_gather_32(unsigned int *vgather32) { for (int i =3D 0; i < MATRIX_SIZE; ++i) { @@ -772,6 +800,7 @@ void check_gather_32(void) MATRIX_SIZE * sizeof(unsigned int)); } =20 +/* masked gather the elements from the scatter32 buffer using C */ void scalar_gather_32_masked(unsigned int *vgather32) { for (int i =3D 0; i < MATRIX_SIZE; ++i) { @@ -781,7 +810,6 @@ void scalar_gather_32_masked(unsigned int *vgather32) } } =20 - void check_gather_32_masked(void) { memset(vgather32_ref, gather_32_masked_init(), @@ -791,7 +819,7 @@ void check_gather_32_masked(void) vgather32_ref, MATRIX_SIZE * sizeof(unsigned int)); } =20 -/* gather the elements from the scatter buffer using C */ +/* gather the elements from the scatter16_32 buffer using C */ void scalar_gather_16_32(unsigned short *vgather16_32) { for (int i =3D 0; i < MATRIX_SIZE; ++i) { @@ -807,6 +835,7 @@ void check_gather_16_32(void) MATRIX_SIZE * sizeof(unsigned short)); } =20 +/* masked gather the elements from the scatter16_32 buffer using C */ void scalar_gather_16_32_masked(unsigned short *vgather16_32) { for (int i =3D 0; i < MATRIX_SIZE; ++i) { --=20 2.25.1 From nobody Sun May 5 04:04:05 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=quicinc.com ARC-Seal: i=1; a=rsa-sha256; t=1678167337; cv=none; d=zohomail.com; s=zohoarc; b=B2pfYu7ywEI5m0bUxym01GWOVwE/R8wTftnZW25ShppovxU48gvSZiBnCEQ4DSWV9j3Bm8W2hSsec9XAQPsmdGQWsdItx1R/o/krPCSSCdC9/vCAVp28tkW4hOmaY6mi40mTS0DaxxjsgLRtXNVyMqubUn2PD3SExThRMckCvtc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678167337; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=R3ix0+3f8UCzpg67JIDLcm+RdLSqaS5xA6Gr4vs1tmk=; b=DBhJDUgMfBC1q8dtUPVPy7UqTWt2xtN+HFcHg2y5cXPGYvNlwOk71cjHEG/Anc4sI6F+rTnzd3HAnX9CL2JtYXXkbxWD2BTsIvtk6z7rq7lko0ySAktdq5RVLDpcKVg0aqycUIG2YkGyKFQBmBCrt2nXMorL2Gc6CL5yp0ClxyM= 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+importer2=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 1678167337503292.79222615182505; Mon, 6 Mar 2023 21:35:37 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZPyU-0006io-Ga; Tue, 07 Mar 2023 00:34:58 -0500 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 1pZPyL-0006X8-T4 for qemu-devel@nongnu.org; Tue, 07 Mar 2023 00:34:53 -0500 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 1pZPyJ-0006Ym-3l for qemu-devel@nongnu.org; Tue, 07 Mar 2023 00:34:49 -0500 Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3274M1JL021740; Tue, 7 Mar 2023 05:34:45 GMT Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3p4g3mwskv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Mar 2023 05:34:45 +0000 Received: from pps.filterd (NALASPPMTA01.qualcomm.com [127.0.0.1]) by NALASPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTP id 3275Yi9D000545; Tue, 7 Mar 2023 05:34:44 GMT Received: from pps.reinject (localhost [127.0.0.1]) by NALASPPMTA01.qualcomm.com (PPS) with ESMTPS id 3p4fhbm8nn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Mar 2023 05:34:44 +0000 Received: from NALASPPMTA01.qualcomm.com (NALASPPMTA01.qualcomm.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3275YhVn000522; Tue, 7 Mar 2023 05:34:43 GMT Received: from hu-devc-sd-u20-a-1.qualcomm.com (hu-tsimpson-lv.qualcomm.com [10.47.204.221]) by NALASPPMTA01.qualcomm.com (PPS) with ESMTPS id 3275Yhm0000513 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Mar 2023 05:34:43 +0000 Received: by hu-devc-sd-u20-a-1.qualcomm.com (Postfix, from userid 47164) id A466CA83; Mon, 6 Mar 2023 21:34:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=qcppdkim1; bh=R3ix0+3f8UCzpg67JIDLcm+RdLSqaS5xA6Gr4vs1tmk=; b=DrcHPu2C3mVpw5eoNAOfLz0hLfWL3fLuMWB8MBSqecFaqbXCAEWbjVVz+/YuCSU8x5SI 2l/vhTQM0ulX4v5yZuexVaMXkYlA9IYo2kjGMUNr7CHAzUrj9vmjS8+KByJnNz32SXha 3hNYtieMO8NZtV4OYbwlh8F+tlgyHPlY2GEj2raynawEVGsgvGeNFloVBZ7YxL6mj04d fBiwStwpx5LVH5uF/2UXuBhwJepphlA1HKbagS0jevyDljfcolKbEUm8H29sXfLHTBEp XF6YVPDVjU8z3nKhBxxZKNgtOtvFjAGpAHWiIXokV8ojA82KylqKfOJdj49GCRIm/Zgv lA== From: Taylor Simpson To: qemu-devel@nongnu.org Cc: tsimpson@quicinc.com, richard.henderson@linaro.org, philmd@linaro.org, peter.maydell@linaro.org, bcain@quicinc.com, quic_mathbern@quicinc.com, stefanha@redhat.com, ale@rev.ng, anjo@rev.ng Subject: [PULL 13/17] Hexagon (tests/tcg/hexagon) Enable HVX tests Date: Mon, 6 Mar 2023 21:34:34 -0800 Message-Id: <20230307053438.2416629-14-tsimpson@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230307053438.2416629-1-tsimpson@quicinc.com> References: <20230307053438.2416629-1-tsimpson@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: CPZrl1QKbm0S1p9smGna3QmVXSUnt8MJ X-Proofpoint-GUID: CPZrl1QKbm0S1p9smGna3QmVXSUnt8MJ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-06_14,2023-03-06_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 lowpriorityscore=0 bulkscore=0 impostorscore=0 priorityscore=1501 suspectscore=0 mlxscore=0 clxscore=1015 adultscore=0 malwarescore=0 phishscore=0 mlxlogscore=699 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303070049 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.220.180.131; envelope-from=tsimpson@qualcomm.com; helo=mx0b-0031df01.pphosted.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @quicinc.com) X-ZM-MESSAGEID: 1678167338914100001 Made possible by new toolchain container Signed-off-by: Taylor Simpson Reviewed-by: Anton Johansson Message-Id: <20230307025828.1612809-11-tsimpson@quicinc.com> --- tests/tcg/hexagon/Makefile.target | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/tcg/hexagon/Makefile.target b/tests/tcg/hexagon/Makefile= .target index 18e6a5969e..0d82dfa76e 100644 --- a/tests/tcg/hexagon/Makefile.target +++ b/tests/tcg/hexagon/Makefile.target @@ -1,5 +1,5 @@ ## -## Copyright(c) 2019-2022 Qualcomm Innovation Center, Inc. All Rights Res= erved. +## Copyright(c) 2019-2023 Qualcomm Innovation Center, Inc. All Rights Res= erved. ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -45,6 +45,10 @@ HEX_TESTS +=3D fpstuff HEX_TESTS +=3D overflow HEX_TESTS +=3D signal_context HEX_TESTS +=3D reg_mut +HEX_TESTS +=3D vector_add_int +HEX_TESTS +=3D scatter_gather +HEX_TESTS +=3D hvx_misc +HEX_TESTS +=3D hvx_histogram =20 HEX_TESTS +=3D test_abs HEX_TESTS +=3D test_bitcnt @@ -78,3 +82,10 @@ TESTS +=3D $(HEX_TESTS) usr: usr.c $(CC) $(CFLAGS) -mv67t -O2 -Wno-inline-asm -Wno-expansion-to-defined $< -= o $@ $(LDFLAGS) =20 +scatter_gather: CFLAGS +=3D -mhvx +vector_add_int: CFLAGS +=3D -mhvx -fvectorize +hvx_misc: CFLAGS +=3D -mhvx +hvx_histogram: CFLAGS +=3D -mhvx -Wno-gnu-folding-constant + +hvx_histogram: hvx_histogram.c hvx_histogram_row.S + $(CC) $(CFLAGS) $(CROSS_CC_GUEST_CFLAGS) $^ -o $@ $(LDFLAGS) --=20 2.25.1 From nobody Sun May 5 04:04:05 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=quicinc.com ARC-Seal: i=1; a=rsa-sha256; t=1678167339; cv=none; d=zohomail.com; s=zohoarc; b=S5iGb2xVoZwU/IV4YsAeniYv0fWJ3EwjWT0y2uB2/9kyf4e2ztYoNvjFpJSaxToJXbzVpASsdbdNpTJRY/qDT7r5Omnpadww+BxwLZEx66GBxqzNCC2Zm4X94X6UjRoX7HiVI+fh+bbSAaBbBQaWkK0Hi8mwyO1vQIKv2gA9TwY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678167339; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=puiRbiKy0IM42b1U5NPnr63oIWRxYWdR5tMCWDcX3FA=; b=Zdbtpb/zvhZXNLEl3Cz0Skv43LrULEXmKuFgXiY0VDaylrNvOhQpFcbJINhN3WjsApvbe36gCdxPrCz+UaeyULiuzAm6/G0CWOkKcgef7xOzJkiX2IHGns6kSvNRxHoBe0kR0GYmlUTDQPcLMm052ByyGIqWIw2Yc4+M1iGn9Bg= 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+importer2=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 1678167339437237.7264769191463; Mon, 6 Mar 2023 21:35:39 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZPya-0006mf-IN; Tue, 07 Mar 2023 00:35:05 -0500 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 1pZPyP-0006Xp-9l for qemu-devel@nongnu.org; Tue, 07 Mar 2023 00:34:53 -0500 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 1pZPyK-0006ZB-0Z for qemu-devel@nongnu.org; Tue, 07 Mar 2023 00:34:53 -0500 Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32750w3R010154; Tue, 7 Mar 2023 05:34:45 GMT Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3p5xrb8250-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Mar 2023 05:34:45 +0000 Received: from pps.filterd (NALASPPMTA03.qualcomm.com [127.0.0.1]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTP id 3275YihP020269; Tue, 7 Mar 2023 05:34:44 GMT Received: from pps.reinject (localhost [127.0.0.1]) by NALASPPMTA03.qualcomm.com (PPS) with ESMTPS id 3p4fjsvd1m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Mar 2023 05:34:44 +0000 Received: from NALASPPMTA03.qualcomm.com (NALASPPMTA03.qualcomm.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3275Yh7u020248; Tue, 7 Mar 2023 05:34:43 GMT Received: from hu-devc-sd-u20-a-1.qualcomm.com (hu-tsimpson-lv.qualcomm.com [10.47.204.221]) by NALASPPMTA03.qualcomm.com (PPS) with ESMTPS id 3275Yhod020227 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Mar 2023 05:34:43 +0000 Received: by hu-devc-sd-u20-a-1.qualcomm.com (Postfix, from userid 47164) id A7524A84; Mon, 6 Mar 2023 21:34:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=qcppdkim1; bh=puiRbiKy0IM42b1U5NPnr63oIWRxYWdR5tMCWDcX3FA=; b=AcFU5edXb9ai7PF5h3dfok8P+97tyc92Cl0VevwQPu7VCgycMzZSt8Ul39gpY9wykSwO XgSmBdigkn8fKWK95l0a1uYlkLmc+EJtBdOKFc/lYTYXiFy21lik+ddwCqAMfYAdXedI G53ZLJkM/rTTxDa9p1v3iBvbd67GoUwxIvqpkxSx08kft0eWQEwTxz4x81t26WLlYeyf nsN/Pgzciqlhs/3NXnbBt4L/F9CsiFXGRoQFYbtKzZWc2QAiinH2mVB/axuqMBySmt4G 3gcRVs3qygdBzXufmWHpbLSYPLP3aeWRo/MzTOL+av9GwkPO9pjtPS8WxxR6e/ZUGj8Y iA== From: Taylor Simpson To: qemu-devel@nongnu.org Cc: tsimpson@quicinc.com, richard.henderson@linaro.org, philmd@linaro.org, peter.maydell@linaro.org, bcain@quicinc.com, quic_mathbern@quicinc.com, stefanha@redhat.com, ale@rev.ng, anjo@rev.ng Subject: [PULL 14/17] Hexagon (target/hexagon) Change subtract from zero to change sign Date: Mon, 6 Mar 2023 21:34:35 -0800 Message-Id: <20230307053438.2416629-15-tsimpson@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230307053438.2416629-1-tsimpson@quicinc.com> References: <20230307053438.2416629-1-tsimpson@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: ERBcmUZvXQ2q9cEzKueQjXg6wA28XOXh X-Proofpoint-GUID: ERBcmUZvXQ2q9cEzKueQjXg6wA28XOXh X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-06_14,2023-03-06_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 phishscore=0 lowpriorityscore=0 adultscore=0 suspectscore=0 mlxlogscore=442 priorityscore=1501 impostorscore=0 mlxscore=0 spamscore=0 bulkscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303070050 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.220.168.131; envelope-from=tsimpson@qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @quicinc.com) X-ZM-MESSAGEID: 1678167340597100010 The F2_sffms instruction [r0 -=3D sfmpy(r1, r2)] doesn't properly handle -0. Previously we would negate the input operand by subtracting from zero. Instead, we negate by changing the sign bit. Test case added to tests/tcg/hexagon/fpstuff.c Signed-off-by: Taylor Simpson Reviewed-by: Anton Johansson Message-Id: <20230307025828.1612809-12-tsimpson@quicinc.com> --- target/hexagon/op_helper.c | 2 +- tests/tcg/hexagon/fpstuff.c | 31 ++++++++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/target/hexagon/op_helper.c b/target/hexagon/op_helper.c index 38b8aee193..9425941c69 100644 --- a/target/hexagon/op_helper.c +++ b/target/hexagon/op_helper.c @@ -1169,7 +1169,7 @@ float32 HELPER(sffms)(CPUHexagonState *env, float32 R= xV, { float32 neg_RsV; arch_fpop_start(env); - neg_RsV =3D float32_sub(float32_zero, RsV, &env->fp_status); + neg_RsV =3D float32_set_sign(RsV, float32_is_neg(RsV) ? 0 : 1); RxV =3D internal_fmafx(neg_RsV, RtV, RxV, 0, &env->fp_status); arch_fpop_end(env); return RxV; diff --git a/tests/tcg/hexagon/fpstuff.c b/tests/tcg/hexagon/fpstuff.c index 56bf562a40..90ce9a6ef3 100644 --- a/tests/tcg/hexagon/fpstuff.c +++ b/tests/tcg/hexagon/fpstuff.c @@ -1,5 +1,5 @@ /* - * Copyright(c) 2020-2022 Qualcomm Innovation Center, Inc. All Rights Res= erved. + * Copyright(c) 2020-2023 Qualcomm Innovation Center, Inc. All Rights Res= erved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -40,6 +40,7 @@ const int SF_HEX_NAN =3D 0xffffffff; const int SF_small_neg =3D 0xab98fba8; const int SF_denorm =3D 0x00000001; const int SF_random =3D 0x346001d6; +const int SF_neg_zero =3D 0x80000000; =20 const long long DF_QNaN =3D 0x7ff8000000000000ULL; const long long DF_SNaN =3D 0x7ff7000000000000ULL; @@ -536,6 +537,33 @@ static void check_sffixupd(void) check32(result, 0x146001d6); } =20 +static void check_sffms(void) +{ + int result; + + /* Check that sffms properly deals with -0 */ + result =3D SF_neg_zero; + asm ("%0 -=3D sfmpy(%1 , %2)\n\t" + : "+r"(result) + : "r"(SF_ZERO), "r"(SF_ZERO) + : "r12", "r8"); + check32(result, SF_neg_zero); + + result =3D SF_ZERO; + asm ("%0 -=3D sfmpy(%1 , %2)\n\t" + : "+r"(result) + : "r"(SF_neg_zero), "r"(SF_ZERO) + : "r12", "r8"); + check32(result, SF_ZERO); + + result =3D SF_ZERO; + asm ("%0 -=3D sfmpy(%1 , %2)\n\t" + : "+r"(result) + : "r"(SF_ZERO), "r"(SF_neg_zero) + : "r12", "r8"); + check32(result, SF_ZERO); +} + static void check_float2int_convs() { int res32; @@ -688,6 +716,7 @@ int main() check_invsqrta(); check_sffixupn(); check_sffixupd(); + check_sffms(); check_float2int_convs(); =20 puts(err ? "FAIL" : "PASS"); --=20 2.25.1 From nobody Sun May 5 04:04:06 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=quicinc.com ARC-Seal: i=1; a=rsa-sha256; t=1678167464; cv=none; d=zohomail.com; s=zohoarc; b=QL37EJpru0XeuoSBZBExb88lmuw6h8ptTo/M8npl38/I6h2kLGnUqAxmExfCmX9tHv1Ji/gLzZhlXqI81CazICpwX/glRrmsIvLWbDnQuHzU3vqG3v72DeQEamoa0q1ITkPy2V4BXQOiIHoX7nfg1q1chh9EMGuVWK50ehsfQ1k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678167464; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=n6WTtQL9UabiUZaZXv3lbVkniWbBMIisnZyYXy1A02U=; b=DkWZGOHosfmsMFxjItMtnF/57r9ZlMl0K7o8qcwds6TQUtJOVDZ38O/s75y5K2Q0pZAwGicsErDBMX/5OYvgVKHv0aJRsM3t4fw6K7JxOfiK4dcuqUhRpfRQ7BqScr+nfKE9Leg1IUk4ckh6Cewm55EG6+3E4ssPR22OlPZObCE= 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+importer2=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 1678167464430109.71879471405998; Mon, 6 Mar 2023 21:37:44 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZPyh-0006pg-9j; Tue, 07 Mar 2023 00:35:11 -0500 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 1pZPyO-0006Xo-NN for qemu-devel@nongnu.org; Tue, 07 Mar 2023 00:34:53 -0500 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 1pZPyJ-0006ZK-W3 for qemu-devel@nongnu.org; Tue, 07 Mar 2023 00:34:52 -0500 Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3274brpv007366; Tue, 7 Mar 2023 05:34:45 GMT Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3p417epx8u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Mar 2023 05:34:45 +0000 Received: from pps.filterd (NALASPPMTA03.qualcomm.com [127.0.0.1]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTP id 3275YikA020278; Tue, 7 Mar 2023 05:34:44 GMT Received: from pps.reinject (localhost [127.0.0.1]) by NALASPPMTA03.qualcomm.com (PPS) with ESMTPS id 3p4fjsvd1t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Mar 2023 05:34:44 +0000 Received: from NALASPPMTA03.qualcomm.com (NALASPPMTA03.qualcomm.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3275YixK020263; Tue, 7 Mar 2023 05:34:44 GMT Received: from hu-devc-sd-u20-a-1.qualcomm.com (hu-tsimpson-lv.qualcomm.com [10.47.204.221]) by NALASPPMTA03.qualcomm.com (PPS) with ESMTPS id 3275YhID020245 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Mar 2023 05:34:44 +0000 Received: by hu-devc-sd-u20-a-1.qualcomm.com (Postfix, from userid 47164) id A9DFFA85; Mon, 6 Mar 2023 21:34:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=qcppdkim1; bh=n6WTtQL9UabiUZaZXv3lbVkniWbBMIisnZyYXy1A02U=; b=oao81p0BSDM4CZw8MmEACs7Dx/BmZAMuDN4GL9JiUNYOSaePXQ+CS6loESIcU0vEqbiw /wXHDKOCeStuMGwR5C+/fJTlbVn0tQ78b9WCStOemPD7BIFBrOjE0uuW4lmsOhgL4MDX b1RDutYZna5EOB3487p4AI5Jpsu850QihPM719ZxcHmAXFqzfaXAo1u3VQzUEP3/JVDD +11L5nqGfXqOOzovIdXQReERgK//kAswdBWUyWEGlhgAe9V4qnt26GiVH+TTOTzpng6V pYXv4GfALiZOE9OTg/NKbQT7m05AlSuIk+aiG8x9QZ/7k1oD9a1Pykg+8AsY5BHUrp/n /A== From: Taylor Simpson To: qemu-devel@nongnu.org Cc: tsimpson@quicinc.com, richard.henderson@linaro.org, philmd@linaro.org, peter.maydell@linaro.org, bcain@quicinc.com, quic_mathbern@quicinc.com, stefanha@redhat.com, ale@rev.ng, anjo@rev.ng Subject: [PULL 15/17] Hexagon (target/hexagon) Remove gen_log_predicated_reg_write[_pair] Date: Mon, 6 Mar 2023 21:34:36 -0800 Message-Id: <20230307053438.2416629-16-tsimpson@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230307053438.2416629-1-tsimpson@quicinc.com> References: <20230307053438.2416629-1-tsimpson@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: bJzm7l2_CEIITCYYl_bUTtS3Ol_iwY8N X-Proofpoint-GUID: bJzm7l2_CEIITCYYl_bUTtS3Ol_iwY8N X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-06_14,2023-03-06_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 mlxscore=0 impostorscore=0 clxscore=1015 suspectscore=0 lowpriorityscore=0 phishscore=0 adultscore=0 malwarescore=0 priorityscore=1501 mlxlogscore=662 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303070050 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.220.168.131; envelope-from=tsimpson@qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @quicinc.com) X-ZM-MESSAGEID: 1678167465380100001 We assign the instruction destination register to hex_new_value[num] instead of a TCG temp that gets copied back to hex_new_value[num]. We introduce new functions get_result_gpr[_pair] to facilitate getting the proper destination register. Since we preload hex_new_value for predicated instructions, we don't need the check for slot_cancelled. So, we call gen_log_reg_write instead. We update the helper function generation and gen_tcg.h to maintain the disable-hexagon-idef-parser configuration. Here is a simple example of the differences in the TCG code generated: IN: 0x00400094: 0xf900c102 { if (P0) R2 =3D and(R0,R1) } BEFORE ---- 00400094 mov_i32 slot_cancelled,$0x0 mov_i32 new_r2,r2 mov_i32 loc2,$0x0 and_i32 tmp0,p0,$0x1 brcond_i32 tmp0,$0x0,eq,$L1 and_i32 tmp0,r0,r1 mov_i32 loc2,tmp0 br $L2 set_label $L1 or_i32 slot_cancelled,slot_cancelled,$0x8 set_label $L2 and_i32 tmp0,slot_cancelled,$0x8 movcond_i32 new_r2,tmp0,$0x0,loc2,new_r2,eq mov_i32 r2,new_r2 AFTER ---- 00400094 mov_i32 slot_cancelled,$0x0 mov_i32 new_r2,r2 and_i32 tmp0,p0,$0x1 brcond_i32 tmp0,$0x0,eq,$L1 and_i32 tmp0,r0,r1 mov_i32 new_r2,tmp0 br $L2 set_label $L1 or_i32 slot_cancelled,slot_cancelled,$0x8 set_label $L2 mov_i32 r2,new_r2 We'll remove the unnecessary manipulation of slot_cancelled in a subsequent patch. Signed-off-by: Taylor Simpson Reviewed-by: Anton Johansson Message-Id: <20230307025828.1612809-13-tsimpson@quicinc.com> --- target/hexagon/gen_tcg.h | 6 +- target/hexagon/macros.h | 15 --- target/hexagon/genptr.c | 121 +++++--------------- target/hexagon/idef-parser/parser-helpers.c | 4 +- target/hexagon/gen_helper_funcs.py | 19 ++- target/hexagon/gen_helper_protos.py | 12 +- target/hexagon/gen_tcg_funcs.py | 76 +++++++----- target/hexagon/hex_common.py | 9 +- 8 files changed, 110 insertions(+), 152 deletions(-) diff --git a/target/hexagon/gen_tcg.h b/target/hexagon/gen_tcg.h index e72672e198..bcf0cf466a 100644 --- a/target/hexagon/gen_tcg.h +++ b/target/hexagon/gen_tcg.h @@ -332,8 +332,6 @@ tcg_gen_movi_tl(EA, 0); \ PRED; \ CHECK_NOSHUF_PRED(GET_EA, SIZE, LSB); \ - PRED_LOAD_CANCEL(LSB, EA); \ - tcg_gen_movi_tl(RdV, 0); \ tcg_gen_brcondi_tl(TCG_COND_EQ, LSB, 0, label); \ fLOAD(1, SIZE, SIGN, EA, RdV); \ gen_set_label(label); \ @@ -391,8 +389,6 @@ tcg_gen_movi_tl(EA, 0); \ PRED; \ CHECK_NOSHUF_PRED(GET_EA, 8, LSB); \ - PRED_LOAD_CANCEL(LSB, EA); \ - tcg_gen_movi_i64(RddV, 0); \ tcg_gen_brcondi_tl(TCG_COND_EQ, LSB, 0, label); \ fLOAD(1, 8, u, EA, RddV); \ gen_set_label(label); \ @@ -504,7 +500,7 @@ */ #define fGEN_TCG_SL2_return(SHORTCODE) \ do { \ - TCGv_i64 RddV =3D tcg_temp_new_i64(); \ + TCGv_i64 RddV =3D get_result_gpr_pair(ctx, HEX_REG_FP); \ gen_return(ctx, RddV, hex_gpr[HEX_REG_FP]); \ gen_log_reg_write_pair(HEX_REG_FP, RddV); \ } while (0) diff --git a/target/hexagon/macros.h b/target/hexagon/macros.h index 6974ef6c9e..1fa6057d27 100644 --- a/target/hexagon/macros.h +++ b/target/hexagon/macros.h @@ -210,21 +210,6 @@ static inline void gen_cancel(uint32_t slot) =20 #define LOAD_CANCEL(EA) do { CANCEL; } while (0) =20 -#ifdef QEMU_GENERATE -static inline void gen_pred_cancel(TCGv pred, uint32_t slot_num) - { - TCGv slot_mask =3D tcg_temp_new(); - TCGv tmp =3D tcg_temp_new(); - TCGv zero =3D tcg_constant_tl(0); - tcg_gen_ori_tl(slot_mask, hex_slot_cancelled, 1 << slot_num); - tcg_gen_andi_tl(tmp, pred, 1); - tcg_gen_movcond_tl(TCG_COND_EQ, hex_slot_cancelled, tmp, zero, - slot_mask, hex_slot_cancelled); -} -#define PRED_LOAD_CANCEL(PRED, EA) \ - gen_pred_cancel(PRED, insn->is_endloop ? 4 : insn->slot) -#endif - #define STORE_CANCEL(EA) { env->slot_cancelled |=3D (1 << slot); } =20 #define fMAX(A, B) (((A) > (B)) ? (A) : (B)) diff --git a/target/hexagon/genptr.c b/target/hexagon/genptr.c index 61ab9af9e4..da5dbc83cf 100644 --- a/target/hexagon/genptr.c +++ b/target/hexagon/genptr.c @@ -68,26 +68,17 @@ static inline void gen_masked_reg_write(TCGv new_val, T= CGv cur_val, } } =20 -static inline void gen_log_predicated_reg_write(int rnum, TCGv val, - uint32_t slot) +static TCGv get_result_gpr(DisasContext *ctx, int rnum) { - TCGv zero =3D tcg_constant_tl(0); - TCGv slot_mask =3D tcg_temp_new(); + return hex_new_value[rnum]; +} =20 - tcg_gen_andi_tl(slot_mask, hex_slot_cancelled, 1 << slot); - tcg_gen_movcond_tl(TCG_COND_EQ, hex_new_value[rnum], slot_mask, zero, - val, hex_new_value[rnum]); - if (HEX_DEBUG) { - /* - * Do this so HELPER(debug_commit_end) will know - * - * Note that slot_mask indicates the value is not written - * (i.e., slot was cancelled), so we create a true/false value bef= ore - * or'ing with hex_reg_written[rnum]. - */ - tcg_gen_setcond_tl(TCG_COND_EQ, slot_mask, slot_mask, zero); - tcg_gen_or_tl(hex_reg_written[rnum], hex_reg_written[rnum], slot_m= ask); - } +static TCGv_i64 get_result_gpr_pair(DisasContext *ctx, int rnum) +{ + TCGv_i64 result =3D tcg_temp_new_i64(); + tcg_gen_concat_i32_i64(result, hex_new_value[rnum], + hex_new_value[rnum + 1]); + return result; } =20 void gen_log_reg_write(int rnum, TCGv val) @@ -102,39 +93,6 @@ void gen_log_reg_write(int rnum, TCGv val) } } =20 -static void gen_log_predicated_reg_write_pair(int rnum, TCGv_i64 val, - uint32_t slot) -{ - TCGv val32 =3D tcg_temp_new(); - TCGv zero =3D tcg_constant_tl(0); - TCGv slot_mask =3D tcg_temp_new(); - - tcg_gen_andi_tl(slot_mask, hex_slot_cancelled, 1 << slot); - /* Low word */ - tcg_gen_extrl_i64_i32(val32, val); - tcg_gen_movcond_tl(TCG_COND_EQ, hex_new_value[rnum], - slot_mask, zero, - val32, hex_new_value[rnum]); - /* High word */ - tcg_gen_extrh_i64_i32(val32, val); - tcg_gen_movcond_tl(TCG_COND_EQ, hex_new_value[rnum + 1], - slot_mask, zero, - val32, hex_new_value[rnum + 1]); - if (HEX_DEBUG) { - /* - * Do this so HELPER(debug_commit_end) will know - * - * Note that slot_mask indicates the value is not written - * (i.e., slot was cancelled), so we create a true/false value bef= ore - * or'ing with hex_reg_written[rnum]. - */ - tcg_gen_setcond_tl(TCG_COND_EQ, slot_mask, slot_mask, zero); - tcg_gen_or_tl(hex_reg_written[rnum], hex_reg_written[rnum], slot_m= ask); - tcg_gen_or_tl(hex_reg_written[rnum + 1], hex_reg_written[rnum + 1], - slot_mask); - } -} - static void gen_log_reg_write_pair(int rnum, TCGv_i64 val) { const target_ulong reg_mask_low =3D reg_immut_masks[rnum]; @@ -290,11 +248,12 @@ static inline void gen_write_ctrl_reg_pair(DisasConte= xt *ctx, int reg_num, TCGv_i64 val) { if (reg_num =3D=3D HEX_REG_P3_0_ALIASED) { + TCGv result =3D get_result_gpr(ctx, reg_num + 1); TCGv val32 =3D tcg_temp_new(); tcg_gen_extrl_i64_i32(val32, val); gen_write_p3_0(ctx, val32); tcg_gen_extrh_i64_i32(val32, val); - gen_log_reg_write(reg_num + 1, val32); + tcg_gen_mov_tl(result, val32); } else { gen_log_reg_write_pair(reg_num, val); if (reg_num =3D=3D HEX_REG_QEMU_PKT_CNT) { @@ -673,31 +632,28 @@ static void gen_jumpr(DisasContext *ctx, TCGv new_pc) =20 static void gen_call(DisasContext *ctx, int pc_off) { - TCGv next_PC =3D - tcg_constant_tl(ctx->pkt->pc + ctx->pkt->encod_pkt_size_in_bytes); - gen_log_reg_write(HEX_REG_LR, next_PC); + TCGv lr =3D get_result_gpr(ctx, HEX_REG_LR); + tcg_gen_movi_tl(lr, ctx->next_PC); gen_write_new_pc_pcrel(ctx, pc_off, TCG_COND_ALWAYS, NULL); } =20 static void gen_callr(DisasContext *ctx, TCGv new_pc) { - TCGv next_PC =3D tcg_constant_tl(ctx->next_PC); - gen_log_reg_write(HEX_REG_LR, next_PC); + TCGv lr =3D get_result_gpr(ctx, HEX_REG_LR); + tcg_gen_movi_tl(lr, ctx->next_PC); gen_write_new_pc_addr(ctx, new_pc, TCG_COND_ALWAYS, NULL); } =20 static void gen_cond_call(DisasContext *ctx, TCGv pred, TCGCond cond, int pc_off) { - TCGv next_PC; + TCGv lr =3D get_result_gpr(ctx, HEX_REG_LR); TCGv lsb =3D tcg_temp_new(); TCGLabel *skip =3D gen_new_label(); tcg_gen_andi_tl(lsb, pred, 1); gen_write_new_pc_pcrel(ctx, pc_off, cond, lsb); tcg_gen_brcondi_tl(cond, lsb, 0, skip); - next_PC =3D - tcg_constant_tl(ctx->pkt->pc + ctx->pkt->encod_pkt_size_in_bytes); - gen_log_reg_write(HEX_REG_LR, next_PC); + tcg_gen_movi_tl(lr, ctx->next_PC); gen_set_label(skip); } =20 @@ -728,8 +684,7 @@ static void gen_load_frame(DisasContext *ctx, TCGv_i64 = frame, TCGv EA) tcg_gen_qemu_ld64(frame, EA, ctx->mem_idx); } =20 -static void gen_return_base(DisasContext *ctx, TCGv_i64 dst, TCGv src, - TCGv r29) +static void gen_return(DisasContext *ctx, TCGv_i64 dst, TCGv src) { /* * frame =3D *src @@ -739,6 +694,7 @@ static void gen_return_base(DisasContext *ctx, TCGv_i64= dst, TCGv src, */ TCGv_i64 frame =3D tcg_temp_new_i64(); TCGv r31 =3D tcg_temp_new(); + TCGv r29 =3D get_result_gpr(ctx, HEX_REG_SP); =20 gen_load_frame(ctx, frame, src); gen_frame_unscramble(frame); @@ -748,45 +704,25 @@ static void gen_return_base(DisasContext *ctx, TCGv_i= 64 dst, TCGv src, gen_jumpr(ctx, r31); } =20 -static void gen_return(DisasContext *ctx, TCGv_i64 dst, TCGv src) -{ - TCGv r29 =3D tcg_temp_new(); - gen_return_base(ctx, dst, src, r29); - gen_log_reg_write(HEX_REG_SP, r29); -} - /* if (pred) dst =3D dealloc_return(src):raw */ static void gen_cond_return(DisasContext *ctx, TCGv_i64 dst, TCGv src, TCGv pred, TCGCond cond) { TCGv LSB =3D tcg_temp_new(); - TCGv mask =3D tcg_temp_new(); - TCGv r29 =3D tcg_temp_new(); TCGLabel *skip =3D gen_new_label(); tcg_gen_andi_tl(LSB, pred, 1); =20 - /* Initialize the results in case the predicate is false */ - tcg_gen_movi_i64(dst, 0); - tcg_gen_movi_tl(r29, 0); - - /* Set the bit in hex_slot_cancelled if the predicate is flase */ - tcg_gen_movi_tl(mask, 1 << ctx->insn->slot); - tcg_gen_or_tl(mask, hex_slot_cancelled, mask); - tcg_gen_movcond_tl(cond, hex_slot_cancelled, LSB, tcg_constant_tl(0), - mask, hex_slot_cancelled); - tcg_gen_brcondi_tl(cond, LSB, 0, skip); - gen_return_base(ctx, dst, src, r29); + gen_return(ctx, dst, src); gen_set_label(skip); - gen_log_predicated_reg_write(HEX_REG_SP, r29, ctx->insn->slot); } =20 /* sub-instruction version (no RddV, so handle it manually) */ static void gen_cond_return_subinsn(DisasContext *ctx, TCGCond cond, TCGv = pred) { - TCGv_i64 RddV =3D tcg_temp_new_i64(); + TCGv_i64 RddV =3D get_result_gpr_pair(ctx, HEX_REG_FP); gen_cond_return(ctx, RddV, hex_gpr[HEX_REG_FP], pred, cond); - gen_log_predicated_reg_write_pair(HEX_REG_FP, RddV, ctx->insn->slot); + gen_log_reg_write_pair(HEX_REG_FP, RddV); } =20 static void gen_endloop0(DisasContext *ctx) @@ -836,9 +772,9 @@ static void gen_endloop0(DisasContext *ctx) TCGLabel *label3 =3D gen_new_label(); tcg_gen_brcondi_tl(TCG_COND_LEU, hex_gpr[HEX_REG_LC0], 1, label3); { + TCGv lc0 =3D get_result_gpr(ctx, HEX_REG_LC0); gen_jumpr(ctx, hex_gpr[HEX_REG_SA0]); - tcg_gen_subi_tl(hex_new_value[HEX_REG_LC0], - hex_gpr[HEX_REG_LC0], 1); + tcg_gen_subi_tl(lc0, hex_gpr[HEX_REG_LC0], 1); } gen_set_label(label3); } @@ -855,8 +791,9 @@ static void gen_endloop1(DisasContext *ctx) TCGLabel *label =3D gen_new_label(); tcg_gen_brcondi_tl(TCG_COND_LEU, hex_gpr[HEX_REG_LC1], 1, label); { + TCGv lc1 =3D get_result_gpr(ctx, HEX_REG_LC1); gen_jumpr(ctx, hex_gpr[HEX_REG_SA1]); - tcg_gen_subi_tl(hex_new_value[HEX_REG_LC1], hex_gpr[HEX_REG_LC1], = 1); + tcg_gen_subi_tl(lc1, hex_gpr[HEX_REG_LC1], 1); } gen_set_label(label); } @@ -909,15 +846,17 @@ static void gen_endloop01(DisasContext *ctx) */ tcg_gen_brcondi_tl(TCG_COND_LEU, hex_gpr[HEX_REG_LC0], 1, label3); { + TCGv lc0 =3D get_result_gpr(ctx, HEX_REG_LC0); gen_jumpr(ctx, hex_gpr[HEX_REG_SA0]); - tcg_gen_subi_tl(hex_new_value[HEX_REG_LC0], hex_gpr[HEX_REG_LC0], = 1); + tcg_gen_subi_tl(lc0, hex_gpr[HEX_REG_LC0], 1); tcg_gen_br(done); } gen_set_label(label3); tcg_gen_brcondi_tl(TCG_COND_LEU, hex_gpr[HEX_REG_LC1], 1, done); { + TCGv lc1 =3D get_result_gpr(ctx, HEX_REG_LC1); gen_jumpr(ctx, hex_gpr[HEX_REG_SA1]); - tcg_gen_subi_tl(hex_new_value[HEX_REG_LC1], hex_gpr[HEX_REG_LC1], = 1); + tcg_gen_subi_tl(lc1, hex_gpr[HEX_REG_LC1], 1); } gen_set_label(done); } diff --git a/target/hexagon/idef-parser/parser-helpers.c b/target/hexagon/i= def-parser/parser-helpers.c index 4e0c643cae..9720ef4ad1 100644 --- a/target/hexagon/idef-parser/parser-helpers.c +++ b/target/hexagon/idef-parser/parser-helpers.c @@ -1668,9 +1668,7 @@ void gen_inst_init_args(Context *c, YYLTYPE *locp) 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) { - char reg_id[5]; - reg_compose(c, locp, &val->reg, reg_id); - EMIT_HEAD(c, "tcg_gen_movi_i%u(%s, 0);\n", val->bit_width, reg= _id); + /* 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, diff --git a/target/hexagon/gen_helper_funcs.py b/target/hexagon/gen_helper= _funcs.py index 19e9883f4c..7a224b66e6 100755 --- a/target/hexagon/gen_helper_funcs.py +++ b/target/hexagon/gen_helper_funcs.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 =20 ## -## Copyright(c) 2019-2022 Qualcomm Innovation Center, Inc. All Rights Res= erved. +## Copyright(c) 2019-2023 Qualcomm Innovation Center, Inc. All Rights Res= erved. ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -226,6 +226,14 @@ def gen_helper_function(f, tag, tagregs, tagimms): print("Bad register parse: ",regtype,regid,toss,numreg= s) i +=3D 1 =20 + ## For conditional instructions, we pass in the destination regist= er + if 'A_CONDEXEC' in hex_common.attribdict[tag]: + for regtype, regid, toss, numregs in regs: + if (hex_common.is_writeonly(regid) and + not hex_common.is_hvx_reg(regtype)): + gen_helper_arg_opn(f, regtype, regid, i, tag) + i +=3D 1 + ## Arguments to the helper function are the source regs and immedi= ates for regtype,regid,toss,numregs in regs: if (hex_common.is_read(regid)): @@ -262,10 +270,11 @@ def gen_helper_function(f, tag, tagregs, tagimms): if hex_common.need_ea(tag): gen_decl_ea(f) ## Declare the return variable i=3D0 - for regtype,regid,toss,numregs in regs: - if (hex_common.is_writeonly(regid)): - gen_helper_dest_decl_opn(f,regtype,regid,i) - i +=3D 1 + if 'A_CONDEXEC' not in hex_common.attribdict[tag]: + for regtype,regid,toss,numregs in regs: + if (hex_common.is_writeonly(regid)): + gen_helper_dest_decl_opn(f,regtype,regid,i) + i +=3D 1 =20 for regtype,regid,toss,numregs in regs: if (hex_common.is_read(regid)): diff --git a/target/hexagon/gen_helper_protos.py b/target/hexagon/gen_helpe= r_protos.py index 674bf370fa..ddddc9e4f0 100755 --- a/target/hexagon/gen_helper_protos.py +++ b/target/hexagon/gen_helper_protos.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 =20 ## -## Copyright(c) 2019-2022 Qualcomm Innovation Center, Inc. All Rights Res= erved. +## Copyright(c) 2019-2023 Qualcomm Innovation Center, Inc. All Rights Res= erved. ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -87,6 +87,7 @@ def gen_helper_prototype(f, tag, tagregs, tagimms): if hex_common.need_slot(tag): def_helper_size +=3D 1 if hex_common.need_PC(tag): def_helper_size +=3D 1 if hex_common.helper_needs_next_PC(tag): def_helper_size +=3D 1 + if hex_common.need_condexec_reg(tag, regs): def_helper_size += =3D 1 f.write('DEF_HELPER_%s(%s' % (def_helper_size, tag)) ## The return type is void f.write(', void' ) @@ -96,6 +97,7 @@ def gen_helper_prototype(f, tag, tagregs, tagimms): if hex_common.need_part1(tag): def_helper_size +=3D 1 if hex_common.need_slot(tag): def_helper_size +=3D 1 if hex_common.need_PC(tag): def_helper_size +=3D 1 + if hex_common.need_condexec_reg(tag, regs): def_helper_size += =3D 1 if hex_common.helper_needs_next_PC(tag): def_helper_size +=3D 1 f.write('DEF_HELPER_%s(%s' % (def_helper_size, tag)) =20 @@ -121,6 +123,14 @@ def gen_helper_prototype(f, tag, tagregs, tagimms): gen_def_helper_opn(f, tag, regtype, regid, toss, numre= gs, i) i +=3D 1 =20 + ## For conditional instructions, we pass in the destination regist= er + if 'A_CONDEXEC' in hex_common.attribdict[tag]: + for regtype, regid, toss, numregs in regs: + if (hex_common.is_writeonly(regid) and + not hex_common.is_hvx_reg(regtype)): + gen_def_helper_opn(f, tag, regtype, regid, toss, numre= gs, i) + i +=3D 1 + ## Generate the qemu type for each input operand (regs and immedia= tes) for regtype,regid,toss,numregs in regs: if (hex_common.is_read(regid)): diff --git a/target/hexagon/gen_tcg_funcs.py b/target/hexagon/gen_tcg_funcs= .py index 22bcb56917..9336528e50 100755 --- a/target/hexagon/gen_tcg_funcs.py +++ b/target/hexagon/gen_tcg_funcs.py @@ -30,23 +30,33 @@ def gen_decl_ea_tcg(f, tag): =20 def genptr_decl_pair_writable(f, tag, regtype, regid, regno): regN=3D"%s%sN" % (regtype,regid) - f.write(" TCGv_i64 %s%sV =3D tcg_temp_new_i64();\n" % \ - (regtype, regid)) - if (regtype =3D=3D "C"): + if (regtype =3D=3D "R"): + f.write(" const int %s =3D insn->regno[%d];\n" % (regN, regno)) + elif (regtype =3D=3D "C"): f.write(" const int %s =3D insn->regno[%d] + HEX_REG_SA0;\n" % \ (regN, regno)) else: - f.write(" const int %s =3D insn->regno[%d];\n" % (regN, regno)) + print("Bad register parse: ", regtype, regid) + f.write(" TCGv_i64 %s%sV =3D get_result_gpr_pair(ctx, %s);\n" % \ + (regtype, regid, regN)) =20 def genptr_decl_writable(f, tag, regtype, regid, regno): regN=3D"%s%sN" % (regtype,regid) - f.write(" TCGv %s%sV =3D tcg_temp_new();\n" % \ - (regtype, regid)) - if (regtype =3D=3D "C"): + if (regtype =3D=3D "R"): + f.write(" const int %s =3D insn->regno[%d];\n" % (regN, regno)) + f.write(" TCGv %s%sV =3D get_result_gpr(ctx, %s);\n" % \ + (regtype, regid, regN)) + elif (regtype =3D=3D "C"): f.write(" const int %s =3D insn->regno[%d] + HEX_REG_SA0;\n" % \ (regN, regno)) - else: + f.write(" TCGv %s%sV =3D get_result_gpr(ctx, %s);\n" % \ + (regtype, regid, regN)) + elif (regtype =3D=3D "P"): f.write(" const int %s =3D insn->regno[%d];\n" % (regN, regno)) + f.write(" TCGv %s%sV =3D tcg_temp_new();\n" % \ + (regtype, regid)) + else: + print("Bad register parse: ", regtype, regid) =20 def genptr_decl(f, tag, regtype, regid, regno): regN=3D"%s%sN" % (regtype,regid) @@ -249,8 +259,12 @@ def genptr_src_read(f, tag, regtype, regid): f.write(" hex_gpr[%s%sN + 1]);= \n" % \ (regtype, regid)) elif (regid in {"x", "y"}): - f.write(" tcg_gen_mov_tl(%s%sV, hex_gpr[%s%sN]);\n" % \ - (regtype,regid,regtype,regid)) + ## For read/write registers, we need to get the original value= into + ## the result TCGv. For conditional instructions, this is don= e in + ## gen_start_packet. For unconditional instructions, we do it= here. + if ('A_CONDEXEC' not in hex_common.attribdict[tag]): + f.write(" tcg_gen_mov_tl(%s%sV, hex_gpr[%s%sN]);\n" % \ + (regtype, regid, regtype, regid)) elif (regid not in {"s", "t", "u", "v"}): print("Bad register parse: ", regtype, regid) elif (regtype =3D=3D "P"): @@ -360,25 +374,16 @@ def gen_helper_call_imm(f,immlett): f.write(", tcgv_%s" % hex_common.imm_name(immlett)) =20 def genptr_dst_write_pair(f, tag, regtype, regid): - if ('A_CONDEXEC' in hex_common.attribdict[tag]): - f.write(" gen_log_predicated_reg_write_pair(%s%sN, %s%sV, insn-= >slot);\n" % \ - (regtype, regid, regtype, regid)) - else: - f.write(" gen_log_reg_write_pair(%s%sN, %s%sV);\n" % \ - (regtype, regid, regtype, regid)) + f.write(" gen_log_reg_write_pair(%s%sN, %s%sV);\n" % \ + (regtype, regid, regtype, regid)) =20 def genptr_dst_write(f, tag, regtype, regid): if (regtype =3D=3D "R"): if (regid in {"dd", "xx", "yy"}): genptr_dst_write_pair(f, tag, regtype, regid) elif (regid in {"d", "e", "x", "y"}): - if ('A_CONDEXEC' in hex_common.attribdict[tag]): - f.write(" gen_log_predicated_reg_write(%s%sN, %s%sV,\n"= % \ - (regtype, regid, regtype, regid)) - f.write(" insn->slot);\n") - else: - f.write(" gen_log_reg_write(%s%sN, %s%sV);\n" % \ - (regtype, regid, regtype, regid)) + f.write(" gen_log_reg_write(%s%sN, %s%sV);\n" % \ + (regtype, regid, regtype, regid)) else: print("Bad register parse: ", regtype, regid) elif (regtype =3D=3D "P"): @@ -462,14 +467,15 @@ def genptr_dst_write_opn(f,regtype, regid, tag): ## For A2_add: Rd32=3Dadd(Rs32,Rt32), { RdV=3DRsV+RtV;} ## We produce: ## static void generate_A2_add(DisasContext *ctx) -## { -## TCGv RdV =3D tcg_temp_new(); -## const int RdN =3D insn->regno[0]; -## TCGv RsV =3D hex_gpr[insn->regno[1]]; -## TCGv RtV =3D hex_gpr[insn->regno[2]]; -## -## gen_log_reg_write(RdN, RdV); -## } +## { +## Insn *insn __attribute__((unused)) =3D ctx->insn; +## const int RdN =3D insn->regno[0]; +## TCGv RdV =3D get_result_gpr(ctx, RdN); +## TCGv RsV =3D hex_gpr[insn->regno[1]]; +## TCGv RtV =3D hex_gpr[insn->regno[2]]; +## +## gen_log_reg_write(RdN, RdV); +## } ## ## where depends on hex_common.skip_qemu_helper(tag) ## if hex_common.skip_qemu_helper(tag) is True @@ -553,6 +559,14 @@ def gen_tcg_func(f, tag, regs, imms): if (i > 0): f.write(", ") f.write("cpu_env") i=3D1 + ## For conditional instructions, we pass in the destination regist= er + if 'A_CONDEXEC' in hex_common.attribdict[tag]: + for regtype, regid, toss, numregs in regs: + if (hex_common.is_writeonly(regid) and + not hex_common.is_hvx_reg(regtype)): + gen_helper_call_opn(f, tag, regtype, regid, toss, \ + numregs, i) + i +=3D 1 for regtype,regid,toss,numregs in regs: if (hex_common.is_written(regid)): if (not hex_common.is_hvx_reg(regtype)): diff --git a/target/hexagon/hex_common.py b/target/hexagon/hex_common.py index 76da362c11..0200a66cb6 100755 --- a/target/hexagon/hex_common.py +++ b/target/hexagon/hex_common.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 =20 ## -## Copyright(c) 2019-2022 Qualcomm Innovation Center, Inc. All Rights Res= erved. +## Copyright(c) 2019-2023 Qualcomm Innovation Center, Inc. All Rights Res= erved. ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -237,6 +237,13 @@ def helper_needs_next_PC(tag): def need_pkt_has_multi_cof(tag): return 'A_COF' in attribdict[tag] =20 +def need_condexec_reg(tag, regs): + if 'A_CONDEXEC' in attribdict[tag]: + for regtype, regid, toss, numregs in regs: + if is_writeonly(regid) and not is_hvx_reg(regtype): + return True + return False + def skip_qemu_helper(tag): return tag in overrides.keys() =20 --=20 2.25.1 From nobody Sun May 5 04:04:06 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=quicinc.com ARC-Seal: i=1; a=rsa-sha256; t=1678167461; cv=none; d=zohomail.com; s=zohoarc; b=LVKXXapW1BQ/UZR42cTMrRK/gjBAknQfwSW2P+5bJ4FgbAK5/Vw+bngGqKVZa5C7jPl7O8eNsHTAnscXx0oz6Fz9qWQ2lrQQnRQnxCDiflfFb4ISDh1AKV/NfauIxQCAQdBGeA1vACui/edjTdm/QZy9d4gUYGsX+zHabl2Imm4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678167461; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=y2EB+xJJPFdF8aeb2H4PingDe1yx/BiCo7toncoKbaw=; b=bjyt0yjhT6k3NJ+tu5UXZc7MVMGFH0pX8VwCUyJXZclIj+tClcYcE783CAiK4vU1vro9Y7RjWDwQFiti3N8qQPUvttAB1lJZgiZndKFtUvsO8N4ugyw6P/sPLRofPz5MlnTmy4eStX3aG4QY1RddJccvUs7d7UH4BLnHCiaR51E= 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+importer2=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 1678167461520686.6354326654699; Mon, 6 Mar 2023 21:37:41 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZPyc-0006na-8Z; Tue, 07 Mar 2023 00:35:06 -0500 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 1pZPyO-0006XQ-Dm for qemu-devel@nongnu.org; Tue, 07 Mar 2023 00:34:53 -0500 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 1pZPyK-0006ZV-2V for qemu-devel@nongnu.org; Tue, 07 Mar 2023 00:34:51 -0500 Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3271dQMB031893; Tue, 7 Mar 2023 05:34:47 GMT Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3p5usx0exw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Mar 2023 05:34:46 +0000 Received: from pps.filterd (NALASPPMTA01.qualcomm.com [127.0.0.1]) by NALASPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTP id 3275Yiml000571; Tue, 7 Mar 2023 05:34:45 GMT Received: from pps.reinject (localhost [127.0.0.1]) by NALASPPMTA01.qualcomm.com (PPS) with ESMTPS id 3p4fhbm8nt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Mar 2023 05:34:45 +0000 Received: from NALASPPMTA01.qualcomm.com (NALASPPMTA01.qualcomm.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3275YiMw000539; Tue, 7 Mar 2023 05:34:44 GMT Received: from hu-devc-sd-u20-a-1.qualcomm.com (hu-tsimpson-lv.qualcomm.com [10.47.204.221]) by NALASPPMTA01.qualcomm.com (PPS) with ESMTPS id 3275Yh6b000528 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Mar 2023 05:34:44 +0000 Received: by hu-devc-sd-u20-a-1.qualcomm.com (Postfix, from userid 47164) id ACD5BA89; Mon, 6 Mar 2023 21:34:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=qcppdkim1; bh=y2EB+xJJPFdF8aeb2H4PingDe1yx/BiCo7toncoKbaw=; b=LHmRdW2eMFB+m6Rq+EmL6RlTXblzlsgi/V1Asl01tCb54YC3FehZWIixg5IXEtCTNG2A 2pGyNYVlrrA3cIwpjbKJoGPaGof/ibje6qsQBLk3NMIfF9ukGTXgCI4t58VsX2WfWi76 DRGcj1bLZzJE1jao3jcjoclsc9Gw1cSksb+q89dirvkRoXZf8SGfYFmW6hmsT1a4/i2g D1pHLbwVpK/Ltw73vZ4glT9cS74YIDBCd6+wgKFaXpYx4gt9E8XGIX39XE4TUheoPlrE 6vC3EXcgPP6rDr/sETQ9Uqm7hnB0QB20h/qPPWNxJ5A0Tl8kwYA3fdtwPoAL4KiCQmRk fQ== From: Taylor Simpson To: qemu-devel@nongnu.org Cc: tsimpson@quicinc.com, richard.henderson@linaro.org, philmd@linaro.org, peter.maydell@linaro.org, bcain@quicinc.com, quic_mathbern@quicinc.com, stefanha@redhat.com, ale@rev.ng, anjo@rev.ng Subject: [PULL 16/17] Hexagon (target/hexagon) Reduce manipulation of slot_cancelled Date: Mon, 6 Mar 2023 21:34:37 -0800 Message-Id: <20230307053438.2416629-17-tsimpson@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230307053438.2416629-1-tsimpson@quicinc.com> References: <20230307053438.2416629-1-tsimpson@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: yiuxAhgI8zqW-jP_x7wGPMHHKdQkKlFD X-Proofpoint-GUID: yiuxAhgI8zqW-jP_x7wGPMHHKdQkKlFD X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-06_14,2023-03-06_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 spamscore=0 clxscore=1015 priorityscore=1501 mlxscore=0 bulkscore=0 impostorscore=0 phishscore=0 adultscore=0 mlxlogscore=359 suspectscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303070049 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.220.180.131; envelope-from=tsimpson@qualcomm.com; helo=mx0b-0031df01.pphosted.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @quicinc.com) X-ZM-MESSAGEID: 1678167463311100004 We only need to track slot for predicated stores and predicated HVX instructions. Add arguments to the probe helper functions to indicate if the slot is predicated. Here is a simple example of the differences in the TCG code generated: IN: 0x00400094: 0xf900c102 { if (P0) R2 =3D and(R0,R1) } BEFORE ---- 00400094 mov_i32 slot_cancelled,$0x0 mov_i32 new_r2,r2 and_i32 tmp0,p0,$0x1 brcond_i32 tmp0,$0x0,eq,$L1 and_i32 tmp0,r0,r1 mov_i32 new_r2,tmp0 br $L2 set_label $L1 or_i32 slot_cancelled,slot_cancelled,$0x8 set_label $L2 mov_i32 r2,new_r2 AFTER ---- 00400094 mov_i32 new_r2,r2 and_i32 tmp0,p0,$0x1 brcond_i32 tmp0,$0x0,eq,$L1 and_i32 tmp0,r0,r1 mov_i32 new_r2,tmp0 br $L2 set_label $L1 set_label $L2 mov_i32 r2,new_r2 Signed-off-by: Taylor Simpson Reviewed-by: Anton Johansson Message-Id: <20230307025828.1612809-14-tsimpson@quicinc.com> --- target/hexagon/macros.h | 2 +- target/hexagon/op_helper.h | 3 +- target/hexagon/translate.h | 10 +++++ target/hexagon/idef-parser/parser-helpers.c | 1 - target/hexagon/op_helper.c | 32 ++++++++-------- target/hexagon/translate.c | 42 ++++++++++++++++++--- target/hexagon/idef-parser/idef-parser.lex | 4 +- target/hexagon/idef-parser/idef-parser.y | 7 ++-- 8 files changed, 71 insertions(+), 30 deletions(-) diff --git a/target/hexagon/macros.h b/target/hexagon/macros.h index 1fa6057d27..482a9c787f 100644 --- a/target/hexagon/macros.h +++ b/target/hexagon/macros.h @@ -205,7 +205,7 @@ static inline void gen_cancel(uint32_t slot) =20 #define CANCEL gen_cancel(slot); #else -#define CANCEL cancel_slot(env, slot) +#define CANCEL do { } while (0) #endif =20 #define LOAD_CANCEL(EA) do { CANCEL; } while (0) diff --git a/target/hexagon/op_helper.h b/target/hexagon/op_helper.h index 02347edee8..34b3a53975 100644 --- a/target/hexagon/op_helper.h +++ b/target/hexagon/op_helper.h @@ -1,5 +1,5 @@ /* - * Copyright(c) 2019-2021 Qualcomm Innovation Center, Inc. All Rights Res= erved. + * Copyright(c) 2019-2023 Qualcomm Innovation Center, Inc. All Rights Res= erved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,7 +19,6 @@ #define HEXAGON_OP_HELPER_H =20 /* Misc functions */ -void cancel_slot(CPUHexagonState *env, uint32_t slot); void write_new_pc(CPUHexagonState *env, bool pkt_has_multi_cof, target_ulo= ng addr); =20 uint8_t mem_load1(CPUHexagonState *env, uint32_t slot, target_ulong vaddr); diff --git a/target/hexagon/translate.h b/target/hexagon/translate.h index 765f2c6a22..6e59a90c41 100644 --- a/target/hexagon/translate.h +++ b/target/hexagon/translate.h @@ -172,4 +172,14 @@ extern TCGv hex_vstore_pending[VSTORES_MAX]; =20 bool is_gather_store_insn(DisasContext *ctx); void process_store(DisasContext *ctx, int slot_num); + +FIELD(PROBE_PKT_SCALAR_STORE_S0, MMU_IDX, 0, 2) +FIELD(PROBE_PKT_SCALAR_STORE_S0, IS_PREDICATED, 2, 1) + +FIELD(PROBE_PKT_SCALAR_HVX_STORES, HAS_ST0, 0, 1) +FIELD(PROBE_PKT_SCALAR_HVX_STORES, HAS_ST1, 1, 1) +FIELD(PROBE_PKT_SCALAR_HVX_STORES, HAS_HVX_STORES, 2, 1) +FIELD(PROBE_PKT_SCALAR_HVX_STORES, S0_IS_PRED, 3, 1) +FIELD(PROBE_PKT_SCALAR_HVX_STORES, S1_IS_PRED, 4, 1) + #endif diff --git a/target/hexagon/idef-parser/parser-helpers.c b/target/hexagon/i= def-parser/parser-helpers.c index 9720ef4ad1..18cde6a1be 100644 --- a/target/hexagon/idef-parser/parser-helpers.c +++ b/target/hexagon/idef-parser/parser-helpers.c @@ -1727,7 +1727,6 @@ void gen_cancel(Context *c, YYLTYPE *locp) =20 void gen_load_cancel(Context *c, YYLTYPE *locp) { - gen_cancel(c, locp); OUT(c, locp, "if (insn->slot =3D=3D 0 && pkt->pkt_has_store_s1) {\n"); OUT(c, locp, "ctx->s1_store_processed =3D false;\n"); OUT(c, locp, "process_store(ctx, 1);\n"); diff --git a/target/hexagon/op_helper.c b/target/hexagon/op_helper.c index 9425941c69..c9a156030e 100644 --- a/target/hexagon/op_helper.c +++ b/target/hexagon/op_helper.c @@ -30,6 +30,7 @@ #include "mmvec/mmvec.h" #include "mmvec/macros.h" #include "op_helper.h" +#include "translate.h" =20 #define SF_BIAS 127 #define SF_MANTBITS 23 @@ -415,9 +416,10 @@ int32_t HELPER(vacsh_pred)(CPUHexagonState *env, return PeV; } =20 -static void probe_store(CPUHexagonState *env, int slot, int mmu_idx) +static void probe_store(CPUHexagonState *env, int slot, int mmu_idx, + bool is_predicated) { - if (!(env->slot_cancelled & (1 << slot))) { + if (!is_predicated || !(env->slot_cancelled & (1 << slot))) { size1u_t width =3D env->mem_log_stores[slot].width; target_ulong va =3D env->mem_log_stores[slot].va; uintptr_t ra =3D GETPC(); @@ -437,9 +439,12 @@ void HELPER(probe_noshuf_load)(CPUHexagonState *env, t= arget_ulong va, } =20 /* Called during packet commit when there are two scalar stores */ -void HELPER(probe_pkt_scalar_store_s0)(CPUHexagonState *env, int mmu_idx) +void HELPER(probe_pkt_scalar_store_s0)(CPUHexagonState *env, int args) { - probe_store(env, 0, mmu_idx); + int mmu_idx =3D FIELD_EX32(args, PROBE_PKT_SCALAR_STORE_S0, MMU_IDX); + bool is_predicated =3D + FIELD_EX32(args, PROBE_PKT_SCALAR_STORE_S0, IS_PREDICATED); + probe_store(env, 0, mmu_idx, is_predicated); } =20 void HELPER(probe_hvx_stores)(CPUHexagonState *env, int mmu_idx) @@ -486,15 +491,18 @@ void HELPER(probe_hvx_stores)(CPUHexagonState *env, i= nt mmu_idx) void HELPER(probe_pkt_scalar_hvx_stores)(CPUHexagonState *env, int mask, int mmu_idx) { - bool has_st0 =3D (mask >> 0) & 1; - bool has_st1 =3D (mask >> 1) & 1; - bool has_hvx_stores =3D (mask >> 2) & 1; + bool has_st0 =3D FIELD_EX32(mask, PROBE_PKT_SCALAR_HVX_STORES, HAS_ST0= ); + bool has_st1 =3D FIELD_EX32(mask, PROBE_PKT_SCALAR_HVX_STORES, HAS_ST1= ); + bool has_hvx_stores =3D + FIELD_EX32(mask, PROBE_PKT_SCALAR_HVX_STORES, HAS_HVX_STORES); + bool s0_is_pred =3D FIELD_EX32(mask, PROBE_PKT_SCALAR_HVX_STORES, S0_I= S_PRED); + bool s1_is_pred =3D FIELD_EX32(mask, PROBE_PKT_SCALAR_HVX_STORES, S1_I= S_PRED); =20 if (has_st0) { - probe_store(env, 0, mmu_idx); + probe_store(env, 0, mmu_idx, s0_is_pred); } if (has_st1) { - probe_store(env, 1, mmu_idx); + probe_store(env, 1, mmu_idx, s1_is_pred); } if (has_hvx_stores) { HELPER(probe_hvx_stores)(env, mmu_idx); @@ -1444,12 +1452,6 @@ void HELPER(vwhist128qm)(CPUHexagonState *env, int32= _t uiV) } } =20 -void cancel_slot(CPUHexagonState *env, uint32_t slot) -{ - HEX_DEBUG_LOG("Slot %d cancelled\n", slot); - env->slot_cancelled |=3D (1 << slot); -} - /* These macros can be referenced in the generated helper functions */ #define warn(...) /* Nothing */ #define fatal(...) g_assert_not_reached(); diff --git a/target/hexagon/translate.c b/target/hexagon/translate.c index 493bc75d27..1e3a76aece 100644 --- a/target/hexagon/translate.c +++ b/target/hexagon/translate.c @@ -248,7 +248,16 @@ static bool check_for_attrib(Packet *pkt, int attrib) =20 static bool need_slot_cancelled(Packet *pkt) { - return check_for_attrib(pkt, A_CONDEXEC); + /* We only need slot_cancelled for conditional store and HVX instructi= ons */ + for (int i =3D 0; i < pkt->num_insns; i++) { + uint16_t opcode =3D pkt->insn[i].opcode; + if (GET_ATTRIB(opcode, A_CONDEXEC) && + (GET_ATTRIB(opcode, A_STORE) || + GET_ATTRIB(opcode, A_CVI))) { + return true; + } + } + return false; } =20 static bool need_pred_written(Packet *pkt) @@ -845,13 +854,27 @@ static void gen_commit_packet(DisasContext *ctx) TCGv mask_tcgv; =20 if (has_store_s0) { - mask |=3D (1 << 0); + mask =3D + FIELD_DP32(mask, PROBE_PKT_SCALAR_HVX_STORES, HAS_ST0,= 1); } if (has_store_s1) { - mask |=3D (1 << 1); + mask =3D + FIELD_DP32(mask, PROBE_PKT_SCALAR_HVX_STORES, HAS_ST1,= 1); } if (has_hvx_store) { - mask |=3D (1 << 2); + mask =3D + FIELD_DP32(mask, PROBE_PKT_SCALAR_HVX_STORES, + HAS_HVX_STORES, 1); + } + if (has_store_s0 && slot_is_predicated(pkt, 0)) { + mask =3D + FIELD_DP32(mask, PROBE_PKT_SCALAR_HVX_STORES, + S0_IS_PRED, 1); + } + if (has_store_s1 && slot_is_predicated(pkt, 1)) { + mask =3D + FIELD_DP32(mask, PROBE_PKT_SCALAR_HVX_STORES, + S1_IS_PRED, 1); } mask_tcgv =3D tcg_constant_tl(mask); gen_helper_probe_pkt_scalar_hvx_stores(cpu_env, mask_tcgv, mem= _idx); @@ -861,8 +884,15 @@ static void gen_commit_packet(DisasContext *ctx) * process_store_log will execute the slot 1 store first, * so we only have to probe the store in slot 0 */ - TCGv mem_idx =3D tcg_constant_tl(ctx->mem_idx); - gen_helper_probe_pkt_scalar_store_s0(cpu_env, mem_idx); + int args =3D 0; + args =3D + FIELD_DP32(args, PROBE_PKT_SCALAR_STORE_S0, MMU_IDX, ctx->mem_= idx); + if (slot_is_predicated(pkt, 0)) { + args =3D + FIELD_DP32(args, PROBE_PKT_SCALAR_STORE_S0, IS_PREDICATED,= 1); + } + TCGv args_tcgv =3D tcg_constant_tl(args); + gen_helper_probe_pkt_scalar_store_s0(cpu_env, args_tcgv); } =20 process_store_log(ctx); diff --git a/target/hexagon/idef-parser/idef-parser.lex b/target/hexagon/id= ef-parser/idef-parser.lex index 2658d9fb2e..5eb8ac5a80 100644 --- a/target/hexagon/idef-parser/idef-parser.lex +++ b/target/hexagon/idef-parser/idef-parser.lex @@ -5,7 +5,7 @@ =20 %{ /* - * Copyright(c) 2019-2022 rev.ng Labs Srl. All Rights Reserved. + * Copyright(c) 2019-2023 rev.ng Labs Srl. All Rights Reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -312,7 +312,7 @@ STRING_LIT \"(\\.|[^"\\])*\" "fREAD_PC()" { return PC; } "USR.LPCFG" { return LPCFG; } "LOAD_CANCEL(EA)" { return LOAD_CANCEL; } -"STORE_CANCEL(EA)" | +"STORE_CANCEL(EA)" { return STORE_CANCEL; } "CANCEL" { return CANCEL; } "N"{LOWER_ID}"N" { yylval->rvalue.type =3D REGISTER_ARG; yylval->rvalue.reg.type =3D DOTNEW; diff --git a/target/hexagon/idef-parser/idef-parser.y b/target/hexagon/idef= -parser/idef-parser.y index d7b2199b74..7d05773b67 100644 --- a/target/hexagon/idef-parser/idef-parser.y +++ b/target/hexagon/idef-parser/idef-parser.y @@ -1,6 +1,6 @@ %{ /* - * Copyright(c) 2019-2022 rev.ng Labs Srl. All Rights Reserved. + * Copyright(c) 2019-2023 rev.ng Labs Srl. All Rights Reserved. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -53,7 +53,7 @@ %token ABS CROUND ROUND CIRCADD COUNTONES INC DEC ANDA ORA XORA PLUSPLUS A= SL %token ASR LSR EQ NEQ LTE GTE MIN MAX ANDL FOR ICIRC IF MUN FSCR FCHK SXT %token ZXT CONSTEXT LOCNT BREV SIGN LOAD STORE PC LPCFG -%token LOAD_CANCEL CANCEL IDENTITY ROTL INSBITS SETBITS EXTRANGE +%token LOAD_CANCEL STORE_CANCEL CANCEL IDENTITY ROTL INSBITS SETBITS EXTRA= NGE %token CAST4_8U FAIL CARRY_FROM_ADD ADDSAT64 LSBNEW %token TYPE_SIZE_T TYPE_INT TYPE_SIGNED TYPE_UNSIGNED TYPE_LONG =20 @@ -412,10 +412,11 @@ cancel_statement : LOAD_CANCEL { gen_load_cancel(c, &@1); } - | CANCEL + | STORE_CANCEL { gen_cancel(c, &@1); } + | CANCEL ; =20 if_statement : if_stmt --=20 2.25.1 From nobody Sun May 5 04:04:06 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=quicinc.com ARC-Seal: i=1; a=rsa-sha256; t=1678167371; cv=none; d=zohomail.com; s=zohoarc; b=keEmZoKwCxmuxZaaqSdOCIcZuvOxxb8+G3vR++YWxRmVLDabSv5OElk0KNUNIP4aTBZkZV81+KY0kVQX2w4qLuGKdMDdEw0nOBRE/STDg35y6Bl0nfSj+Lpn47xIA0DMA12vKwDnn6kFyYG9cX6Rz8SEpeRXdshV4fGT3pVGUEw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678167371; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=TLra6tVbkztUxznnaIQdKAMj1MhvtKnNo86q2igw7A0=; b=fDuaIZWDh8puAQEg0Y+lcLmeX7hhRaNl/gwAHFI57+t+Nn28TJdNUFBT+7Sl6sVm4Aoj06k57AmLLQBCWXuOdmcg85v2vaIuZBmJUNEfIGceis+/Rdw/ohUdbehbq22wIxZSn8PFAacLul1i4GB48jQuKTufAtn7Dcjj/yTk+ZY= 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+importer2=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 1678167371314355.23559304726814; Mon, 6 Mar 2023 21:36:11 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZPyd-0006ns-DZ; Tue, 07 Mar 2023 00:35:07 -0500 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 1pZPyO-0006XR-Dr for qemu-devel@nongnu.org; Tue, 07 Mar 2023 00:34:53 -0500 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 1pZPyJ-0006Z7-H2 for qemu-devel@nongnu.org; Tue, 07 Mar 2023 00:34:51 -0500 Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3274uqTs026951; Tue, 7 Mar 2023 05:34:46 GMT Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3p5wee8831-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Mar 2023 05:34:46 +0000 Received: from pps.filterd (NALASPPMTA02.qualcomm.com [127.0.0.1]) by NALASPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTP id 3275YiA4031947; Tue, 7 Mar 2023 05:34:44 GMT Received: from pps.reinject (localhost [127.0.0.1]) by NALASPPMTA02.qualcomm.com (PPS) with ESMTPS id 3p4fg0ca7s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Mar 2023 05:34:44 +0000 Received: from NALASPPMTA02.qualcomm.com (NALASPPMTA02.qualcomm.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3275YiYZ031928; Tue, 7 Mar 2023 05:34:44 GMT Received: from hu-devc-sd-u20-a-1.qualcomm.com (hu-tsimpson-lv.qualcomm.com [10.47.204.221]) by NALASPPMTA02.qualcomm.com (PPS) with ESMTPS id 3275YhH7031915 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Mar 2023 05:34:44 +0000 Received: by hu-devc-sd-u20-a-1.qualcomm.com (Postfix, from userid 47164) id AF70AA8A; Mon, 6 Mar 2023 21:34:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=qcppdkim1; bh=TLra6tVbkztUxznnaIQdKAMj1MhvtKnNo86q2igw7A0=; b=fFJECq6SQ5axGI+lsDxhVqrGp4YHlORCp9PPPAVtxBtAC7y8XIoU+aDENZfyP2ZpU/37 r2sVaAmFIDvDNblW3r3LY2yxtbobn/2PltENIn9d6f7Lizn6pml6tu9MFg1hwisovJ1S QN5SpVkxo2VhhiV+oOjPc+/5TgFmqhSOauMmfarmvkDJ+w41rJMglcDP0Vk2JIhHrbTT 3xvVvbS3LlRf+P/O1/z4r/2NEuA6/JBBkAA/awbi3w7W/60KFjaEE3YrveXtgDX2Mqs/ 9t9Z1+cl9IEufJeiPg3WnuTuJHY5fjGQK8NdjYAa6eDDNTsu+xc8LFs8aEwTBNnCoXQx rQ== From: Taylor Simpson To: qemu-devel@nongnu.org Cc: tsimpson@quicinc.com, richard.henderson@linaro.org, philmd@linaro.org, peter.maydell@linaro.org, bcain@quicinc.com, quic_mathbern@quicinc.com, stefanha@redhat.com, ale@rev.ng, anjo@rev.ng Subject: [PULL 17/17] Hexagon (target/hexagon) Improve code gen for predicated HVX instructions Date: Mon, 6 Mar 2023 21:34:38 -0800 Message-Id: <20230307053438.2416629-18-tsimpson@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230307053438.2416629-1-tsimpson@quicinc.com> References: <20230307053438.2416629-1-tsimpson@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: g9f-uGrPXgBv8T-EKud9vsmAFdyflA_i X-Proofpoint-ORIG-GUID: g9f-uGrPXgBv8T-EKud9vsmAFdyflA_i X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-06_14,2023-03-06_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 suspectscore=0 spamscore=0 lowpriorityscore=0 impostorscore=0 adultscore=0 mlxlogscore=237 priorityscore=1501 phishscore=0 clxscore=1015 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303070049 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.220.180.131; envelope-from=tsimpson@qualcomm.com; helo=mx0b-0031df01.pphosted.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @quicinc.com) X-ZM-MESSAGEID: 1678167372652100001 The following improvements are made for predicated HVX instructions During gen_commit_hvx, unconditionally move the "new" value into the dest Don't set slot_cancelled Remove runtime bookkeeping of which registers were updated Reduce the cases where gen_log_vreg_write[_pair] is called It's only needed for special operands VxxV and VyV Remove gen_log_qreg_write Signed-off-by: Taylor Simpson Reviewed-by: Anton Johansson Message-Id: <20230307025828.1612809-15-tsimpson@quicinc.com> --- target/hexagon/cpu.h | 5 +-- target/hexagon/gen_tcg_hvx.h | 17 +-------- target/hexagon/translate.h | 15 +++----- target/hexagon/genptr.c | 48 +++--------------------- target/hexagon/translate.c | 58 +++-------------------------- target/hexagon/README | 21 +++-------- target/hexagon/gen_analyze_funcs.py | 3 +- target/hexagon/gen_tcg_funcs.py | 35 ++++------------- 8 files changed, 34 insertions(+), 168 deletions(-) diff --git a/target/hexagon/cpu.h b/target/hexagon/cpu.h index 34c0ae0a67..81b663ecfb 100644 --- a/target/hexagon/cpu.h +++ b/target/hexagon/cpu.h @@ -1,5 +1,5 @@ /* - * Copyright(c) 2019-2022 Qualcomm Innovation Center, Inc. All Rights Res= erved. + * Copyright(c) 2019-2023 Qualcomm Innovation Center, Inc. All Rights Res= erved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -111,11 +111,8 @@ typedef struct CPUArchState { MMVector future_VRegs[VECTOR_TEMPS_MAX] QEMU_ALIGNED(16); MMVector tmp_VRegs[VECTOR_TEMPS_MAX] QEMU_ALIGNED(16); =20 - VRegMask VRegs_updated; - MMQReg QRegs[NUM_QREGS] QEMU_ALIGNED(16); MMQReg future_QRegs[NUM_QREGS] QEMU_ALIGNED(16); - QRegMask QRegs_updated; =20 /* Temporaries used within instructions */ MMVectorPair VuuV QEMU_ALIGNED(16); diff --git a/target/hexagon/gen_tcg_hvx.h b/target/hexagon/gen_tcg_hvx.h index 94f272e286..d4aefe8e3f 100644 --- a/target/hexagon/gen_tcg_hvx.h +++ b/target/hexagon/gen_tcg_hvx.h @@ -1,5 +1,5 @@ /* - * Copyright(c) 2019-2022 Qualcomm Innovation Center, Inc. All Rights Res= erved. + * Copyright(c) 2019-2023 Qualcomm Innovation Center, Inc. All Rights Res= erved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -133,16 +133,11 @@ static inline void assert_vhist_tmp(DisasContext *ctx) do { \ TCGv lsb =3D tcg_temp_new(); \ TCGLabel *false_label =3D gen_new_label(); \ - TCGLabel *end_label =3D gen_new_label(); \ tcg_gen_andi_tl(lsb, PsV, 1); \ tcg_gen_brcondi_tl(TCG_COND_NE, lsb, PRED, false_label); \ tcg_gen_gvec_mov(MO_64, VdV_off, VuV_off, \ sizeof(MMVector), sizeof(MMVector)); \ - tcg_gen_br(end_label); \ gen_set_label(false_label); \ - tcg_gen_ori_tl(hex_slot_cancelled, hex_slot_cancelled, \ - 1 << insn->slot); \ - gen_set_label(end_label); \ } while (0) =20 =20 @@ -547,17 +542,12 @@ static inline void assert_vhist_tmp(DisasContext *ctx) do { \ TCGv LSB =3D tcg_temp_new(); \ TCGLabel *false_label =3D gen_new_label(); \ - TCGLabel *end_label =3D gen_new_label(); \ GET_EA; \ PRED; \ tcg_gen_brcondi_tl(TCG_COND_EQ, LSB, 0, false_label); \ gen_vreg_load(ctx, DSTOFF, EA, true); \ INC; \ - tcg_gen_br(end_label); \ gen_set_label(false_label); \ - tcg_gen_ori_tl(hex_slot_cancelled, hex_slot_cancelled, \ - 1 << insn->slot); \ - gen_set_label(end_label); \ } while (0) =20 #define fGEN_TCG_PRED_VEC_LOAD_pred_pi \ @@ -717,17 +707,12 @@ static inline void assert_vhist_tmp(DisasContext *ctx) do { \ TCGv LSB =3D tcg_temp_new(); \ TCGLabel *false_label =3D gen_new_label(); \ - TCGLabel *end_label =3D gen_new_label(); \ GET_EA; \ PRED; \ tcg_gen_brcondi_tl(TCG_COND_EQ, LSB, 0, false_label); \ gen_vreg_store(ctx, EA, SRCOFF, insn->slot, ALIGN); \ INC; \ - tcg_gen_br(end_label); \ gen_set_label(false_label); \ - tcg_gen_ori_tl(hex_slot_cancelled, hex_slot_cancelled, \ - 1 << insn->slot); \ - gen_set_label(end_label); \ } while (0) =20 #define fGEN_TCG_PRED_VEC_STORE_pred_pi(ALIGN) \ diff --git a/target/hexagon/translate.h b/target/hexagon/translate.h index 6e59a90c41..db832b0f88 100644 --- a/target/hexagon/translate.h +++ b/target/hexagon/translate.h @@ -49,7 +49,6 @@ typedef struct DisasContext { int tmp_vregs_idx; int tmp_vregs_num[VECTOR_TEMPS_MAX]; int vreg_log[NUM_VREGS]; - bool vreg_is_predicated[NUM_VREGS]; int vreg_log_idx; DECLARE_BITMAP(vregs_updated_tmp, NUM_VREGS); DECLARE_BITMAP(vregs_updated, NUM_VREGS); @@ -57,7 +56,6 @@ typedef struct DisasContext { DECLARE_BITMAP(predicated_future_vregs, NUM_VREGS); DECLARE_BITMAP(predicated_tmp_vregs, NUM_VREGS); int qreg_log[NUM_QREGS]; - bool qreg_is_predicated[NUM_QREGS]; int qreg_log_idx; bool pre_commit; TCGCond branch_cond; @@ -111,9 +109,11 @@ static inline void ctx_log_vreg_write(DisasContext *ct= x, bool is_predicated) { if (type !=3D EXT_TMP) { - ctx->vreg_log[ctx->vreg_log_idx] =3D rnum; - ctx->vreg_is_predicated[ctx->vreg_log_idx] =3D is_predicated; - ctx->vreg_log_idx++; + if (!test_bit(rnum, ctx->vregs_updated)) { + ctx->vreg_log[ctx->vreg_log_idx] =3D rnum; + ctx->vreg_log_idx++; + set_bit(rnum, ctx->vregs_updated); + } =20 set_bit(rnum, ctx->vregs_updated); if (is_predicated) { @@ -140,10 +140,9 @@ static inline void ctx_log_vreg_write_pair(DisasContex= t *ctx, } =20 static inline void ctx_log_qreg_write(DisasContext *ctx, - int rnum, bool is_predicated) + int rnum) { ctx->qreg_log[ctx->qreg_log_idx] =3D rnum; - ctx->qreg_is_predicated[ctx->qreg_log_idx] =3D is_predicated; ctx->qreg_log_idx++; } =20 @@ -164,8 +163,6 @@ extern TCGv hex_dczero_addr; extern TCGv hex_llsc_addr; extern TCGv hex_llsc_val; extern TCGv_i64 hex_llsc_val_i64; -extern TCGv hex_VRegs_updated; -extern TCGv hex_QRegs_updated; extern TCGv hex_vstore_addr[VSTORES_MAX]; extern TCGv hex_vstore_size[VSTORES_MAX]; extern TCGv hex_vstore_pending[VSTORES_MAX]; diff --git a/target/hexagon/genptr.c b/target/hexagon/genptr.c index da5dbc83cf..bb274d4a71 100644 --- a/target/hexagon/genptr.c +++ b/target/hexagon/genptr.c @@ -985,68 +985,32 @@ static intptr_t vreg_src_off(DisasContext *ctx, int n= um) } =20 static void gen_log_vreg_write(DisasContext *ctx, intptr_t srcoff, int num, - VRegWriteType type, int slot_num, - bool is_predicated) + VRegWriteType type) { - TCGLabel *label_end =3D NULL; intptr_t dstoff; =20 - if (is_predicated) { - TCGv cancelled =3D tcg_temp_new(); - label_end =3D gen_new_label(); - - /* Don't do anything if the slot was cancelled */ - tcg_gen_extract_tl(cancelled, hex_slot_cancelled, slot_num, 1); - tcg_gen_brcondi_tl(TCG_COND_NE, cancelled, 0, label_end); - } - if (type !=3D EXT_TMP) { dstoff =3D ctx_future_vreg_off(ctx, num, 1, true); tcg_gen_gvec_mov(MO_64, dstoff, srcoff, sizeof(MMVector), sizeof(MMVector)); - tcg_gen_ori_tl(hex_VRegs_updated, hex_VRegs_updated, 1 << num); } else { dstoff =3D ctx_tmp_vreg_off(ctx, num, 1, false); tcg_gen_gvec_mov(MO_64, dstoff, srcoff, sizeof(MMVector), sizeof(MMVector)); } - - if (is_predicated) { - gen_set_label(label_end); - } } =20 static void gen_log_vreg_write_pair(DisasContext *ctx, intptr_t srcoff, in= t num, - VRegWriteType type, int slot_num, - bool is_predicated) + VRegWriteType type) { - gen_log_vreg_write(ctx, srcoff, num ^ 0, type, slot_num, is_predicated= ); + gen_log_vreg_write(ctx, srcoff, num ^ 0, type); srcoff +=3D sizeof(MMVector); - gen_log_vreg_write(ctx, srcoff, num ^ 1, type, slot_num, is_predicated= ); + gen_log_vreg_write(ctx, srcoff, num ^ 1, type); } =20 -static void gen_log_qreg_write(intptr_t srcoff, int num, int vnew, - int slot_num, bool is_predicated) +static intptr_t get_result_qreg(DisasContext *ctx, int qnum) { - TCGLabel *label_end =3D NULL; - intptr_t dstoff; - - if (is_predicated) { - TCGv cancelled =3D tcg_temp_new(); - label_end =3D gen_new_label(); - - /* Don't do anything if the slot was cancelled */ - tcg_gen_extract_tl(cancelled, hex_slot_cancelled, slot_num, 1); - tcg_gen_brcondi_tl(TCG_COND_NE, cancelled, 0, label_end); - } - - dstoff =3D offsetof(CPUHexagonState, future_QRegs[num]); - tcg_gen_gvec_mov(MO_64, dstoff, srcoff, sizeof(MMQReg), sizeof(MMQReg)= ); - - if (is_predicated) { - tcg_gen_ori_tl(hex_QRegs_updated, hex_QRegs_updated, 1 << num); - gen_set_label(label_end); - } + return offsetof(CPUHexagonState, future_QRegs[qnum]); } =20 static void gen_vreg_load(DisasContext *ctx, intptr_t dstoff, TCGv src, diff --git a/target/hexagon/translate.c b/target/hexagon/translate.c index 1e3a76aece..665476ab48 100644 --- a/target/hexagon/translate.c +++ b/target/hexagon/translate.c @@ -56,8 +56,6 @@ TCGv hex_dczero_addr; TCGv hex_llsc_addr; TCGv hex_llsc_val; TCGv_i64 hex_llsc_val_i64; -TCGv hex_VRegs_updated; -TCGv hex_QRegs_updated; TCGv hex_vstore_addr[VSTORES_MAX]; TCGv hex_vstore_size[VSTORES_MAX]; TCGv hex_vstore_pending[VSTORES_MAX]; @@ -248,12 +246,11 @@ static bool check_for_attrib(Packet *pkt, int attrib) =20 static bool need_slot_cancelled(Packet *pkt) { - /* We only need slot_cancelled for conditional store and HVX instructi= ons */ + /* We only need slot_cancelled for conditional store instructions */ for (int i =3D 0; i < pkt->num_insns; i++) { uint16_t opcode =3D pkt->insn[i].opcode; if (GET_ATTRIB(opcode, A_CONDEXEC) && - (GET_ATTRIB(opcode, A_STORE) || - GET_ATTRIB(opcode, A_CVI))) { + GET_ATTRIB(opcode, A_SCALAR_STORE)) { return true; } } @@ -453,11 +450,6 @@ static void gen_start_packet(DisasContext *ctx) i =3D find_next_bit(ctx->predicated_tmp_vregs, NUM_VREGS, i + = 1); } } - - if (pkt->pkt_has_hvx) { - tcg_gen_movi_tl(hex_VRegs_updated, 0); - tcg_gen_movi_tl(hex_QRegs_updated, 0); - } } =20 bool is_gather_store_insn(DisasContext *ctx) @@ -725,65 +717,31 @@ static void gen_commit_hvx(DisasContext *ctx) /* * for (i =3D 0; i < ctx->vreg_log_idx; i++) { * int rnum =3D ctx->vreg_log[i]; - * if (ctx->vreg_is_predicated[i]) { - * if (env->VRegs_updated & (1 << rnum)) { - * env->VRegs[rnum] =3D env->future_VRegs[rnum]; - * } - * } else { - * env->VRegs[rnum] =3D env->future_VRegs[rnum]; - * } + * env->VRegs[rnum] =3D env->future_VRegs[rnum]; * } */ for (i =3D 0; i < ctx->vreg_log_idx; i++) { int rnum =3D ctx->vreg_log[i]; - bool is_predicated =3D ctx->vreg_is_predicated[i]; intptr_t dstoff =3D offsetof(CPUHexagonState, VRegs[rnum]); intptr_t srcoff =3D ctx_future_vreg_off(ctx, rnum, 1, false); size_t size =3D sizeof(MMVector); =20 - if (is_predicated) { - TCGv cmp =3D tcg_temp_new(); - TCGLabel *label_skip =3D gen_new_label(); - - tcg_gen_andi_tl(cmp, hex_VRegs_updated, 1 << rnum); - tcg_gen_brcondi_tl(TCG_COND_EQ, cmp, 0, label_skip); - tcg_gen_gvec_mov(MO_64, dstoff, srcoff, size, size); - gen_set_label(label_skip); - } else { - tcg_gen_gvec_mov(MO_64, dstoff, srcoff, size, size); - } + tcg_gen_gvec_mov(MO_64, dstoff, srcoff, size, size); } =20 /* * for (i =3D 0; i < ctx->qreg_log_idx; i++) { * int rnum =3D ctx->qreg_log[i]; - * if (ctx->qreg_is_predicated[i]) { - * if (env->QRegs_updated) & (1 << rnum)) { - * env->QRegs[rnum] =3D env->future_QRegs[rnum]; - * } - * } else { - * env->QRegs[rnum] =3D env->future_QRegs[rnum]; - * } + * env->QRegs[rnum] =3D env->future_QRegs[rnum]; * } */ for (i =3D 0; i < ctx->qreg_log_idx; i++) { int rnum =3D ctx->qreg_log[i]; - bool is_predicated =3D ctx->qreg_is_predicated[i]; intptr_t dstoff =3D offsetof(CPUHexagonState, QRegs[rnum]); intptr_t srcoff =3D offsetof(CPUHexagonState, future_QRegs[rnum]); size_t size =3D sizeof(MMQReg); =20 - if (is_predicated) { - TCGv cmp =3D tcg_temp_new(); - TCGLabel *label_skip =3D gen_new_label(); - - tcg_gen_andi_tl(cmp, hex_QRegs_updated, 1 << rnum); - tcg_gen_brcondi_tl(TCG_COND_EQ, cmp, 0, label_skip); - tcg_gen_gvec_mov(MO_64, dstoff, srcoff, size, size); - gen_set_label(label_skip); - } else { - tcg_gen_gvec_mov(MO_64, dstoff, srcoff, size, size); - } + tcg_gen_gvec_mov(MO_64, dstoff, srcoff, size, size); } =20 if (pkt_has_hvx_store(ctx->pkt)) { @@ -1129,10 +1087,6 @@ void hexagon_translate_init(void) offsetof(CPUHexagonState, llsc_val), "llsc_val"); hex_llsc_val_i64 =3D tcg_global_mem_new_i64(cpu_env, offsetof(CPUHexagonState, llsc_val_i64), "llsc_val_i64"); - hex_VRegs_updated =3D tcg_global_mem_new(cpu_env, - offsetof(CPUHexagonState, VRegs_updated), "VRegs_updated"); - hex_QRegs_updated =3D tcg_global_mem_new(cpu_env, - offsetof(CPUHexagonState, QRegs_updated), "QRegs_updated"); for (i =3D 0; i < STORES_MAX; i++) { snprintf(store_addr_names[i], NAME_LEN, "store_addr_%d", i); hex_store_addr[i] =3D tcg_global_mem_new(cpu_env, diff --git a/target/hexagon/README b/target/hexagon/README index 365606f1e6..ebafc78b1c 100644 --- a/target/hexagon/README +++ b/target/hexagon/README @@ -136,12 +136,9 @@ For HVX vectors, the generator behaves slightly differ= ently. The wide vectors won't fit in a TCGv or TCGv_i64, so we pass TCGv_ptr variables to pass the address to helper functions. Here's an example for an HVX vector-add-word istruction. - static void generate_V6_vaddw( - CPUHexagonState *env, - DisasContext *ctx, - Insn *insn, - Packet *pkt) + static void generate_V6_vaddw(DisasContext *ctx) { + Insn *insn __attribute__((unused)) =3D ctx->insn; const int VdN =3D insn->regno[0]; const intptr_t VdV_off =3D ctx_future_vreg_off(ctx, VdN, 1, true); @@ -157,9 +154,7 @@ istruction. TCGv_ptr VvV =3D tcg_temp_new_ptr(); tcg_gen_addi_ptr(VuV, cpu_env, VuV_off); tcg_gen_addi_ptr(VvV, cpu_env, VvV_off); - TCGv slot =3D tcg_constant_tl(insn->slot); - gen_helper_V6_vaddw(cpu_env, VdV, VuV, VvV, slot); - gen_log_vreg_write(ctx, VdV_off, VdN, EXT_DFL, insn->slot, false); + gen_helper_V6_vaddw(cpu_env, VdV, VuV, VvV); } =20 Notice that we also generate a variable named _off for each opera= nd of @@ -172,12 +167,9 @@ functions from tcg-op-gvec.h. Here's the override for= this instruction. Finally, we notice that the override doesn't use the TCGv_ptr variables, so we don't generate them when an override is present. Here is what we gener= ate when the override is present. - static void generate_V6_vaddw( - CPUHexagonState *env, - DisasContext *ctx, - Insn *insn, - Packet *pkt) + static void generate_V6_vaddw(DisasContext *ctx) { + Insn *insn __attribute__((unused)) =3D ctx->insn; const int VdN =3D insn->regno[0]; const intptr_t VdV_off =3D ctx_future_vreg_off(ctx, VdN, 1, true); @@ -188,7 +180,6 @@ when the override is present. const intptr_t VvV_off =3D vreg_src_off(ctx, VvN); fGEN_TCG_V6_vaddw({ fHIDE(int i;) fVFOREACH(32, i) { VdV.w[i] =3D = VuV.w[i] + VvV.w[i] ; } }); - gen_log_vreg_write(ctx, VdV_off, VdN, EXT_DFL, insn->slot, false); } =20 We also generate an analyze_ function for each instruction. Currentl= y, @@ -281,10 +272,8 @@ For Hexagon Vector eXtensions (HVX), the following fie= lds are used VRegs Vector registers future_VRegs Registers to be stored during packet commit tmp_VRegs Temporary registers *not* stored during co= mmit - VRegs_updated Mask of predicated vector writes QRegs Q (vector predicate) registers future_QRegs Registers to be stored during packet commit - QRegs_updated Mask of predicated vector writes =20 *** Debugging *** =20 diff --git a/target/hexagon/gen_analyze_funcs.py b/target/hexagon/gen_analy= ze_funcs.py index 0bb4fcb476..ebd3e7afb9 100755 --- a/target/hexagon/gen_analyze_funcs.py +++ b/target/hexagon/gen_analyze_funcs.py @@ -110,8 +110,7 @@ def analyze_opn_old(f, tag, regtype, regid, regno): if (regid in {"d", "e", "x"}): f.write(" const int %s =3D insn->regno[%d];\n" % \ (regN, regno)) - f.write(" ctx_log_qreg_write(ctx, %s, %s);\n" % \ - (regN, predicated)) + f.write(" ctx_log_qreg_write(ctx, %s);\n" % (regN)) elif (regid in {"s", "t", "u", "v"}): f.write("// const int %s =3D insn->regno[%d];\n" % \ (regN, regno)) diff --git a/target/hexagon/gen_tcg_funcs.py b/target/hexagon/gen_tcg_funcs= .py index 9336528e50..fa93e185ce 100755 --- a/target/hexagon/gen_tcg_funcs.py +++ b/target/hexagon/gen_tcg_funcs.py @@ -176,8 +176,7 @@ def genptr_decl(f, tag, regtype, regid, regno): (regtype, regid, regno)) f.write(" const intptr_t %s%sV_off =3D\n" % \ (regtype, regid)) - f.write(" offsetof(CPUHexagonState,\n") - f.write(" future_QRegs[%s%sN]);\n" % \ + f.write(" get_result_qreg(ctx, %s%sN);\n" % \ (regtype, regid)) if (not hex_common.skip_qemu_helper(tag)): f.write(" TCGv_ptr %s%sV =3D tcg_temp_new_ptr();\n" % \ @@ -406,36 +405,18 @@ def genptr_dst_write(f, tag, regtype, regid): =20 def genptr_dst_write_ext(f, tag, regtype, regid, newv=3D"EXT_DFL"): if (regtype =3D=3D "V"): - if (regid in {"dd", "xx", "yy"}): - if ('A_CONDEXEC' in hex_common.attribdict[tag]): - is_predicated =3D "true" - else: - is_predicated =3D "false" + if (regid in {"xx"}): f.write(" gen_log_vreg_write_pair(ctx, %s%sV_off, %s%sN, " = % \ (regtype, regid, regtype, regid)) - f.write("%s, insn->slot, %s);\n" % \ - (newv, is_predicated)) - elif (regid in {"d", "x", "y"}): - if ('A_CONDEXEC' in hex_common.attribdict[tag]): - is_predicated =3D "true" - else: - is_predicated =3D "false" - f.write(" gen_log_vreg_write(ctx, %s%sV_off, %s%sN, %s, " %= \ + f.write("%s);\n" % \ + (newv)) + elif (regid in {"y"}): + f.write(" gen_log_vreg_write(ctx, %s%sV_off, %s%sN, %s);\n"= % \ (regtype, regid, regtype, regid, newv)) - f.write("insn->slot, %s);\n" % \ - (is_predicated)) - else: + elif (regid not in {"dd", "d", "x"}): print("Bad register parse: ", regtype, regid) elif (regtype =3D=3D "Q"): - if (regid in {"d", "e", "x"}): - if ('A_CONDEXEC' in hex_common.attribdict[tag]): - is_predicated =3D "true" - else: - is_predicated =3D "false" - f.write(" gen_log_qreg_write(%s%sV_off, %s%sN, %s, " % \ - (regtype, regid, regtype, regid, newv)) - f.write("insn->slot, %s);\n" % (is_predicated)) - else: + if (regid not in {"d", "e", "x"}): print("Bad register parse: ", regtype, regid) else: print("Bad register parse: ", regtype, regid) --=20 2.25.1