|
@@ -44,25 +44,37 @@
|
|
#ifndef __compiler_opt_h
|
|
#ifndef __compiler_opt_h
|
|
#define __compiler_opt_h
|
|
#define __compiler_opt_h
|
|
|
|
|
|
|
|
+/* likely/unlikely */
|
|
#if __GNUC__ >= 3
|
|
#if __GNUC__ >= 3
|
|
|
|
+
|
|
#define likely(expr) __builtin_expect(!!(expr), 1)
|
|
#define likely(expr) __builtin_expect(!!(expr), 1)
|
|
#define unlikely(expr) __builtin_expect(!!(expr), 0)
|
|
#define unlikely(expr) __builtin_expect(!!(expr), 0)
|
|
|
|
|
|
-#define prefetch(addr) __builtin_prefetch((addr))
|
|
|
|
-#define prefetch_w(addr) __builtin_prefetch((addr), 1)
|
|
|
|
-#define prefetch_loc_r(addr, loc) __builtin_prefetch((addr), 0, (loc))
|
|
|
|
-#define prefetch_loc_w(addr, loc) __builtin_prefetch((addr), 1, (loc))
|
|
|
|
-
|
|
|
|
#else /* __GNUC__ */
|
|
#else /* __GNUC__ */
|
|
|
|
|
|
#warning "No compiler optimizations supported try gcc 4.x"
|
|
#warning "No compiler optimizations supported try gcc 4.x"
|
|
#define likely(expr) (expr)
|
|
#define likely(expr) (expr)
|
|
#define unlikely(expr) (expr)
|
|
#define unlikely(expr) (expr)
|
|
|
|
|
|
|
|
+#endif /* __GNUC__ */
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+/* prefetch* */
|
|
|
|
+#if ( __GNUC__ > 3 ) || ( __GNUC__ == 3 && __GNUC_MINOR__ >= 1 )
|
|
|
|
+
|
|
|
|
+#define prefetch(addr) __builtin_prefetch((addr))
|
|
|
|
+#define prefetch_w(addr) __builtin_prefetch((addr), 1)
|
|
|
|
+#define prefetch_loc_r(addr, loc) __builtin_prefetch((addr), 0, (loc))
|
|
|
|
+#define prefetch_loc_w(addr, loc) __builtin_prefetch((addr), 1, (loc))
|
|
|
|
+
|
|
|
|
+#else
|
|
|
|
+
|
|
#define prefetch(addr)
|
|
#define prefetch(addr)
|
|
#define prefetch_w(addr)
|
|
#define prefetch_w(addr)
|
|
#define prefetch_loc_r(addr, loc)
|
|
#define prefetch_loc_r(addr, loc)
|
|
#define prefetch_loc_w(addr, loc)
|
|
#define prefetch_loc_w(addr, loc)
|
|
-#endif /* __GNUC__ */
|
|
|
|
|
|
+
|
|
|
|
+#endif /* __GNUC__ > 3 || ( __GNUC__ == 3 && __GNUC_MINOR__ >= 1 ) */
|
|
|
|
|
|
#endif
|
|
#endif
|