compiler: Add PRAGMA and unroll_loop.

This commit added PRAGMA and unroll_loop to support compiler
loop-unrolling.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
This commit is contained in:
ouyangxiangzhen
2026-01-04 14:13:05 +08:00
committed by Xiang Xiao
parent fa6c8579dd
commit 2a1f24b817
+26
View File
@@ -175,6 +175,14 @@
# define offsetof(a, b) __builtin_offsetof(a, b)
# define return_address(x) __builtin_return_address(x)
# define PRAGMA(x) _Pragma(#x)
# if defined(__clang__)
# define unroll_loop(n) PRAGMA(clang loop unroll_count(n))
# else
# define unroll_loop(n) PRAGMA(GCC unroll n)
# endif
/* Attributes
*
* GCC supports weak symbols which can be used to reduce code size because
@@ -814,6 +822,9 @@
# define offsetof(a, b) ((size_t)(&(((a *)(0))->b)))
# define return_address(x) 0
# define PRAGMA(x)
# define unroll_loop(n)
# define no_builtin(n)
/* Warning about usage of deprecated features. */
@@ -979,6 +990,9 @@
# define offsetof(a, b) ((size_t)(&(((a *)(0))->b)))
# define return_address(x) 0
# define PRAGMA(x)
# define unroll_loop(n)
# define no_builtin(n)
/* Warning about usage of deprecated features. */
@@ -1073,6 +1087,9 @@
# define offsetof(a, b) ((size_t)(&(((a *)(0))->b)))
# define return_address(x) 0
# define PRAGMA(x)
# define unroll_loop(n)
# define no_builtin(n)
/* Warning about usage of deprecated features. */
@@ -1175,6 +1192,9 @@
# define offsetof(a, b) ((size_t)(&(((a *)(0))->b)))
# define return_address(x) 0
# define PRAGMA(x)
# define unroll_loop(n)
# define no_builtin(n)
/* Warning about usage of deprecated features. */
@@ -1276,6 +1296,9 @@
# define offsetof(a, b) ((size_t)(&(((a *)(0))->b)))
# define return_address(x) 0
# define PRAGMA(x)
# define unroll_loop(n)
# define no_builtin(n)
/* Warning about usage of deprecated features. */
@@ -1368,6 +1391,9 @@
# define offsetof(a, b) ((size_t)(&(((a *)(0))->b)))
# define return_address(x) 0
# define PRAGMA(x)
# define unroll_loop(n)
# define no_builtin(n)
/* Warning about usage of deprecated features. */