mirror of
https://github.com/apache/nuttx.git
synced 2026-06-01 16:59:28 +08:00
include: add likely and unlikely for branch prediction
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
This commit is contained in:
@@ -154,6 +154,11 @@
|
|||||||
# define farcall_function __attribute__((long_call))
|
# define farcall_function __attribute__((long_call))
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
/* Branch prediction */
|
||||||
|
|
||||||
|
# define likely(x) __builtin_expect((x), 1)
|
||||||
|
# define unlikely(x) __builtin_expect((x), 0)
|
||||||
|
|
||||||
/* Code locate */
|
/* Code locate */
|
||||||
|
|
||||||
# define locate_code(n) __attribute__((section(n)))
|
# define locate_code(n) __attribute__((section(n)))
|
||||||
@@ -471,6 +476,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
# define noreturn_function
|
# define noreturn_function
|
||||||
|
# define likely(x) (x)
|
||||||
|
# define unlikely(x) (x)
|
||||||
# define locate_code(n)
|
# define locate_code(n)
|
||||||
# define aligned_data(n)
|
# define aligned_data(n)
|
||||||
# define locate_data(n)
|
# define locate_data(n)
|
||||||
@@ -621,6 +628,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
# define noreturn_function
|
# define noreturn_function
|
||||||
|
# define likely(x) (x)
|
||||||
|
# define unlikely(x) (x)
|
||||||
# define aligned_data(n)
|
# define aligned_data(n)
|
||||||
# define locate_code(n)
|
# define locate_code(n)
|
||||||
# define locate_data(n)
|
# define locate_data(n)
|
||||||
@@ -728,6 +737,8 @@
|
|||||||
# define weak_const_function
|
# define weak_const_function
|
||||||
# define noreturn_function
|
# define noreturn_function
|
||||||
# define farcall_function
|
# define farcall_function
|
||||||
|
# define likely(x) (x)
|
||||||
|
# define unlikely(x) (x)
|
||||||
# define locate_code(n)
|
# define locate_code(n)
|
||||||
# define aligned_data(n)
|
# define aligned_data(n)
|
||||||
# define locate_data(n)
|
# define locate_data(n)
|
||||||
@@ -815,6 +826,8 @@
|
|||||||
# define restrict
|
# define restrict
|
||||||
# define noreturn_function
|
# define noreturn_function
|
||||||
# define farcall_function
|
# define farcall_function
|
||||||
|
# define likely(x) (x)
|
||||||
|
# define unlikely(x) (x)
|
||||||
# define aligned_data(n)
|
# define aligned_data(n)
|
||||||
# define locate_code(n)
|
# define locate_code(n)
|
||||||
# define locate_data(n)
|
# define locate_data(n)
|
||||||
@@ -877,6 +890,8 @@
|
|||||||
# define restrict
|
# define restrict
|
||||||
# define noreturn_function
|
# define noreturn_function
|
||||||
# define farcall_function
|
# define farcall_function
|
||||||
|
# define likely(x) (x)
|
||||||
|
# define unlikely(x) (x)
|
||||||
# define aligned_data(n)
|
# define aligned_data(n)
|
||||||
# define locate_code(n)
|
# define locate_code(n)
|
||||||
# define locate_data(n)
|
# define locate_data(n)
|
||||||
|
|||||||
Reference in New Issue
Block a user