From nobody Tue Feb 10 10:03:45 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=quicinc.com ARC-Seal: i=1; a=rsa-sha256; t=1683928191; cv=none; d=zohomail.com; s=zohoarc; b=B0eVf4VovrmwW4VV8iyh/PwickBb+IYaNM8GjvovbbrH43sQhra+T2S1B2F+D405MUIyZFKcvmupt/d2Iby6o3oIel7T36626Ob0OECCGeKpTzW0ESwGgJ0wco3na6Xv3zSEcn0quyaTP8+V85w+/QpcVxxgji9CZWOq/5N4VN8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683928191; 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=VRZnFjMgqqK08qSK0AY+3ddvJZZL16p/gwBAAg59IHY=; b=M/QESJRcyxfBlfGbqLtqbI+GdZQky0rC7lMGrCyXExT1D8mlLiV+bXuOxaU7eufEczeslNzrYE/LpZ4NdH609CuXYYynG/Mlo5MoweCXduyKtpNlPLPDNIIaNKbKQuszV8lagZcd4KXJuFayIgD249aLztK/41wkvWKWO6c5J1c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1683928191280409.7858466520461; Fri, 12 May 2023 14:49:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pxacU-0002uJ-GG; Fri, 12 May 2023 17:48:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pxacM-0002nV-R3 for qemu-devel@nongnu.org; Fri, 12 May 2023 17:48:03 -0400 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pxaby-00065V-5r for qemu-devel@nongnu.org; Fri, 12 May 2023 17:48:02 -0400 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 34CJwdW9029177; Fri, 12 May 2023 21:47:25 GMT Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3qhj9s1p4j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 12 May 2023 21:47:25 +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 34CLlORU010016; Fri, 12 May 2023 21:47:24 GMT Received: from pps.reinject (localhost [127.0.0.1]) by NALASPPMTA03.qualcomm.com (PPS) with ESMTPS id 3qh5rq7uah-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 12 May 2023 21:47:24 +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 34CLlND4010000; Fri, 12 May 2023 21:47:23 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 34CLlNMV009984 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 12 May 2023 21:47:23 +0000 Received: by hu-devc-sd-u20-a-1.qualcomm.com (Postfix, from userid 47164) id 25F636D4; Fri, 12 May 2023 14:47:22 -0700 (PDT) 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=VRZnFjMgqqK08qSK0AY+3ddvJZZL16p/gwBAAg59IHY=; b=V2hKKAt5SCaXCm6mxdGfqX9e0MTen6NUJnHpua49i92t00Zxt/A229NbyMYpHZimYyJB 2Yv70WiubNW7GhB6qkzBD9PvXPmgasKNz/o4lgvdBdQxtYynQicFZCmEL0xk50cN0XoH 0/E1EHVsQzHjHRHGKvmtI8aJ2Cywm8xLB47SSh3TFm/xVW3uxkwsX12O3i9cElU4V8KJ DqeCqlmYHORmMAtA71poiKZMFrlqz6wHbrpFUXEeGTMwPYJcEr+J/xmsEXIo4uCB49h5 Q+ujw11+h+FGurGl3WZKoFeqwB4eZxsVp5mMeozTPP2vMIL7PxF0TlOOoHGaZ8Am3PDR Rw== 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, quic_mliebel@quicinc.com Subject: [PULL 27/44] Hexagon (target/hexagon) Move new_pred_value to DisasContext Date: Fri, 12 May 2023 14:46:49 -0700 Message-Id: <20230512214706.946068-28-tsimpson@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230512214706.946068-1-tsimpson@quicinc.com> References: <20230512214706.946068-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: NVpkWkQouLrxULBGiDXXlc63jGWrYFPa X-Proofpoint-GUID: NVpkWkQouLrxULBGiDXXlc63jGWrYFPa X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-12_14,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=972 mlxscore=0 adultscore=0 clxscore=1015 phishscore=0 lowpriorityscore=0 suspectscore=0 bulkscore=0 malwarescore=0 impostorscore=0 priorityscore=1501 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305120183 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.220.180.131; envelope-from=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_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_HELO_TEMPERROR=0.01 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @quicinc.com) X-ZM-MESSAGEID: 1683928193068100003 The new_pred_value array in the CPUHexagonState is only used for bookkeeping within the translation of a packet. With recent changes that eliminate the need to free TCGv variables, these make more sense to be transient and kept in DisasContext. Suggested-by: Richard Henderson Signed-off-by: Taylor Simpson Reviewed-by: Richard Henderson Message-Id: <20230427230012.3800327-19-tsimpson@quicinc.com> --- target/hexagon/cpu.h | 1 - target/hexagon/gen_tcg.h | 12 ++++++------ target/hexagon/translate.h | 2 +- target/hexagon/genptr.c | 10 +++++++--- target/hexagon/idef-parser/parser-helpers.c | 2 +- target/hexagon/op_helper.c | 2 +- target/hexagon/translate.c | 16 ++++++---------- target/hexagon/gen_tcg_funcs.py | 2 +- 8 files changed, 23 insertions(+), 24 deletions(-) diff --git a/target/hexagon/cpu.h b/target/hexagon/cpu.h index 0ef6d717d0..2b4f77fb8e 100644 --- a/target/hexagon/cpu.h +++ b/target/hexagon/cpu.h @@ -98,7 +98,6 @@ typedef struct CPUArchState { target_ulong this_PC; target_ulong reg_written[TOTAL_PER_THREAD_REGS]; =20 - target_ulong new_pred_value[NUM_PREGS]; target_ulong pred_written; =20 MemLog mem_log_stores[STORES_MAX]; diff --git a/target/hexagon/gen_tcg.h b/target/hexagon/gen_tcg.h index ed2c1ccc46..d78d99d155 100644 --- a/target/hexagon/gen_tcg.h +++ b/target/hexagon/gen_tcg.h @@ -581,9 +581,9 @@ #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]) + gen_cond_return_subinsn(ctx, TCG_COND_EQ, ctx->new_pred_value[0]) #define fGEN_TCG_SL2_return_fnew(SHORTCODE) \ - gen_cond_return_subinsn(ctx, TCG_COND_NE, hex_new_pred_value[0]) + gen_cond_return_subinsn(ctx, TCG_COND_NE, ctx->new_pred_value[0]) =20 /* * Mathematical operations with more than one definition require @@ -1122,7 +1122,7 @@ #define fGEN_TCG_SA1_clrtnew(SHORTCODE) \ do { \ tcg_gen_movcond_tl(TCG_COND_EQ, RdV, \ - hex_new_pred_value[0], tcg_constant_tl(0), \ + ctx->new_pred_value[0], tcg_constant_tl(0), \ RdV, tcg_constant_tl(0)); \ } while (0) =20 @@ -1130,7 +1130,7 @@ #define fGEN_TCG_SA1_clrfnew(SHORTCODE) \ do { \ tcg_gen_movcond_tl(TCG_COND_NE, RdV, \ - hex_new_pred_value[0], tcg_constant_tl(0), \ + ctx->new_pred_value[0], tcg_constant_tl(0), \ RdV, tcg_constant_tl(0)); \ } while (0) =20 @@ -1157,9 +1157,9 @@ gen_cond_jumpr31(ctx, TCG_COND_NE, hex_pred[0]) =20 #define fGEN_TCG_SL2_jumpr31_tnew(SHORTCODE) \ - gen_cond_jumpr31(ctx, TCG_COND_EQ, hex_new_pred_value[0]) + gen_cond_jumpr31(ctx, TCG_COND_EQ, ctx->new_pred_value[0]) #define fGEN_TCG_SL2_jumpr31_fnew(SHORTCODE) \ - gen_cond_jumpr31(ctx, TCG_COND_NE, hex_new_pred_value[0]) + gen_cond_jumpr31(ctx, TCG_COND_NE, ctx->new_pred_value[0]) =20 /* Count trailing zeros/ones */ #define fGEN_TCG_S2_ct0(SHORTCODE) \ diff --git a/target/hexagon/translate.h b/target/hexagon/translate.h index 6dde487566..fdfa1b6fe3 100644 --- a/target/hexagon/translate.h +++ b/target/hexagon/translate.h @@ -70,6 +70,7 @@ typedef struct DisasContext { bool short_circuit; bool has_hvx_helper; TCGv new_value[TOTAL_PER_THREAD_REGS]; + TCGv new_pred_value[NUM_PREGS]; } DisasContext; =20 static inline void ctx_log_pred_write(DisasContext *ctx, int pnum) @@ -193,7 +194,6 @@ extern TCGv hex_slot_cancelled; extern TCGv hex_branch_taken; extern TCGv hex_new_value_usr; extern TCGv hex_reg_written[TOTAL_PER_THREAD_REGS]; -extern TCGv hex_new_pred_value[NUM_PREGS]; extern TCGv hex_pred_written; extern TCGv hex_store_addr[STORES_MAX]; extern TCGv hex_store_width[STORES_MAX]; diff --git a/target/hexagon/genptr.c b/target/hexagon/genptr.c index 37210e6f09..1f69f4f922 100644 --- a/target/hexagon/genptr.c +++ b/target/hexagon/genptr.c @@ -121,7 +121,11 @@ static void gen_log_reg_write_pair(DisasContext *ctx, = int rnum, TCGv_i64 val) TCGv get_result_pred(DisasContext *ctx, int pnum) { if (ctx->need_commit) { - return hex_new_pred_value[pnum]; + if (ctx->new_pred_value[pnum] =3D=3D NULL) { + ctx->new_pred_value[pnum] =3D tcg_temp_new(); + tcg_gen_movi_tl(ctx->new_pred_value[pnum], 0); + } + return ctx->new_pred_value[pnum]; } else { return hex_pred[pnum]; } @@ -607,7 +611,7 @@ static void gen_cmpnd_cmp_jmp(DisasContext *ctx, gen_log_pred_write(ctx, pnum, pred); } else { TCGv pred =3D tcg_temp_new(); - tcg_gen_mov_tl(pred, hex_new_pred_value[pnum]); + tcg_gen_mov_tl(pred, ctx->new_pred_value[pnum]); gen_cond_jump(ctx, cond2, pred, pc_off); } } @@ -664,7 +668,7 @@ static void gen_cmpnd_tstbit0_jmp(DisasContext *ctx, gen_log_pred_write(ctx, pnum, pred); } else { TCGv pred =3D tcg_temp_new(); - tcg_gen_mov_tl(pred, hex_new_pred_value[pnum]); + tcg_gen_mov_tl(pred, ctx->new_pred_value[pnum]); gen_cond_jump(ctx, cond, pred, pc_off); } } diff --git a/target/hexagon/idef-parser/parser-helpers.c b/target/hexagon/i= def-parser/parser-helpers.c index 09161e394d..6626e006f6 100644 --- a/target/hexagon/idef-parser/parser-helpers.c +++ b/target/hexagon/idef-parser/parser-helpers.c @@ -1854,7 +1854,7 @@ HexValue gen_rvalue_pred(Context *c, YYLTYPE *locp, H= exValue *pred) *pred =3D gen_tmp(c, locp, 32, UNSIGNED); if (is_dotnew) { OUT(c, locp, "tcg_gen_mov_i32(", pred, - ", hex_new_pred_value["); + ", ctx->new_pred_value["); OUT(c, locp, pred_str, "]);\n"); } else { OUT(c, locp, "gen_read_preg(", pred, ", ", pred_str, ");\n"); diff --git a/target/hexagon/op_helper.c b/target/hexagon/op_helper.c index fc5c30a141..26fba9f5d6 100644 --- a/target/hexagon/op_helper.c +++ b/target/hexagon/op_helper.c @@ -231,7 +231,7 @@ void HELPER(debug_commit_end)(CPUHexagonState *env, int= has_st0, int has_st1) pred_printed =3D true; } HEX_DEBUG_LOG("\tp%d =3D 0x" TARGET_FMT_lx "\n", - i, env->new_pred_value[i]); + i, env->pred[i]); } } =20 diff --git a/target/hexagon/translate.c b/target/hexagon/translate.c index bca42797c0..459aace921 100644 --- a/target/hexagon/translate.c +++ b/target/hexagon/translate.c @@ -46,7 +46,6 @@ TCGv hex_slot_cancelled; TCGv hex_branch_taken; TCGv hex_new_value_usr; TCGv hex_reg_written[TOTAL_PER_THREAD_REGS]; -TCGv hex_new_pred_value[NUM_PREGS]; TCGv hex_pred_written; TCGv hex_store_addr[STORES_MAX]; TCGv hex_store_width[STORES_MAX]; @@ -515,6 +514,9 @@ static void gen_start_packet(DisasContext *ctx) for (i =3D 0; i < TOTAL_PER_THREAD_REGS; i++) { ctx->new_value[i] =3D NULL; } + for (i =3D 0; i < NUM_PREGS; i++) { + ctx->new_pred_value[i] =3D NULL; + } =20 analyze_packet(ctx); =20 @@ -568,7 +570,8 @@ static void gen_start_packet(DisasContext *ctx) if (ctx->need_commit && pkt->pkt_has_endloop) { for (int i =3D 0; i < ctx->preg_log_idx; i++) { int pred_num =3D ctx->preg_log[i]; - tcg_gen_mov_tl(hex_new_pred_value[pred_num], hex_pred[pred_num= ]); + ctx->new_pred_value[pred_num] =3D tcg_temp_new(); + tcg_gen_mov_tl(ctx->new_pred_value[pred_num], hex_pred[pred_nu= m]); } } =20 @@ -691,7 +694,7 @@ static void gen_pred_writes(DisasContext *ctx) =20 for (int i =3D 0; i < ctx->preg_log_idx; i++) { int pred_num =3D ctx->preg_log[i]; - tcg_gen_mov_tl(hex_pred[pred_num], hex_new_pred_value[pred_num]); + tcg_gen_mov_tl(hex_pred[pred_num], ctx->new_pred_value[pred_num]); } } =20 @@ -1162,7 +1165,6 @@ void gen_intermediate_code(CPUState *cs, TranslationB= lock *tb, int *max_insns, =20 #define NAME_LEN 64 static char reg_written_names[TOTAL_PER_THREAD_REGS][NAME_LEN]; -static char new_pred_value_names[NUM_PREGS][NAME_LEN]; static char store_addr_names[STORES_MAX][NAME_LEN]; static char store_width_names[STORES_MAX][NAME_LEN]; static char store_val32_names[STORES_MAX][NAME_LEN]; @@ -1197,12 +1199,6 @@ void hexagon_translate_init(void) hex_pred[i] =3D tcg_global_mem_new(cpu_env, offsetof(CPUHexagonState, pred[i]), hexagon_prednames[i]); - - snprintf(new_pred_value_names[i], NAME_LEN, "new_pred_%s", - hexagon_prednames[i]); - hex_new_pred_value[i] =3D tcg_global_mem_new(cpu_env, - offsetof(CPUHexagonState, new_pred_value[i]), - new_pred_value_names[i]); } hex_pred_written =3D tcg_global_mem_new(cpu_env, offsetof(CPUHexagonState, pred_written), "pred_written"); diff --git a/target/hexagon/gen_tcg_funcs.py b/target/hexagon/gen_tcg_funcs= .py index a36117d57f..0403547387 100755 --- a/target/hexagon/gen_tcg_funcs.py +++ b/target/hexagon/gen_tcg_funcs.py @@ -198,7 +198,7 @@ def genptr_decl_new(f, tag, regtype, regid, regno): if regid in {"t", "u", "v"}: f.write( f" TCGv {regtype}{regid}N =3D " - f"hex_new_pred_value[insn->regno[{regno}]];\n" + f"ctx->new_pred_value[insn->regno[{regno}]];\n" ) else: print("Bad register parse: ", regtype, regid) --=20 2.25.1