From nobody Sat Nov 15 03:13:55 2025 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1756074547; cv=none; d=zohomail.com; s=zohoarc; b=nXMhthSutsw++llchAIWH3UB6lo15/vYhD2tMidYTsiejynhlfeuGa0O4b+5WV3WzuZJrhssEDYcjAni/df5wXrwK3LgVY5zyRedgAcjCryUeA7gUuOgBCL3yWNikHZ0xmVoZoSwEnxa3V9rM1OTeMjHwny0kMs9S+1XNN7uJw0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1756074547; h=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=mNGvEOc3hjFKrNjkZThH9ubiJryO/GrmqZf5jARL5gs=; b=gnHLYlCmv7YBEdhhSGrEVWXGURSmd8YldEcQClQVzWo8C3ceQg3+U3joFzxr5wrDGSC1DZ1sEdyFZBiqdkFTRNpU5bH3ngBgNyudRCHgZaBlwjrxMHhytNq0Ole9KVhHVsHBsdSguQMaFItjBcfLtznAJZlQ++3oCMnbAoRmUu8= 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 1756074547775913.7983226496249; Sun, 24 Aug 2025 15:29:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uqJBr-00062e-3l; Sun, 24 Aug 2025 18:27:55 -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 1uqJBl-000623-SD for qemu-devel@nongnu.org; Sun, 24 Aug 2025 18:27:50 -0400 Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uqJBi-00069a-Uv for qemu-devel@nongnu.org; Sun, 24 Aug 2025 18:27:49 -0400 Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-55f4345cfd3so491598e87.1 for ; Sun, 24 Aug 2025 15:27:46 -0700 (PDT) Received: from gmail.com (213-67-3-247-no600.tbcn.telia.com. [213.67.3.247]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-55f35c11e88sm1265853e87.39.2025.08.24.15.27.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Aug 2025 15:27:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1756074464; x=1756679264; 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=mNGvEOc3hjFKrNjkZThH9ubiJryO/GrmqZf5jARL5gs=; b=gg6NGmJU+UN0W6QUH7pKbjsj7l3iNaPEi8NMli6TdOvZJ6S1fn3k/AaM4zRDudh38S LyKFcDule/a27uaN2lgdW1H++prbm96NT83wp4T2v6VfZZzNJIk2UoLzAxVWbbBpLbA+ 4zk62HlPKpCqyMgskdKDMrhlWakKaT7rkeCko9Joc5nVzalFBTk8LDEqcKwAcIFDL0Qg 98uMU6RRkXOnuQy4j0JJBx+JPYlPifni+gmWY6G86HdQVKIl4Dv696RcOU9MFKPgRePv j/pN96aCfJXtpWUrPiYH8/Ds/RlfRGlvimUFaOKYBTnBbO7lSp46+s/+OtcaH4AIWwy8 ILuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756074464; x=1756679264; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mNGvEOc3hjFKrNjkZThH9ubiJryO/GrmqZf5jARL5gs=; b=N/2p6JPaGwo/THTh+6pz9alPTTWFD4XDA3zQeuel1+RT/dp8jxTDm9DeMlsbzn4AdY 1eiQJnMg8Jz0fOciE6I21vJLDpTYaKS3oVg4lk5bGQ0L0fC2QzAfIElQIWaDsOIWfsSS Q64Gy9ZNE/NVi3+mrZTfb7NoHZHIWoIVtqd08t5mMbN/V2gRd9rv/hqNjTIerAnQNsk/ S+7q+nRYEO/rBmwrvyjLEp1f9mXX5pEdO1/CqIi0xB3s9RRdNy9EKx2bWibHKqc9Ay6h xgo7zhaPFRtpd/5ShE9CsC/JsLqJNCH7JTz6Z4QcBVqRJ8Id8PVvDcgxzi2auX4/l+my biiQ== X-Gm-Message-State: AOJu0YxCvd8u9D7HKW7n6+3Z+MXe9q/oPId8CgzwYLjK17q3aBv/4Pcu ji9dy8ukRkbOr0E523CJ9BCYoaSPOuxu/HLN2syIFTV59wsjSNFh1RzLHOWx7S1S X-Gm-Gg: ASbGncukFVqYBu9R9HiaXsXCpqc7zodoUEMnjx6/nJlnJoe1qu7vmqDLnhRqC7CiI7o tNnc5mMkcif6hqM8HWwosvJV0+ZETJvJ2gSjmkURVpZE6R+bAXsTo8awpzFIz49ATXcGkJlL0Od u07g4tJ0LoZyatMUBREFZU32gkBj+j1YNaE8D4Cybq3LLmCnSfIG+/tmHnBaCenohsm2HAUpmnm LDJxz7pR0uG1fkpYJQEEriygD1yZYB0heVUGI9BwbrZThn5DmT4wZv2dtD4nUnoSgoYb9j/c19A I+7MLqq1MivAjnty+OJH0CpzNixvCwhfQtYxTpGewbw+ITJoFYYd69j1dRqZg1cT2WPlTUQXF0O 0Ed5R1vCaDmpUVLA708+Tfe1c98R9oUhCt+RA3bTQjHbVW4q8gZdxgZGIlj+3QVrPIsrF3w== X-Google-Smtp-Source: AGHT+IEKq69Zam6FqcavCIJ0PoS0rlX7KjSq4g0nJt6TCVzwBolyUacd6EeRRWx2Bt/wRexv3yQhYw== X-Received: by 2002:a05:6512:2522:b0:55b:814a:a7fa with SMTP id 2adb3069b0e04-55e0da1a7e9mr3465047e87.8.1756074463534; Sun, 24 Aug 2025 15:27:43 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org, "Edgar E. Iglesias" Cc: richard.henderson@linaro.org, edgar.iglesias@amd.com Subject: [PATCH v1 1/4] target/microblaze: Remove unused arg from check_divz() Date: Mon, 25 Aug 2025 00:27:31 +0200 Message-ID: <20250824222734.4151956-2-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250824222734.4151956-1-edgar.iglesias@gmail.com> References: <20250824222734.4151956-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=2a00:1450:4864:20::12b; envelope-from=edgar.iglesias@gmail.com; helo=mail-lf1-x12b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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 @gmail.com) X-ZM-MESSAGEID: 1756074550337124100 Content-Type: text/plain; charset="utf-8" From: "Edgar E. Iglesias" Remove unused arg from check_divz(). No functional change. Signed-off-by: Edgar E. Iglesias Reviewed-by: Richard Henderson --- target/microblaze/op_helper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/target/microblaze/op_helper.c b/target/microblaze/op_helper.c index b8365b3b1d..470526ee92 100644 --- a/target/microblaze/op_helper.c +++ b/target/microblaze/op_helper.c @@ -69,7 +69,7 @@ void helper_raise_exception(CPUMBState *env, uint32_t ind= ex) cpu_loop_exit(cs); } =20 -static bool check_divz(CPUMBState *env, uint32_t a, uint32_t b, uintptr_t = ra) +static bool check_divz(CPUMBState *env, uint32_t b, uintptr_t ra) { if (unlikely(b =3D=3D 0)) { env->msr |=3D MSR_DZ; @@ -89,7 +89,7 @@ static bool check_divz(CPUMBState *env, uint32_t a, uint3= 2_t b, uintptr_t ra) =20 uint32_t helper_divs(CPUMBState *env, uint32_t a, uint32_t b) { - if (!check_divz(env, a, b, GETPC())) { + if (!check_divz(env, b, GETPC())) { return 0; } return (int32_t)a / (int32_t)b; @@ -97,7 +97,7 @@ uint32_t helper_divs(CPUMBState *env, uint32_t a, uint32_= t b) =20 uint32_t helper_divu(CPUMBState *env, uint32_t a, uint32_t b) { - if (!check_divz(env, a, b, GETPC())) { + if (!check_divz(env, b, GETPC())) { return 0; } return a / b; --=20 2.43.0 From nobody Sat Nov 15 03:13:55 2025 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1756074549; cv=none; d=zohomail.com; s=zohoarc; b=fWZEV2LqVMc+ptL1mBcItHSsHixXUYRUKB5rKKy3b2Hhlzb68QXXYnC6Vy0GUB7JOtFFYkSr0W6MMczmOpnEgiJWw0zMk2cNkMXl6jvQ7ioCr0Z+w9ZqHeGff3mPlII/LprzMozrXZWZyY1EoQtet6NHta+ptuJrGEoXi1y5Lcw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1756074549; h=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=sW4KE+q/biI/RulLgySIkhUyzp2bDHwahwhJi5mZvSs=; b=guIkctgEKjVZRQMjqGiRmVU1ewnjmtbvQF76W+j0bjFobTeyNdhPgVKqyavrLjsflcbIQFhbYI+5JR/meGklPDitJKXFzRDrC7QJ0p+9w5D4t4kUOTMOV8O29T5JvEEpP2+fSa7Uyy74fh3dyzEd/v6VVstdDUFkGQ9VGThxJh0= 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 175607454966727.7065761087664; Sun, 24 Aug 2025 15:29:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uqJBs-000631-De; Sun, 24 Aug 2025 18:27:56 -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 1uqJBn-00062K-FI for qemu-devel@nongnu.org; Sun, 24 Aug 2025 18:27:51 -0400 Received: from mail-lj1-x231.google.com ([2a00:1450:4864:20::231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uqJBl-0006A4-As for qemu-devel@nongnu.org; Sun, 24 Aug 2025 18:27:51 -0400 Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-33663b68b06so6485941fa.1 for ; Sun, 24 Aug 2025 15:27:48 -0700 (PDT) Received: from gmail.com (213-67-3-247-no600.tbcn.telia.com. [213.67.3.247]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-3365e5a5b84sm13300821fa.36.2025.08.24.15.27.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Aug 2025 15:27:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1756074466; x=1756679266; 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=sW4KE+q/biI/RulLgySIkhUyzp2bDHwahwhJi5mZvSs=; b=mWLD4h51/g/PDlsnkj3MLBDZSPsCOj1BG+LXOSpcMSRpMSLn6Y+9YGLleGtoCo0pJ1 aS4zYmkKaxmwdTtpO4TvkRE9EbsIbTGY40K0Q5OQnzy5GBRGXBDKR+sPMv8QLzM1YZvX LZzS0PV2cUEglkKCx9mS0jnGvBp2QvQbQZ0gYgbZ/zeDO79tPWh9DCPJQd1AnuQSQJ4A KintEr7tbI4eVY5UxfK+rQEjJLo5auua4Yndjq6VOSV0T0jiQjKD1sK5StkUQRtmWEKy 4utUCEY/0eMgeMavGxicRD5CTOxHVFQcKPriafIH4H3MoeEkKOCM6+X46tZoj7KBaPJB 6Spg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756074466; x=1756679266; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sW4KE+q/biI/RulLgySIkhUyzp2bDHwahwhJi5mZvSs=; b=lDsD/ssNqKS2Z18msQPRxg0Qxdza5V1TX1gBxwHRt62MjzhSRb03uIbsdo0lrSX4O3 Oo4bEMs4n5N8pMZ6nvyczSdIG+Dcvg4W7Cnc8jGbSpHCOlXbCGuxhGezM3JLcZ3gLC/+ TayVkVuISKu6f1HrUpGr1R3pxJ6wXsrRbyd6nOfhnJIDXB3Wyva5f/uBN/3BfGlXWXSA Ba6WCqIcFLT273EMybR9rrxeKmmhAxctjfj0cT039fy8neNYZNpxPE0zit2MgSm8OIy0 RxHUlCTeYOxDeZJeAh6egKly7qwnBjqUTsu4fj3BZ1WBdkFmWltnzZ211Dl54aLqh9KI kxAw== X-Gm-Message-State: AOJu0Yz2g+VNnR1bCFnui2u2DFBaRYPBP3chMyYdGHtEAJD9XNYvMkfC OmFWTEcj49XucQOqACgyOML6QaDHj7UdzFoFDAo3fQLElof1634pnWy6NYciiY6N X-Gm-Gg: ASbGncvMzrQDcDok18fiwMBwCzbp8zjmaxLLYzhJF1TIaPP2gEXSMaPN9KGlmWRYSqn DScoBuppdtCYx6jOKpItZ4ux2V+V84US9BNA8kLRz7AkwYQhV711BOin7fNlWnHLhyDDae5mbob pQh8OvEYiJFmcq/3gAFUKpNJ84UN18L+ojxxpdi6L3JkvImXly6lGIHjX9WsrjIHuAZwxUMzljj hxUwcLJ9wrBP8YjlBaJIxgy11D0kZUxzmhvUdz3waG21b8T+OP/Z5emtJ2bNbcBxu/NMCNUeuQK 5p2XBs2FW+91/v6B9p8A6uHaEbS4EUiIV5yNXX/xVsOOiNxvZgAdvNKLD6huDKGQAsBDYcXCsn9 jhyFXGV8X7qgW4cVKktz6fiAFNFM1rO2KfvjqafUCM0UvjxqxY8/yZ0lqfIoh3D8onkzXHg== X-Google-Smtp-Source: AGHT+IH+gFc0twzGOAt6AiD5yYfRo1QdsB/dB9UpE6Nm7MIS7bxy9hfG+o+lszs0ol5XReAPbJ47MQ== X-Received: by 2002:a2e:a008:0:b0:32b:9220:8020 with SMTP id 38308e7fff4ca-33650f5098cmr15427721fa.34.1756074465609; Sun, 24 Aug 2025 15:27:45 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org, "Edgar E. Iglesias" Cc: richard.henderson@linaro.org, edgar.iglesias@amd.com Subject: [PATCH v1 2/4] target/microblaze: div: Rename and reorder function args Date: Mon, 25 Aug 2025 00:27:32 +0200 Message-ID: <20250824222734.4151956-3-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250824222734.4151956-1-edgar.iglesias@gmail.com> References: <20250824222734.4151956-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=2a00:1450:4864:20::231; envelope-from=edgar.iglesias@gmail.com; helo=mail-lj1-x231.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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 @gmail.com) X-ZM-MESSAGEID: 1756074552575124100 Content-Type: text/plain; charset="utf-8" From: "Edgar E. Iglesias" Rename and reorder function args to better match with spec and pseudo code. No functional change. Signed-off-by: Edgar E. Iglesias --- target/microblaze/op_helper.c | 18 +++++++++--------- target/microblaze/translate.c | 12 ++---------- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/target/microblaze/op_helper.c b/target/microblaze/op_helper.c index 470526ee92..092977b3e1 100644 --- a/target/microblaze/op_helper.c +++ b/target/microblaze/op_helper.c @@ -69,9 +69,9 @@ void helper_raise_exception(CPUMBState *env, uint32_t ind= ex) cpu_loop_exit(cs); } =20 -static bool check_divz(CPUMBState *env, uint32_t b, uintptr_t ra) +static bool check_divz(CPUMBState *env, uint32_t divisor, uintptr_t pc) { - if (unlikely(b =3D=3D 0)) { + if (unlikely(divisor =3D=3D 0)) { env->msr |=3D MSR_DZ; =20 if ((env->msr & MSR_EE) && @@ -80,27 +80,27 @@ static bool check_divz(CPUMBState *env, uint32_t b, uin= tptr_t ra) =20 env->esr =3D ESR_EC_DIVZERO; cs->exception_index =3D EXCP_HW_EXCP; - cpu_loop_exit_restore(cs, ra); + cpu_loop_exit_restore(cs, pc); } return false; } return true; } =20 -uint32_t helper_divs(CPUMBState *env, uint32_t a, uint32_t b) +uint32_t helper_divs(CPUMBState *env, uint32_t ra, uint32_t rb) { - if (!check_divz(env, b, GETPC())) { + if (!check_divz(env, ra, GETPC())) { return 0; } - return (int32_t)a / (int32_t)b; + return (int32_t)rb / (int32_t)ra; } =20 -uint32_t helper_divu(CPUMBState *env, uint32_t a, uint32_t b) +uint32_t helper_divu(CPUMBState *env, uint32_t ra, uint32_t rb) { - if (!check_divz(env, b, GETPC())) { + if (!check_divz(env, ra, GETPC())) { return 0; } - return a / b; + return rb / ra; } =20 /* raise FPU exception. */ diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c index 5098a1db4d..2f5fd5c271 100644 --- a/target/microblaze/translate.c +++ b/target/microblaze/translate.c @@ -450,16 +450,8 @@ DO_TYPEA0_CFG(flt, use_fpu >=3D 2, true, gen_flt) DO_TYPEA0_CFG(fint, use_fpu >=3D 2, true, gen_fint) DO_TYPEA0_CFG(fsqrt, use_fpu >=3D 2, true, gen_fsqrt) =20 -/* Does not use ENV_WRAPPER3, because arguments are swapped as well. */ -static void gen_idiv(TCGv_i32 out, TCGv_i32 ina, TCGv_i32 inb) -{ - gen_helper_divs(out, tcg_env, inb, ina); -} - -static void gen_idivu(TCGv_i32 out, TCGv_i32 ina, TCGv_i32 inb) -{ - gen_helper_divu(out, tcg_env, inb, ina); -} +ENV_WRAPPER3(gen_idiv, gen_helper_divs) +ENV_WRAPPER3(gen_idivu, gen_helper_divu) =20 DO_TYPEA_CFG(idiv, use_div, true, gen_idiv) DO_TYPEA_CFG(idivu, use_div, true, gen_idivu) --=20 2.43.0 From nobody Sat Nov 15 03:13:55 2025 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1756074550; cv=none; d=zohomail.com; s=zohoarc; b=fQoquNXgZz5FNHtDcr4GPWwUjYM1Xu8oe9nPADAzTPfLptIe7SZlOuBGib3EoxqjkphCIDRy7eB3pvjKhF+5m9HYhN+0z3KXP7XIAaw96rWZfburBgwzVPyroM2FPD4F0MhIvjBssJOfOkl3W+60RuJ4wLFBztSJnyKvYFCS7ZE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1756074550; h=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=db2OzonHRQ050MpGz+D2/nC+yn3PdcqKa98jxUWnj1E=; b=liXyPaef4jH6cD1nCpeUNGVX/990czDqFGhZxIo/HOkuwdjL8vV0wiU/UzYSwWaYoAiIsu7Mt8OOJnHd9wYXfwAxFZfXF7nU6RsIWnKiI8/5nUH8dGFeRrUf9P4NGyKztz++mQl3hZtVC+C+5CcinP007k5dmKuA72/KGhmigas= 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 1756074550480138.34132829245527; Sun, 24 Aug 2025 15:29:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uqJBt-00063Z-CK; Sun, 24 Aug 2025 18:27:57 -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 1uqJBp-00062f-Ar for qemu-devel@nongnu.org; Sun, 24 Aug 2025 18:27:54 -0400 Received: from mail-lj1-x22e.google.com ([2a00:1450:4864:20::22e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uqJBm-0006AP-Jy for qemu-devel@nongnu.org; Sun, 24 Aug 2025 18:27:53 -0400 Received: by mail-lj1-x22e.google.com with SMTP id 38308e7fff4ca-3364e945ce7so22806351fa.1 for ; Sun, 24 Aug 2025 15:27:50 -0700 (PDT) Received: from gmail.com (213-67-3-247-no600.tbcn.telia.com. [213.67.3.247]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-3365e2650cdsm12141601fa.33.2025.08.24.15.27.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Aug 2025 15:27:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1756074467; x=1756679267; 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=db2OzonHRQ050MpGz+D2/nC+yn3PdcqKa98jxUWnj1E=; b=MEJy9GBMiAe9kGAGbI+oUtr1Xf8dOlZELFATUObqqkFoXsi8DR6g2vUyA5FxlDtKvA Cx0MjL4ajAmfARSstixxacIK0NnZrKpMYjdN8JDfBiw+8CoRfV5UgYWa/Hp5XJ89gRhN 6ZKql5CzkECWsITMx/2yDIo+i21NpFmSqQDlRgI3+q5zNqVUvHRNwGgu993ks3FyuW9k Daf2G2oiA4iy9QZc571dK9F+4iRSXGhi9u2sFC2NPasYH/DOkxIHa0iOPpdwJ4FMYCMC sZEQZZc1nSMp0wfFBF0LaFwLAa3GI6GChMj3iLyfli6O0QitnfJ4gtlbK6MeoGGwXlt5 T4pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756074467; x=1756679267; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=db2OzonHRQ050MpGz+D2/nC+yn3PdcqKa98jxUWnj1E=; b=ZFgnJEq6/qzgRfxhLEDYb8E/Yeo/wgdCmDUAdLh/xLHdwNbR19mchyTBgCY98BYcjk c1RztOBJ4Sdj90XbBrEcyw77Z0WCW+I07tZ6NSiismg1KkLV0BqqfaUteOk3g+fbgR2b g/AjqtzNGyi6IjOAQAeeHByTTclR4COMs9k0I5N7VffmIuLVITuBlO18k1scsmT1PIWE XCjQVMfx9sDsczcpHB2ZiouKWhbjYtqIqZ78Ceh3h+qOOg6VxOPRAUsDQ1OS3XmCFZSE f6TmBLXXkbs11T6TmlQOigeIoS/Uku6znMcsHAqfiMsV3tcXkc/7polkk6F5Olqw2ERC qtcQ== X-Gm-Message-State: AOJu0Yy8Vfw58x2A42L3n6KCLb7bfUYDSpE+eOHTl+8aWRQfWghO0rEF jC2WH5VaVXuQ0xSicx1GXx1ZRrnE2KWNZ2ZlUcVf2InhiaBXAypPOXr0TUtakmf/ X-Gm-Gg: ASbGncsvqsfxnbDpux420IWMkLWidu2pWLJEb8M/Z1T0M9yB0m4iTQOq9aZTomsYpzF I+CZJqmBjCWPenTlCmTu1wFqAjhC6WgVF1z4qFBLqJjFpx2D+2/n0v60xuh8Qr7veO+kSSPf4yJ 2XK46/9JIg8Ung7QEZPCq5GUX+RuUA3In85nQbKG2TPrfbHHwaHWoHd5Mp9THwK9/TKKQ6oKe0H CMtgOk4X+SEJQA5vvBFh96Br7/9Hqjm1AkGhcOI91xqpSOkphZWzcmI9qDf+YMS7P9P3F+/cL1X B96DXrWM1MjE1l4DGNcqrdjIhiwHt9guPxPP7VaLIYKKWhPEJc3S+xyNSIBxxMQ1Kwdv68Txyax uLXLIcOHyR9/Ar6gaghHFnkCBURzuDB7AQbu6Q6KsMSVjs24OMakOporM7H8QZVzRE34Gkg== X-Google-Smtp-Source: AGHT+IEI6kzCCSBOqK3QRoMmkRx5ueh5FqPh/AziJ4xlK7bEbR3HUus4Dh9JjNnJhDSfX/rWU6A/Nw== X-Received: by 2002:a05:651c:2124:b0:327:fec0:b85d with SMTP id 38308e7fff4ca-33650f977d1mr25975711fa.21.1756074467111; Sun, 24 Aug 2025 15:27:47 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org, "Edgar E. Iglesias" Cc: richard.henderson@linaro.org, edgar.iglesias@amd.com Subject: [PATCH v1 3/4] target/microblaze: Break out raise_divzero() Date: Mon, 25 Aug 2025 00:27:33 +0200 Message-ID: <20250824222734.4151956-4-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250824222734.4151956-1-edgar.iglesias@gmail.com> References: <20250824222734.4151956-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=2a00:1450:4864:20::22e; envelope-from=edgar.iglesias@gmail.com; helo=mail-lj1-x22e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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 @gmail.com) X-ZM-MESSAGEID: 1756074551586116600 Content-Type: text/plain; charset="utf-8" From: "Edgar E. Iglesias" Break out raise_divzero(). No functional change. Signed-off-by: Edgar E. Iglesias Reviewed-by: Richard Henderson --- target/microblaze/op_helper.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/target/microblaze/op_helper.c b/target/microblaze/op_helper.c index 092977b3e1..d9444aee29 100644 --- a/target/microblaze/op_helper.c +++ b/target/microblaze/op_helper.c @@ -69,27 +69,24 @@ void helper_raise_exception(CPUMBState *env, uint32_t i= ndex) cpu_loop_exit(cs); } =20 -static bool check_divz(CPUMBState *env, uint32_t divisor, uintptr_t pc) +/* Raises ESR_EC_DIVZERO if exceptions are enabled. */ +static void raise_divzero(CPUMBState *env, uint32_t esr, uintptr_t pc) { - if (unlikely(divisor =3D=3D 0)) { - env->msr |=3D MSR_DZ; - - if ((env->msr & MSR_EE) && - env_archcpu(env)->cfg.div_zero_exception) { - CPUState *cs =3D env_cpu(env); - - env->esr =3D ESR_EC_DIVZERO; - cs->exception_index =3D EXCP_HW_EXCP; - cpu_loop_exit_restore(cs, pc); - } - return false; + env->msr |=3D MSR_DZ; + + if ((env->msr & MSR_EE) && env_archcpu(env)->cfg.div_zero_exception) { + CPUState *cs =3D env_cpu(env); + + env->esr =3D esr; + cs->exception_index =3D EXCP_HW_EXCP; + cpu_loop_exit_restore(cs, pc); } - return true; } =20 uint32_t helper_divs(CPUMBState *env, uint32_t ra, uint32_t rb) { - if (!check_divz(env, ra, GETPC())) { + if (!ra) { + raise_divzero(env, ESR_EC_DIVZERO, GETPC()); return 0; } return (int32_t)rb / (int32_t)ra; @@ -97,7 +94,8 @@ uint32_t helper_divs(CPUMBState *env, uint32_t ra, uint32= _t rb) =20 uint32_t helper_divu(CPUMBState *env, uint32_t ra, uint32_t rb) { - if (!check_divz(env, ra, GETPC())) { + if (!ra) { + raise_divzero(env, ESR_EC_DIVZERO, GETPC()); return 0; } return rb / ra; --=20 2.43.0 From nobody Sat Nov 15 03:13:55 2025 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1756074545; cv=none; d=zohomail.com; s=zohoarc; b=gjEcVWS/lVf2S+HWFP6n75nNx/fz57J587kX/UtQoQLvCLgg6ZGJyd5D14X+b54qpCb1Z5a+ki2z/PDUMvY8GczacKCqXYZ2p+rN8ESx7m8910f/rtaSnixvHPbgOLgzPFApSJGvDAg0HOuKW3xeiuye0Ab+4NENkkz59BxsP88= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1756074545; h=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=1WoT7s3OlYD8+G3GhjBVb2VoQPl7Qm4aiBJ1d2EKqNM=; b=UvUe6i6cX4qs4AZHJqlA5D5XkP67arsGMKj+EwsTIy+CUTl0k2oZmnFk3wJYMRvsZGSXbPhg6o1AySSrxs7TwNEN3+ffwazjSz2nVbJ2s1E+/x6naUw4sUViqFORRyGVal3HjZ33lYdJzV2fHPwkAW84TrS3Xa8+yElIQCxg3Zw= 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 1756074545477182.0283541011163; Sun, 24 Aug 2025 15:29:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uqJBz-00064Z-4O; Sun, 24 Aug 2025 18:28:03 -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 1uqJBr-000633-Au for qemu-devel@nongnu.org; Sun, 24 Aug 2025 18:27:56 -0400 Received: from mail-lj1-x233.google.com ([2a00:1450:4864:20::233]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uqJBn-0006An-RN for qemu-devel@nongnu.org; Sun, 24 Aug 2025 18:27:54 -0400 Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-3366307712dso11476911fa.1 for ; Sun, 24 Aug 2025 15:27:51 -0700 (PDT) Received: from gmail.com (213-67-3-247-no600.tbcn.telia.com. [213.67.3.247]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-3366fdea6eesm5708371fa.44.2025.08.24.15.27.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Aug 2025 15:27:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1756074469; x=1756679269; 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=1WoT7s3OlYD8+G3GhjBVb2VoQPl7Qm4aiBJ1d2EKqNM=; b=ODuq/QdG/7DfZY5miQgB41NPmCdK0KSMlwVFLOsAejE1sbkmS9BjwLJa74vgrBDKh4 fHqP6tJVv5Pp+Ecwq//NlNqq+flGeQs7mKuol0EHx/dbgGzYNYEAgGUK7qsiepMURMxX c/x/OZPvaO2faG1FI2PfkgW4VvD1qqVmHx+NZtr403Qwd7OHFbZXeN9VAcqymD7pgAg3 +FH9W1XmZXnnEihlQ5sTYk2p+e9ArU+kZwa2nYpqYZ4i+DakP/zH4ZH9095HvGeRhEMJ xBFUguTjbdhJKkodrz+o2baDi7lIbLVnoUR2sE9boB4IRU6GmQ0nXkqRaDqm7xslYSMk k9bA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756074469; x=1756679269; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1WoT7s3OlYD8+G3GhjBVb2VoQPl7Qm4aiBJ1d2EKqNM=; b=rsuz20frukficQevTdXC/d3nII3JanmOyO7hxUcnbWaRooIE1GeFWaBgl/3BHOFqYp IyRiCnpVr9s4F2yOTkw7neSaObyUq6BFuXZvMgbAgeRejbD8wg2Y6PuYfhWpepLBejwt oK7i9Pbj9O9aQBWdrSaqJEIj/VVoNLlanx356J+H47lhmQ9+zw/D7yWdrVblaltZF5A8 /TD4x28XQASQyKuBGSv/67h7Zsun2H1kowzkxJULLo0S7mZb4lyG/Y/gm2ymfI7fmelU zNpzkScxAvMG1oWtFIZHplIeyDj0+oKeEUn0DRAdI8GlMzX/UCWo4J9gYmcejipDaZ1/ Rvjw== X-Gm-Message-State: AOJu0YxGYgdomQy7B8RCSMQErOMQE1ynfAY2tmj8EgWvXdxrvpOsgwvG cMZw/N7i0u5NHXacaw1BAA1FKXqAOe7B3rf/g9fEqsWaKZy1hven38Ar4H5TnZRG X-Gm-Gg: ASbGnctz2mSMkwBO+vZZI4qK0BYDmw8JFOD+30E9WoGGGua9AqMsximn6LZgPqHo3bb Rwv+nXf2Jo8ENsUcRtepxKMGtemfH+cpGsJiRTeL8MtWo709iV60yrLWjKPdsvvhBftx+O4S/0g DKMLWF6qGd01aLw+aULse1s0GPDEn1+t3TgqOX+gN5kGTWjYeRPYEoc+RWnZUcKTmsJ6gPJGE3i pq1N7KshpWBEUzOtXD5H/ViB96kuzY1HgDd1M51YBSAaEu4a4Gy+6Hm80b84MRcSW4IL5pD5Ptw wD7ShM+Fv5+gd748dE5ySj6mBCVH5QJuD/poN4QEW2HQNStMygxg3mLsMFegjpYb+6dyJrUvJtO oqro9boyYaKR8wvH3x1GXzMogD8QxQjHgcZLGu+iBb3VftYgRRvCSTrYtrj2bZ+YKaeSsKK9V9w +MJz2K X-Google-Smtp-Source: AGHT+IEV6a27k4eBXr5cm7mt613vzPVqNeVdyod6wtYoCah+hTH/0/d9cfUQJE73253IspCViKmMUA== X-Received: by 2002:a05:651c:20cb:10b0:32c:be6e:6719 with SMTP id 38308e7fff4ca-3354a18bd45mr27613181fa.1.1756074468669; Sun, 24 Aug 2025 15:27:48 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org, "Edgar E. Iglesias" Cc: richard.henderson@linaro.org, edgar.iglesias@amd.com Subject: [PATCH v1 4/4] target/microblaze: Handle signed division overflows Date: Mon, 25 Aug 2025 00:27:34 +0200 Message-ID: <20250824222734.4151956-5-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250824222734.4151956-1-edgar.iglesias@gmail.com> References: <20250824222734.4151956-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=2a00:1450:4864:20::233; envelope-from=edgar.iglesias@gmail.com; helo=mail-lj1-x233.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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 @gmail.com) X-ZM-MESSAGEID: 1756074548625124100 Content-Type: text/plain; charset="utf-8" From: "Edgar E. Iglesias" Handle signed division overflows as specified in UG984: https://docs.amd.com/r/en-US/ug984-vivado-microblaze-ref/idiv Signed-off-by: Edgar E. Iglesias Reviewed-by: Richard Henderson --- target/microblaze/cpu.h | 1 + target/microblaze/op_helper.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/target/microblaze/cpu.h b/target/microblaze/cpu.h index 3ce28b302f..7dd86653f0 100644 --- a/target/microblaze/cpu.h +++ b/target/microblaze/cpu.h @@ -87,6 +87,7 @@ typedef struct CPUArchState CPUMBState; #define ESR_ESS_FSL_OFFSET 5 =20 #define ESR_ESS_MASK (0x7f << 5) +#define ESR_ESS_DEC_OF (1 << 20) /* DEC: 0=3DDBZ, 1=3DOF */ =20 #define ESR_EC_FSL 0 #define ESR_EC_UNALIGNED_DATA 1 diff --git a/target/microblaze/op_helper.c b/target/microblaze/op_helper.c index d9444aee29..e5f13824d8 100644 --- a/target/microblaze/op_helper.c +++ b/target/microblaze/op_helper.c @@ -89,6 +89,21 @@ uint32_t helper_divs(CPUMBState *env, uint32_t ra, uint3= 2_t rb) raise_divzero(env, ESR_EC_DIVZERO, GETPC()); return 0; } + + /* + * Check for division overflows. + * + * Spec: https://docs.amd.com/r/en-US/ug984-vivado-microblaze-ref/idiv + * UG984, Chapter 5 MicroBlaze Instruction Set Architecture, idiv. + * + * If the U bit is clear, the value of rA is -1, and the value of rB is + * -2147483648 (divide overflow), the DZO bit in MSR will be set and + * the value in rD will be -2147483648, unless an exception is generat= ed. + */ + if ((int32_t)ra =3D=3D -1 && (int32_t)rb =3D=3D INT32_MIN) { + raise_divzero(env, ESR_EC_DIVZERO | ESR_ESS_DEC_OF, GETPC()); + return INT32_MIN; + } return (int32_t)rb / (int32_t)ra; } =20 --=20 2.43.0