]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Come up with {,UN}LIKELY macros.
authorMartin Liska <mliska@suse.cz>
Thu, 3 Feb 2022 09:58:18 +0000 (10:58 +0100)
committerThomas Schwinge <thomas@codesourcery.com>
Fri, 23 Sep 2022 15:28:48 +0000 (17:28 +0200)
gcc/ChangeLog:

* system.h (LIKELY): Define.
(UNLIKELY): Likewise.

(cherry picked from commit 22d9c8802add09a93308319fc37dd3a0f1125393, partial)

gcc/ChangeLog.omp
gcc/system.h

index 4f80bcbd356a7aef83e2ad1bdb463dea83396f09..30c3abfc15bf8997ce05b8c459e7ac798c4f23f6 100644 (file)
@@ -1,3 +1,11 @@
+2022-09-23  Thomas Schwinge  <thomas@codesourcery.com>
+
+       Backport from master branch:
+       2022-05-09  Martin Liska  <mliska@suse.cz>
+
+       * system.h (LIKELY): Define.
+       (UNLIKELY): Likewise.
+
 2022-09-12  Tobias Burnus  <tobias@codesourcery.com>
 
        Backport from mainline:
index e10c34f70eca4ca8810c968bd6c856d803e56963..6b6868d0bbf5552afb93958f4f9eb3e699e6e4f8 100644 (file)
@@ -736,6 +736,9 @@ extern int vsnprintf (char *, size_t, const char *, va_list);
 #define __builtin_expect(a, b) (a)
 #endif
 
+#define LIKELY(x) (__builtin_expect ((x), 1))
+#define UNLIKELY(x) (__builtin_expect ((x), 0))
+
 /* Some of the headers included by <memory> can use "abort" within a
    namespace, e.g. "_VSTD::abort();", which fails after we use the
    preprocessor to redefine "abort" as "fancy_abort" below.  */