From nobody Sat Nov 15 05:21:32 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