This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[doc, committed] document probability associated with __builtin_expect
- From: Sandra Loosemore <sandra at codesourcery dot com>
- To: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Sun, 11 Nov 2018 11:41:10 -0700
- Subject: [doc, committed] document probability associated with __builtin_expect
I've checked in this patch to fix PR26366, another small but ancient
documentation bug.
-Sandra
2018-11-11 Sandra Loosemore <sandra@codesourcery.com>
PR c/26366
gcc/
* doc/extend.texi (Other Builtins): Document probability associated
with __builtin_expect.
Index: gcc/doc/extend.texi
===================================================================
--- gcc/doc/extend.texi (revision 266016)
+++ gcc/doc/extend.texi (working copy)
@@ -12121,6 +12121,12 @@ if (__builtin_expect (ptr != NULL, 1))
@noindent
when testing pointer or floating-point values.
+
+For the purposes of branch prediction optimizations, the probability that
+a @code{__builtin_expect} expression is true is controlled by GCC's
+@code{builtin-expect-probability} parameter, which defaults to 90%.
+You can also use @code{__builtin_expect_with_probability} to explicitly
+assign a probability value to individual expressions.
@end deftypefn
@deftypefn {Built-in Function} long __builtin_expect_with_probability