From patchwork Thu Apr 27 22:59:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taylor Simpson X-Patchwork-Id: 13225818 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D850EC77B61 for ; Thu, 27 Apr 2023 23:03:03 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1psAbA-0001kq-VT; Thu, 27 Apr 2023 19:00:24 -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 1psAb8-0001iw-5v for qemu-devel@nongnu.org; Thu, 27 Apr 2023 19:00:22 -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 1psAb3-0001KU-NF for qemu-devel@nongnu.org; Thu, 27 Apr 2023 19:00:21 -0400 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 33RMu1TO015446; Thu, 27 Apr 2023 23:00:15 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : mime-version : content-type : content-transfer-encoding; s=qcppdkim1; bh=24cGa+5lKgaVRy0guvfzG164ckqIR+tG4TQDa2OiYPE=; b=pD6ZhXlqyNBB8n9HYQCY+OsaFNyXECtH7KDWNhOgpicaCpO3QBr6h1Y2u0juqp7Pfkqf NSks37JhQWlLdyKyiuZ2j8EwAz4r2pqodp0FJqZOVCR/acc6G9fkxQ9PgqXrVvcXhOow jylfg7TBKSAdZ4QCIQf7+TCgjobMMLH161PRb5d3y8Bh1GnaKwbpA6qbBvXlAIokns0y bcMqbqy9sgISM0duP6tqYBYreYKxK43mhbqPTyYVhGqzl3zEqnEs160ECNQPAbXEz0SE rZGHNU114/aiPKA2wD5gOpvXT2kX7Yau9Qbhbc8SQ+RYKm7dbVCQA+nU4psYLoJT44yp Iw== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3q7yg4g9bt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 27 Apr 2023 23:00:15 +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 33RMt5Xb020047; Thu, 27 Apr 2023 23:00:14 GMT Received: from pps.reinject (localhost [127.0.0.1]) by NALASPPMTA05.qualcomm.com (PPS) with ESMTPS id 3q48nmt9ed-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 27 Apr 2023 23:00:14 +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 33RN0EWt025271; Thu, 27 Apr 2023 23:00:14 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 33RN0DFQ025250 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 27 Apr 2023 23:00:14 +0000 Received: by hu-devc-sd-u20-a-1.qualcomm.com (Postfix, from userid 47164) id B3DAC660; Thu, 27 Apr 2023 16:00:13 -0700 (PDT) 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 v2 00/21] Hexagon (target/hexagon) short-circuit and move to DisasContext Date: Thu, 27 Apr 2023 15:59:51 -0700 Message-Id: <20230427230012.3800327-1-tsimpson@quicinc.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 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: 0LX-2GeENFIklO_MjR-gF6UKzoeMLdwH X-Proofpoint-ORIG-GUID: 0LX-2GeENFIklO_MjR-gF6UKzoeMLdwH 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-04-27_09,2023-04-27_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 lowpriorityscore=0 phishscore=0 suspectscore=0 bulkscore=0 impostorscore=0 adultscore=0 malwarescore=0 mlxlogscore=517 priorityscore=1501 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304270202 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, T_SCC_BODY_TEXT_LINE=-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org This patch series achieves two major goals Goal 1: Short-circuit packet semantics In certain cases, we can avoid the overhead of writing to hex_new_value and write directly to hex_gpr. Here's a simple example of the TCG generated for 0x004000b4: 0x7800c020 { R0 = #0x1 } BEFORE: ---- 004000b4 movi_i32 new_r0,$0x1 mov_i32 r0,new_r0 AFTER: ---- 004000b4 movi_i32 r0,$0x1 Goal 2: Move bookkeeping items from CPUHexagonState to DisasContext Suggested-by: Richard Henderson Several fields in CPUHexagonState are only used for bookkeeping within the translation of a packet. With recent changes to eliminate the need to free TCGv variables, these make more sense to be transient and kept in DisasContext. This patch series can be divided into 3 main parts Part 1: Patches 1-9 Cleanup in preparation for parts 2 and 3 The main goal is to move functionality out of generated helpers Part 2: Patches 10-15 Short-circuit packet semantics Part 3: Patches 16-21 Move bookkeeping items from CPUHexagonState to DisasContext **** Changes in v2 **** Address feedback from Richard Henderson < Cleaner implementation of gen_frame_scramble Add g_assert_not_reached() in gen_framecheck Move TCGv allocation inside gen_frame_scramble Change tcg_gen_brcond_tl to tcg_gen_movcond_tl Change static inline to G_GNUC_UNUSED Removed in later patch Change tcg_gen_not_i64 + tcg_gen_and_i64 to tcg_gen_andc_i64 Use full constant in gen_slotval Taylor Simpson (21): meson.build Add CONFIG_HEXAGON_IDEF_PARSER Hexagon (target/hexagon) Add DisasContext arg to gen_log_reg_write Hexagon (target/hexagon) Add overrides for loop setup instructions Hexagon (target/hexagon) Add overrides for allocframe/deallocframe Hexagon (target/hexagon) Add overrides for clr[tf]new Hexagon (target/hexagon) Remove log_reg_write from op_helper.[ch] Hexagon (target/hexagon) Eliminate uses of log_pred_write function Hexagon (target/hexagon) Clean up pred_written usage Hexagon (target/hexagon) Don't overlap dest writes with source reads Hexagon (target/hexagon) Mark registers as read during packet analysis Hexagon (target/hexagon) Short-circuit packet register writes Hexagon (target/hexagon) Short-circuit packet predicate writes Hexagon (target/hexagon) Short-circuit packet HVX writes Hexagon (target/hexagon) Short-circuit more HVX single instruction packets Hexagon (target/hexagon) Add overrides for disabled idef-parser insns Hexagon (target/hexagon) Make special new_value for USR Hexagon (target/hexagon) Move new_value to DisasContext Hexagon (target/hexagon) Move new_pred_value to DisasContext Hexagon (target/hexagon) Move pred_written to DisasContext Hexagon (target/hexagon) Move pkt_has_store_s1 to DisasContext Hexagon (target/hexagon) Move items to DisasContext meson.build | 1 + target/hexagon/cpu.h | 10 +- target/hexagon/gen_tcg.h | 116 ++++++- target/hexagon/gen_tcg_hvx.h | 23 ++ target/hexagon/genptr.h | 6 +- target/hexagon/helper.h | 6 +- target/hexagon/macros.h | 57 ++-- target/hexagon/op_helper.h | 16 +- target/hexagon/translate.h | 52 ++- target/hexagon/attribs_def.h.inc | 6 +- target/hexagon/arch.c | 3 +- target/hexagon/cpu.c | 5 +- target/hexagon/genptr.c | 347 ++++++++++++++++---- target/hexagon/idef-parser/parser-helpers.c | 4 +- target/hexagon/op_helper.c | 154 ++++++--- target/hexagon/translate.c | 272 ++++++++++----- tests/tcg/hexagon/hvx_misc.c | 21 ++ tests/tcg/hexagon/read_write_overlap.c | 136 ++++++++ target/hexagon/README | 6 +- target/hexagon/gen_analyze_funcs.py | 51 ++- target/hexagon/gen_helper_funcs.py | 9 +- target/hexagon/gen_helper_protos.py | 10 +- target/hexagon/gen_idef_parser_funcs.py | 7 + target/hexagon/gen_tcg_funcs.py | 21 +- target/hexagon/hex_common.py | 16 +- tests/tcg/hexagon/Makefile.target | 1 + 26 files changed, 1063 insertions(+), 293 deletions(-) create mode 100644 tests/tcg/hexagon/read_write_overlap.c