]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c/26366 (__builtin_expect needs better documentation)
authorSandra Loosemore <sandra@codesourcery.com>
Sun, 11 Nov 2018 18:39:10 +0000 (13:39 -0500)
committerSandra Loosemore <sandra@gcc.gnu.org>
Sun, 11 Nov 2018 18:39:10 +0000 (13:39 -0500)
2018-11-11  Sandra Loosemore  <sandra@codesourcery.com>

PR c/26366

gcc/
* doc/extend.texi (Other Builtins): Document probability associated
with __builtin_expect.

From-SVN: r266017

gcc/ChangeLog
gcc/doc/extend.texi

index 67a6b80c0a44dbd9bece80827c318aa746adbc36..4a8293fa47c8f292d13d0078648eb127e79d655f 100644 (file)
@@ -1,3 +1,9 @@
+2018-11-11  Sandra Loosemore  <sandra@codesourcery.com>
+
+       PR c/26366
+       * doc/extend.texi (Other Builtins): Document probability associated
+       with __builtin_expect.
+
 2018-11-11  Uros Bizjak  <ubizjak@gmail.com>
 
        PR target/87928
index 5ce506907d7de80dfc179e2370d8aaffdc9d9d1b..022d0e0c121e3bb732a63fce5c8f886c9e84ecab 100644 (file)
@@ -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