git: 1024bb26337b - main - qdivrem: Predict division by zero as false.
Date: Tue, 04 Oct 2022 11:53:02 UTC
The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=1024bb26337bdc6679af477977247e9155d502bc commit 1024bb26337bdc6679af477977247e9155d502bc 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-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;