Module: sip-router
Branch: master
Commit: a22f9ee5231623236574d7728905940e72fdb7b9
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=a22f9ee…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Thu Oct 1 00:56:49 2009 +0200
compiler_opts: __builtin_prefetch supported from gcc 3.1
---
compiler_opt.h | 24 ++++++++++++++++++------
1 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/compiler_opt.h b/compiler_opt.h
index 95301a4..7fe2c21 100644
--- a/compiler_opt.h
+++ b/compiler_opt.h
@@ -44,25 +44,37 @@
#ifndef __compiler_opt_h
#define __compiler_opt_h
+/* likely/unlikely */
#if __GNUC__ >= 3
+
#define likely(expr) __builtin_expect(!!(expr), 1)
#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__ */
#warning "No compiler optimizations supported try gcc 4.x"
#define likely(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_w(addr)
#define prefetch_loc_r(addr, loc)
#define prefetch_loc_w(addr, loc)
-#endif /* __GNUC__ */
+
+#endif /* __GNUC__ > 3 || ( __GNUC__ == 3 && __GNUC_MINOR__ >= 1 ) */
#endif