include: add likely and unlikely for branch prediction

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
This commit is contained in:
yinshengkai 2023-02-23 16:05:19 +08:00 committed by Xiang Xiao
parent 29a7d267fb
commit ecdaeddfcd

View File

@ -154,6 +154,11 @@
# define farcall_function __attribute__((long_call))
# endif
/* Branch prediction */
# define likely(x) __builtin_expect((x), 1)
# define unlikely(x) __builtin_expect((x), 0)
/* Code locate */
# define locate_code(n) __attribute__((section(n)))
@ -471,6 +476,8 @@
*/
# define noreturn_function
# define likely(x) (x)
# define unlikely(x) (x)
# define locate_code(n)
# define aligned_data(n)
# define locate_data(n)
@ -621,6 +628,8 @@
*/
# define noreturn_function
# define likely(x) (x)
# define unlikely(x) (x)
# define aligned_data(n)
# define locate_code(n)
# define locate_data(n)
@ -728,6 +737,8 @@
# define weak_const_function
# define noreturn_function
# define farcall_function
# define likely(x) (x)
# define unlikely(x) (x)
# define locate_code(n)
# define aligned_data(n)
# define locate_data(n)
@ -815,6 +826,8 @@
# define restrict
# define noreturn_function
# define farcall_function
# define likely(x) (x)
# define unlikely(x) (x)
# define aligned_data(n)
# define locate_code(n)
# define locate_data(n)
@ -877,6 +890,8 @@
# define restrict
# define noreturn_function
# define farcall_function
# define likely(x) (x)
# define unlikely(x) (x)
# define aligned_data(n)
# define locate_code(n)
# define locate_data(n)