aboutsummaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorTobias Burnus <burnus@net-b.de>2014-03-08 23:13:26 +0100
committerTobias Burnus <burnus@gcc.gnu.org>2014-03-08 23:13:26 +0100
commit433d6b398610cadfd7ee1e73165b72b3a6c5009d (patch)
tree10fe31ee5216308d32afd19e85f37d8b50a71391 /libgfortran
parent21d89690699adb7f9737b1bf17d076e21967dd72 (diff)
downloadgcc-433d6b398610cadfd7ee1e73165b72b3a6c5009d.zip
gcc-433d6b398610cadfd7ee1e73165b72b3a6c5009d.tar.gz
gcc-433d6b398610cadfd7ee1e73165b72b3a6c5009d.tar.bz2
libgfortran.h (unlikely, likely): Add usage comment.
2014-03-08 Tobias Burnus <burnus@net-b.de> * libgfortran.h (unlikely, likely): Add usage comment. From-SVN: r208434
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog4
-rw-r--r--libgfortran/libgfortran.h10
2 files changed, 14 insertions, 0 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 4005df0..c82daa2 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,7 @@
+2014-03-08 Tobias Burnus <burnus@net-b.de>
+
+ * libgfortran.h (unlikely, likely): Add usage comment.
+
2014-03-08 Dominique d'Humieres <dominiq@lps.ens.fr>
PR libgfortran/60128
diff --git a/libgfortran/libgfortran.h b/libgfortran/libgfortran.h
index d7e15ad..0d6f432 100644
--- a/libgfortran/libgfortran.h
+++ b/libgfortran/libgfortran.h
@@ -97,6 +97,16 @@ typedef off_t gfc_offset;
#define NULL (void *) 0
#endif
+
+/* The following macros can be used to annotate conditions which are likely or
+ unlikely to be true. Avoid using them when a condition is only slightly
+ more likely/less unlikely than average to avoid the performance penalties of
+ branch misprediction. In addition, as __builtin_expect overrides the compiler
+ heuristic, do not use in conditions where one of the branches ends with a
+ call to a function with __attribute__((noreturn)): the compiler internal
+ heuristic will mark this branch as much less likely as unlikely() would
+ do. */
+
#ifndef __GNUC__
#define __attribute__(x)
#define likely(x) (x)