]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: compiler: restore the likely() wrapper for gcc 5.x
authorWilly Tarreau <w@1wt.eu>
Sun, 8 Oct 2017 20:26:03 +0000 (22:26 +0200)
committerWilly Tarreau <w@1wt.eu>
Sun, 8 Oct 2017 20:32:05 +0000 (22:32 +0200)
After some tests, gcc 5.x produces better code with likely()
than without, contrary to gcc 4.x where it was better to disable
it. Let's re-enable it for 5 and above.

include/common/compiler.h

index 001b89301d27334f41937075db32fd43492872a9..ee7744c9fd459505dcf56406e70530a89fd3ba87 100644 (file)
@@ -89,8 +89,8 @@
 #define __builtin_expect(x,y) (x)
 #define likely(x) (x)
 #define unlikely(x) (x)
-#elif __GNUC__ < 4
-/* gcc 3.x does the best job at this */
+#elif __GNUC__ < 4 || __GNUC__ >= 5
+/* gcc 3.x and 5.x do the best job at this */
 #define likely(x) (__builtin_expect((x) != 0, 1))
 #define unlikely(x) (__builtin_expect((x) != 0, 0))
 #else