git: 16a49ddfe767 - stable/13 - qdivrem: Predict division by zero as false.

From: Hans Petter Selasky <hselasky_at_FreeBSD.org>
Date: Wed, 12 Oct 2022 15:54:16 UTC
The branch stable/13 has been updated by hselasky:

URL: https://cgit.FreeBSD.org/src/commit/?id=16a49ddfe7672f3b075fceddad6242e57694233b

commit 16a49ddfe7672f3b075fceddad6242e57694233b
Author:     Hans Petter Selasky <hselasky@FreeBSD.org>
AuthorDate: 2022-10-04 10:28:25 +0000
Commit:     Hans Petter Selasky <hselasky@FreeBSD.org>
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;