From nobody Sun May 11 16:12:02 2025 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=1674614651; cv=none; d=zohomail.com; s=zohoarc; b=Sstt4SC+o71Q2MnSRi+pGHhwFrq2vutGu4aJGlA6C/MdJLOAMhfbPSpBi31qxUshgBUb8UPkCEXLifeuTMrRkSDfZJLtWEnq4KapZK2pU+ORlOVUY6VuuSixKwoJ+OXzgvWL5eMdF+oUjnPnx5eOZTfqDeEu/7KzgVEb+AJYlgw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674614651; 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=zdDTJ+OXdcRK66CBOF2oz5Cttm/jzag+QXzIfxAV6j0=; b=mceN6wP84xZl9IHoYXIEtwiJ4wG4ZPVD8mflD5yVZoMMX7orGvpVpNeYvYpwZ5l3ag/Z/PgR4bzRe99KPQ8XL6Jf384dOhPatFPGQ4xA0jdGCeSKXLAL+JmauL+4W6ZTvq4IhBm0+Oi7jcnh+Q2eNjg+Jf0RnKmX4PlHN5+RcS8= 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 1674614651188509.4908121024732; Tue, 24 Jan 2023 18:44:11 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pKVkA-0006iG-Bn; Tue, 24 Jan 2023 21:42:34 -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 1pKVk5-0006hw-Nx for qemu-devel@nongnu.org; Tue, 24 Jan 2023 21:42:30 -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 1pKVk0-00079N-TC for qemu-devel@nongnu.org; Tue, 24 Jan 2023 21:42:26 -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 30P2Zt8A008907; Wed, 25 Jan 2023 02:42:18 GMT Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3n89dr69rs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 25 Jan 2023 02:42:18 +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 30P2gH38002324; Wed, 25 Jan 2023 02:42:17 GMT Received: from pps.reinject (localhost [127.0.0.1]) by NALASPPMTA02.qualcomm.com (PPS) with ESMTP id 3n894kr7eg-1; Wed, 25 Jan 2023 02:42:17 +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 30P2dSNe031957; Wed, 25 Jan 2023 02:42:17 GMT Received: from hu-devc-lv-u18-c.qualcomm.com (hu-tsimpson-lv.qualcomm.com [10.47.235.220]) by NALASPPMTA02.qualcomm.com (PPS) with ESMTP id 30P2gGss002305; Wed, 25 Jan 2023 02:42:17 +0000 Received: by hu-devc-lv-u18-c.qualcomm.com (Postfix, from userid 47164) id 79BB05000AF; Tue, 24 Jan 2023 18:42:16 -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=zdDTJ+OXdcRK66CBOF2oz5Cttm/jzag+QXzIfxAV6j0=; b=JT5WqgPJwJRJLQsYlYbZD9RO0slDAlAGFO42QkdB5xPGjQAMNNHECTB7ztI7/bzpvPPA lLG76nUee2r/8ggPSW9bG5oaeMFi4c3LVkGYXEnDUzvJO6Pn+8yJUcwlYt8gpHYLye86 bAM5b9I9R/NY+H3f0n1xydV0FjPkbg0EVHKQv0MfINImFgrmPum1JXY+fYB6G6p29zvx nFPNAlJXltd+scZ5OqjMN8e68ZHUGndMpvkycDgKjcHAS5B/1Yu6kAL0X8WBB2qHPkAB BGt4EaNKJc7ajUAv+Z76zvrp9UfVuKdCAu2ga10faYCsvGTeW8n/ICGl/8FnpXBlSVdq IA== From: Taylor Simpson To: qemu-devel@nongnu.org Cc: tsimpson@quicinc.com, richard.henderson@linaro.org, philmd@linaro.org, ale@rev.ng, anjo@rev.ng, bcain@quicinc.com, quic_mathbern@quicinc.com Subject: [PATCH v4 03/13] Hexagon (target/hexagon) Add overrides for endloop1/endloop01 Date: Tue, 24 Jan 2023 18:42:05 -0800 Message-Id: <20230125024215.10430-4-tsimpson@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230125024215.10430-1-tsimpson@quicinc.com> References: <20230125024215.10430-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: _NvttFf62WQWodBrzC-5hHRNeFUsbUbU X-Proofpoint-ORIG-GUID: _NvttFf62WQWodBrzC-5hHRNeFUsbUbU X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-24_17,2023-01-24_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 clxscore=1015 priorityscore=1501 impostorscore=0 suspectscore=0 spamscore=0 adultscore=0 bulkscore=0 mlxlogscore=663 phishscore=0 malwarescore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301250020 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.248, 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: 1674614653025100006 Signed-off-by: Taylor Simpson --- target/hexagon/gen_tcg.h | 4 ++ target/hexagon/genptr.c | 79 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+) diff --git a/target/hexagon/gen_tcg.h b/target/hexagon/gen_tcg.h index 9e8f3373ad..6267f51ccc 100644 --- a/target/hexagon/gen_tcg.h +++ b/target/hexagon/gen_tcg.h @@ -628,6 +628,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 360bcd0a19..e17ac93a59 100644 --- a/target/hexagon/genptr.c +++ b/target/hexagon/genptr.c @@ -803,6 +803,85 @@ static void gen_endloop0(DisasContext *ctx) tcg_temp_free(lpcfg); } =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_local_new(); + + GET_USR_FIELD(USR_LPCFG, lpcfg); + + /* + * if (lpcfg =3D=3D 1) { + * hex_new_pred_value[3] =3D 0xff; + * hex_pred_written |=3D 1 << 3; + * } + */ + TCGLabel *label1 =3D gen_new_label(); + 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); + * } + */ + TCGLabel *label2 =3D gen_new_label(); + 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; + * } + * } + */ + TCGLabel *label3 =3D gen_new_label(); + TCGLabel *done =3D gen_new_label(); + 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); + tcg_temp_free(lpcfg); +} + static void gen_cmp_jumpnv(DisasContext *ctx, TCGCond cond, TCGv val, TCGv src, int pc_off) { --=20 2.17.1