From nobody Tue Oct 04 11:53:02 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MhbgL4Dg1z4dgq2; Tue, 4 Oct 2022 11:53:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MhbgL3gtcz3Vm1; Tue, 4 Oct 2022 11:53:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664884382; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=RdwK3ISvT+ciheFg93RUERvbgNulpyJraSHfTT0y6Pg=; b=BgJ4S2oITDMU5evqpePTRcBE8bf6NkawJaPEyAdH7mkXktQqiB5ZcsyD4DGeRsIXTnP4Zh 0xKLghcNKc2gJccnmbnul2grMSwcUSwz9I4+h9hStmZrvjuzLnGDxOKK3sZrG/PrGUXGtB CVqJlU+w+RF8Js5fCjvuAScX5ZOAN66di37i9XXhsHdmMi8ixCCy/qfqDTmpkEgcd4VuRP n4ZbylUBf4FYyu14GtzWrmL5kiHBCkICmpgrOKslyvbFNTi8boNEMBK7Z5fbkBYi8QK8Yx vmvavBPhQ1CUG1psT4tlgLMOeH/H7Mf3HFdg6b1RPxaBnoaf045o9U4oLf5Sig== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4MhbgL2jwXzYRy; Tue, 4 Oct 2022 11:53:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 294Br21i011501; Tue, 4 Oct 2022 11:53:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 294Br2JP011500; Tue, 4 Oct 2022 11:53:02 GMT (envelope-from git) Date: Tue, 4 Oct 2022 11:53:02 GMT Message-Id: <202210041153.294Br2JP011500@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 1024bb26337b - main - qdivrem: Predict division by zero as false. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1024bb26337bdc6679af477977247e9155d502bc Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664884382; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=RdwK3ISvT+ciheFg93RUERvbgNulpyJraSHfTT0y6Pg=; b=SGSaCArn5BAleNJpwpUrdiv9+Oo1T8RSODbO9Kys/iw9ZxESG/j2C4e4Rc71JuJCSxstat 6+Zd+JX/agQyJ4SXFW117ZiKvoCHEVFkQg8gPyf8lSkwzoloicACqWs5a19L/SnMWv2mTB id1OZ1DSG99ouUWSSGLeB7o9a2XYBQW0SGI1A/w1w/t/yjKJS534Yc2Sk8ov3JhAgqaiFt 0S0s9OWYSXwacstsqqlrHQ0EJYP44K75UTOeqpSRq4ld973hLQi9k+/uXi33RJ26gZmmOg 2kFPccJwNGbcU3LIUAHfY75ZUtERftuazXxvRHyHDTP5XJUU0abUTGc9vwUzXg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1664884382; a=rsa-sha256; cv=none; b=ValVfCHnbFLzHeRDXiGXI7pXhgHkG9Waf/fqRSrcEe70w2iJATsWk2vgDSMO3+cKoRVDcm tswWOKUwiDteJPWu4rno3EX2hgFzuXVOjzWY+Bll3FOwBWjJywC2G4c4NDuG/gkD7jvVZj KkBUCOqDuBcPb9p3OTrK6uyX8lfUN3w4NAY1wpeXjkIPXpTrXqjKp8U7zWbywx/T4/j5nr exTlGHdTc6OUJT64H/hfRL5BAVXVPefAoe4liuvC+w7DmiGOLqh1RZVZ9ZnMbXLsuxcrY7 hR/fOHmEcSA1UwsiEEs1UQTNMp5JauXy96UYZG2Tpcgdcs4AX6reXqU++7sfLg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=1024bb26337bdc6679af477977247e9155d502bc commit 1024bb26337bdc6679af477977247e9155d502bc Author: Hans Petter Selasky AuthorDate: 2022-10-04 10:28:25 +0000 Commit: Hans Petter Selasky CommitDate: 2022-10-04 11:51:06 +0000 qdivrem: Predict division by zero as false. Division by zero triggers an arithmetic exception and should not be very common. Predict this. No functional change intended. MFC after: 1 week Sponsored by: NVIDIA Networking --- lib/libc/quad/qdivrem.c | 2 +- sys/libkern/qdivrem.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libc/quad/qdivrem.c b/lib/libc/quad/qdivrem.c index ea09e7f43f16..7dd7632d39ed 100644 --- a/lib/libc/quad/qdivrem.c +++ b/lib/libc/quad/qdivrem.c @@ -94,7 +94,7 @@ __qdivrem(u_quad_t uq, u_quad_t vq, u_quad_t *arq) /* * Take care of special cases: divide by zero, and u < v. */ - if (vq == 0) { + if (__predict_false(vq == 0)) { /* divide by zero. */ static volatile const unsigned int zero = 0; diff --git a/sys/libkern/qdivrem.c b/sys/libkern/qdivrem.c index 2429fe708d7b..3f2834166450 100644 --- a/sys/libkern/qdivrem.c +++ b/sys/libkern/qdivrem.c @@ -91,7 +91,7 @@ __qdivrem(u_quad_t uq, u_quad_t vq, u_quad_t *arq) /* * Take care of special cases: divide by zero, and u < v. */ - if (vq == 0) { + if (__predict_false(vq == 0)) { /* divide by zero. */ static volatile const unsigned int zero = 0;