From nobody Sat Jan 3 12:32:34 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=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1767384821; cv=none; d=zohomail.com; s=zohoarc; b=Y7Gzxpkbve5BMsKs0T0/1sjhFsKSLn8fQoNn16LqI0z4jRpXeK51rrrP40uBvELQzpqBQKszTDBULP6nEB7pAH9yKpfoU6oR+n0zHNoyen7JXAqlSW5OPdC+HbkiALQ9H8qAgrF6Ej49kkCt9FU/NWSgZJkG/EayK6HPfL2Lxgs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1767384821; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=mSXXj28aI93YT6eSHdym3ln05TVR8chTRJIg1bakFME=; b=PdnSgYGujZ0xG/c3yXIhRIeslCOV4HYQgVzH5Gl5dJRd4ODMBluMGu7aARkS2MSWrnBA1SRLdxuppMGZy0up1l9tlXfrPXqJv6oQK4ZbK35USg+G3NB2eD9G7L0Vec7EuvEkAU2RiU4xdyaUoqryWht39VI3gXQCxmmF/8WCq/Q= 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=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1767384821351959.9246106808578; Fri, 2 Jan 2026 12:13:41 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vblVt-0003zO-Bv; Fri, 02 Jan 2026 15:12:46 -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 1vblVg-0003sc-3b for qemu-devel@nongnu.org; Fri, 02 Jan 2026 15:12:32 -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 1vblVY-0002TA-EE for qemu-devel@nongnu.org; Fri, 02 Jan 2026 15:12:27 -0500 Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6029W2sl3961084 for ; Fri, 2 Jan 2026 20:12:23 GMT Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4bd77v49j3-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 02 Jan 2026 20:12:23 +0000 (GMT) Received: by mail-pg1-f197.google.com with SMTP id 41be03b00d2f7-b5edecdf94eso20679060a12.2 for ; Fri, 02 Jan 2026 12:12:22 -0800 (PST) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2b140c42e7esm1794621eec.22.2026.01.02.12.12.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Jan 2026 12:12:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= mSXXj28aI93YT6eSHdym3ln05TVR8chTRJIg1bakFME=; b=LIM7oxgfzPq4YjRV 1/J/kd/wQQRdZPTQ+wa8e24SB7/4lvgB4St/kj63edIOMccFLz/eXCmw864V/YZK Bn5g0g9X0g9WpDfp9LIIBZyAC73BFFvGvlC3haRHirYzcFUXAAJYm2f0S3u5phrZ 5JZ2zqSFJPy1Xvec5UR2BfcznzbRvx/r7QASeQ4yrrfafaJibneGhmQkEh2nj+cn SjQ3QzH2zYlcdX7Ysgl0+fgzWMKrfhvf+qn6BsaLmnAkhs8Nmiu+U/8E5fDRny08 okt3ZMFxlTYLCRWJS33BE4L/cYyLMSNq7oFfhOHgWmh95BSQO1b0cfU9ChoPmhd3 pSfV5g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1767384742; x=1767989542; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mSXXj28aI93YT6eSHdym3ln05TVR8chTRJIg1bakFME=; b=htVXF7juwLxl+7nyn+kLjbhJqmE9+zGyDRcKS6lpH6NRnMCWibZavI2uiAGceoLfAA +bpvBTTCRKkZ00O/m5AGLo8VkDAWrcF+Y5/vJ4ouC035u2tQQL9TJrWwuveW1K8e4OWh 8wP97SZ99GujDTIu58uBRjGgm5BTgZU31CF2iC9jBNkI6/uzo/6B//T79an+hn38Jacm Oge5AZK7plZf5Tty5qhjhS+9gMFFUAOsYQPOpVGQuYg5+Fu0VyOxnwiEYi+Iy7Kdg1Ai ILTU6D219ty0WHSU3HP3WOefCQ9eUY9/rGHB6wAhquec7ZAA58UCVDLoh6ssv7jcrA6P 0bDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767384742; x=1767989542; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=mSXXj28aI93YT6eSHdym3ln05TVR8chTRJIg1bakFME=; b=CqLsIyma8Yw3/FkMnjxizMrXISJkafD0knJbEoxgGV2357IF5h/MpeixF9tvKZwxYj oJgia47iNtcOXYnosS2x0b6mHkvtKR7+Cnd1zXNX23qysVONUH1S5N/aNxfZmaZWQdWN 7jVte5MgNX4Bh9zZ2pxoiNx2/LsvAzfnggnbvacbAVYfLUH17cWMnkmpOWL8tNVN87Kv k3mHYrKUClQtDr6vS8DBdwSbV2CTvwC+0C+zIb6/Ok/ON9MsttIff50RErKp4pIQVbDg mrHo/SDJhRiHo67sgbNXKaGIk/ps5TR+YBVN/Wx+MSKcmHw16s8rKy42gqROkgbSadtf HNGw== X-Gm-Message-State: AOJu0YzNjbEHU4yF2P9bBd501Naxp9U0BR9bSsVi4NwAgtm7+aep6JFd 4VlfEoIIxkYYkWokk8kn51tWALkQozcA3MMgFWNvhIQnO3AbI2iAR4rWWkAKibNO73YEIbvGgBa 0htAseNpxh43zXHEsOhFhLzXFS79qR5P1dIgEm/7IGAsepnZbsYDHE023CKPHwx51+g== X-Gm-Gg: AY/fxX5PYtDFvgzFYUfqkFmTXE6L1DI3yCwvEZtA+SRxt2epq+omN6kW4CaVJ2g/PYY SySK23RDr1OE0ibXNNl3HGsytZYNnElvig1J9pPkB/Z5GXMwV1nthis5pCx7c54R3HXOQ6z9xB0 hHwodJoWylLAKJv4O09w90LNfUmnfbqMQ9vCTGh9VAAJgmK3itLQ3zg9caVVphk3Pap5us+iMQA IRnjw5T9S2VTz8vtuLj3VdoJ3wPanKrvHXf2TmGXd4Nn4dGOMVeFBiYagMTh/FLM7Jl6tItOqmE jmehn6fnbCjT6B/Z90pVkrTaaV82Zu0nn4zLM2Q36apfwMfawAeSHRxCbJAQtDqEdoDJva+k95p 0crMW5f/OMhxyDPLuPBY6Tx38dpUiZEjb7G7rwvWg/IQoOL/ycZcom/rOmg== X-Received: by 2002:a05:7300:d814:b0:2b0:48f7:837d with SMTP id 5a478bee46e88-2b05ebbbd85mr23743883eec.11.1767384741918; Fri, 02 Jan 2026 12:12:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IG3qfeFXW1sl+ASgE9POQONlpISYby4Hb3XXZlTAaQwFmx8TitoP8v4MafKZ4TW0lu76Ay4tQ== X-Received: by 2002:a05:7300:d814:b0:2b0:48f7:837d with SMTP id 5a478bee46e88-2b05ebbbd85mr23743869eec.11.1767384741367; Fri, 02 Jan 2026 12:12:21 -0800 (PST) From: Brian Cain To: qemu-devel@nongnu.org, richard.henderson@linaro.org Cc: brian.cain@oss.qualcomm.com, ltaylorsimpson@gmail.com Subject: [PULL 3/9] Hexagon (target/hexagon) Implicit writes to USR don't force packet commit Date: Fri, 2 Jan 2026 12:11:59 -0800 Message-Id: <20260102201205.2050363-4-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260102201205.2050363-1-brian.cain@oss.qualcomm.com> References: <20260102201205.2050363-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: AYD0L46imUFwQbEsVXZztkKTX8y7Jw0u X-Proofpoint-ORIG-GUID: AYD0L46imUFwQbEsVXZztkKTX8y7Jw0u X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTAyMDE4MSBTYWx0ZWRfX4UC/naV9ZDqg QgbfB0SU+UWY3KaC/kMTdKdeNb3RgGfnHE9UgFuD0ejsS8nrTtwq3iD60Qdum50f2ROFmAWZoYW LhnWQTVmTWCTcpa8sCzbOVWl11J9P8CiN1qZFwIFbxCd382/OwPjRV1P6NQdlrKezmvTq0giQG8 LWNKWgY1PZr//m7Aq8cOXneu56MrCam61+sHrnp27SWhvF5yFhfqsA3HyUAvkipJM5G4wHNQgzA Lr4aal3MkcW2iOuZXvk6YMh+3peKRE4KQe9mUnpquGmKW2jzUL3Fyj6bm8BeGCD6HNaIVgEhwRe eIF6Xwy727K2ggMNimpy/G3I1qGFk6Jv+ZBWCbQIsE2zdZX0no9HoV/Rpg86DXlUPTkUbidYxOY QtHef2SsVKm8+3zowLkVUafPjmYA9ECaGkSCHl7qW/xwJFeixOKHRTqN5RlLpy3d3b1FGk8yfwB aKPxcL3g6YCFrLRGdBA== X-Authority-Analysis: v=2.4 cv=ev7SD4pX c=1 sm=1 tr=0 ts=695826a7 cx=c_pps a=rz3CxIlbcmazkYymdCej/Q==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=vUbySO9Y5rIA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=pGLkceISAAAA:8 a=EUspDBNiAAAA:8 a=MMWtOl-RLpcBRfZQO0EA:9 a=QEXdDO2ut3YA:10 a=bFCP_H2QrGi7Okbo017w:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2026-01-02_03,2025-12-31_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 bulkscore=0 malwarescore=0 clxscore=1015 adultscore=0 phishscore=0 impostorscore=0 lowpriorityscore=0 spamscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2512120000 definitions=main-2601020181 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 (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=brian.cain@oss.qualcomm.com; helo=mx0b-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1767384822806158500 From: Taylor Simpson Implicit writes to USR are only to specific fields of USR to indicate side effects (e.g., saturation overflow, floating point status). In these cases, we don't force a packet commit. This will allow more packets to be short-circuited (avoid writing the results to temporaries). When there is a packet commit with an implicit write to USR, we initialize new_value_usr during gen_start_packet and write to USR in gen_reg_writes. Reviewed-by: Brian Cain Signed-off-by: Taylor Simpson Signed-off-by: Brian Cain --- target/hexagon/translate.h | 1 + target/hexagon/translate.c | 35 ++++++++++++++++++++++------------- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/target/hexagon/translate.h b/target/hexagon/translate.h index d251e2233f..a0102b6cbd 100644 --- a/target/hexagon/translate.h +++ b/target/hexagon/translate.h @@ -39,6 +39,7 @@ typedef struct DisasContext { int reg_log_idx; DECLARE_BITMAP(regs_written, TOTAL_PER_THREAD_REGS); DECLARE_BITMAP(predicated_regs, TOTAL_PER_THREAD_REGS); + bool implicit_usr_write; int preg_log[PRED_WRITES_MAX]; int preg_log_idx; DECLARE_BITMAP(pregs_written, NUM_PREGS); diff --git a/target/hexagon/translate.c b/target/hexagon/translate.c index 8fce219c0d..f3240953b5 100644 --- a/target/hexagon/translate.c +++ b/target/hexagon/translate.c @@ -272,12 +272,7 @@ static void mark_implicit_reg_write(DisasContext *ctx,= int attrib, int rnum) { 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; + bool is_predicated =3D GET_ATTRIB(opcode, A_CONDEXEC); =20 /* LC0/LC1 is conditionally written by endloop instructions */ if ((rnum =3D=3D HEX_REG_LC0 || rnum =3D=3D HEX_REG_LC1) && @@ -291,6 +286,14 @@ static void mark_implicit_reg_write(DisasContext *ctx,= int attrib, int rnum) } } =20 +static void mark_implicit_usr_write(DisasContext *ctx, int attrib) +{ + uint16_t opcode =3D ctx->insn->opcode; + if (GET_ATTRIB(opcode, attrib)) { + ctx->implicit_usr_write =3D true; + } +} + static void mark_implicit_reg_writes(DisasContext *ctx) { mark_implicit_reg_write(ctx, A_IMPLICIT_WRITES_FP, HEX_REG_FP); @@ -300,8 +303,9 @@ static void mark_implicit_reg_writes(DisasContext *ctx) 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); + + mark_implicit_usr_write(ctx, A_IMPLICIT_WRITES_USR); + mark_implicit_usr_write(ctx, A_FPOP); } =20 static void mark_implicit_pred_write(DisasContext *ctx, int attrib, int pn= um) @@ -351,11 +355,6 @@ static bool need_commit(DisasContext *ctx) } } =20 - /* Floating point instructions are hard-coded to use new_value */ - if (check_for_attrib(pkt, A_FPOP)) { - return true; - } - if (ctx->read_after_write || ctx->has_hvx_overlap) { return true; } @@ -467,6 +466,12 @@ static void gen_start_packet(DisasContext *ctx) } } =20 + /* Preload usr to new_value_usr */ + if (ctx->need_commit && ctx->implicit_usr_write && + !test_bit(HEX_REG_USR, ctx->regs_written)) { + tcg_gen_mov_tl(hex_new_value_usr, hex_gpr[HEX_REG_USR]); + } + /* * Preload the predicated pred registers into ctx->new_pred_value[pred= _num] * Only endloop instructions conditionally write to pred registers @@ -587,6 +592,10 @@ static void gen_reg_writes(DisasContext *ctx) ctx->is_tight_loop =3D false; } } + + if (ctx->implicit_usr_write && !test_bit(HEX_REG_USR, ctx->regs_writte= n)) { + tcg_gen_mov_tl(hex_gpr[HEX_REG_USR], hex_new_value_usr); + } } =20 static void gen_pred_writes(DisasContext *ctx) --=20 2.34.1