From nobody Wed Oct 12 15:54:16 2022 X-Original-To: dev-commits-src-all@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 4Mncf04MBfz4fdVQ; Wed, 12 Oct 2022 15:54:16 +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 4Mncf01sCyz3GyD; Wed, 12 Oct 2022 15:54:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665590056; 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=T3U5q/yNNTOYKvXU1Ui463gyP2C/b5ZVq0btxPRknlw=; b=jva29fhtspXCXiRVOyIfvRHuw6t8INmCo9LnGcdHzfUYB9e+xMSJlx4YU6JYdyNK61SQcQ VMk4LoCYMfgfMCd9mEl5DxA/7BQRhHGjtvRlzL/L7n1PH0H564MzLpW9mznbqg6bVZiInQ POhvpdV+RNthX5XDL5MMfcviS5heShnlb3nRlQW79B2hyhawsCsIzQrF1OckfDnmPw05CA dxCcZz8R7xZA0+V3UnX4CciGzKWLaCAfIvxnEoUVoHQ8T6fSPxN4Euhf0D/OISgkl//SCg Usp4HsIp2AG7hQpL4gQM/HMPxm5gl6q2QbpyL4I0LSTjcH2TsES2q27OpQJoSw== 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 4Mncf00kclz1MB5; Wed, 12 Oct 2022 15:54:16 +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 29CFsG3J043834; Wed, 12 Oct 2022 15:54:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 29CFsGDn043832; Wed, 12 Oct 2022 15:54:16 GMT (envelope-from git) Date: Wed, 12 Oct 2022 15:54:16 GMT Message-Id: <202210121554.29CFsGDn043832@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 16a49ddfe767 - stable/13 - qdivrem: Predict division by zero as false. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 16a49ddfe7672f3b075fceddad6242e57694233b Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665590056; 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=T3U5q/yNNTOYKvXU1Ui463gyP2C/b5ZVq0btxPRknlw=; b=X7q87a/vRGIWC1KwyFF6OKHKCSL94sm6sV6x1MinsLBPBZ1aIxzh5AJvb3ekIMF8VXn4sg k+muN0j7EdKVeu94iC/P/qeDXPUd9Kt4LQib68dOtXYsacj7Xlt8JoH6Y7gHMpk884AlRt O2MAF8622fZ0Pyge+1e214oprm6j00d3PK4rQBSiK54vOAuGPDEiIyhJDTtP6KtTOKbL3c Nb6d29ow0Eq97uxKSBYb+63dbPD0S13Vi27WBBzW0wlTOVX7Hqpm98jXDJIxNLfwLcM6fD kbq+51WUgikBbxuvBnM42/mRiDdpUwvwSYUj08Deymbek6aPhy1kEB4PrStGWA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1665590056; a=rsa-sha256; cv=none; b=BwtrJZOiep0OQDJapTQubdKKV3ODZyhmsMODudDVwoqBfAbKJ7U15rTfVjxxoKREivmFUD CxZlxwyQSiLltabF55LWJHgEM14Lv8CGreTQlmcBpbjy8PGrf9/I+8uH7XdQtNrho/dNHN waMd68Wu3OApeuS4oppAV1STdkp3Yp7T/BmR7jIQlt00LBTVhaQA+mTzhOxEbO18jpcsEA mLIC+1MFQitQLO0Zj2o3nJdFUeqBvMLjG4MmVkP4lta1AWDJ5djdnBgC1oq8l825IGEaKD DAHj09z0sEDZbpxGMegA0g9s+Hg5w3MOKr3Aqd3B1ryhjy0W/DAy8D0j4fmlww== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=16a49ddfe7672f3b075fceddad6242e57694233b commit 16a49ddfe7672f3b075fceddad6242e57694233b Author: Hans Petter Selasky AuthorDate: 2022-10-04 10:28:25 +0000 Commit: Hans Petter Selasky CommitDate: 2022-10-12 15:53:21 +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. Sponsored by: NVIDIA Networking (cherry picked from commit 1024bb26337bdc6679af477977247e9155d502bc) --- 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;