Browse code

compiler_opts: __builtin_prefetch supported from gcc 3.1

Andrei Pelinescu-Onciul authored on 30/09/2009 22:56:49
Showing 1 changed files
... ...
@@ -44,25 +44,37 @@
44 44
 #ifndef __compiler_opt_h
45 45
 #define __compiler_opt_h
46 46
 
47
+/* likely/unlikely */
47 48
 #if __GNUC__ >= 3
49
+
48 50
 #define likely(expr)              __builtin_expect(!!(expr), 1)
49 51
 #define unlikely(expr)            __builtin_expect(!!(expr), 0)
50 52
 
51
-#define prefetch(addr)            __builtin_prefetch((addr))
52
-#define prefetch_w(addr)          __builtin_prefetch((addr), 1)
53
-#define prefetch_loc_r(addr, loc) __builtin_prefetch((addr), 0, (loc))
54
-#define prefetch_loc_w(addr, loc) __builtin_prefetch((addr), 1, (loc))
55
-
56 53
 #else /* __GNUC__ */
57 54
 
58 55
 #warning "No compiler optimizations supported try gcc 4.x"
59 56
 #define likely(expr) (expr)
60 57
 #define unlikely(expr) (expr)
61 58
 
59
+#endif /* __GNUC__ */
60
+
61
+
62
+
63
+/* prefetch* */
64
+#if ( __GNUC__ > 3 ) || ( __GNUC__ == 3 && __GNUC_MINOR__ >= 1 )
65
+
66
+#define prefetch(addr)            __builtin_prefetch((addr))
67
+#define prefetch_w(addr)          __builtin_prefetch((addr), 1)
68
+#define prefetch_loc_r(addr, loc) __builtin_prefetch((addr), 0, (loc))
69
+#define prefetch_loc_w(addr, loc) __builtin_prefetch((addr), 1, (loc))
70
+
71
+#else
72
+
62 73
 #define prefetch(addr)
63 74
 #define prefetch_w(addr)
64 75
 #define prefetch_loc_r(addr, loc)
65 76
 #define prefetch_loc_w(addr, loc)
66
-#endif /* __GNUC__ */
77
+
78
+#endif /* __GNUC__ > 3  || ( __GNUC__ == 3 && __GNUC_MINOR__ >= 1 ) */
67 79
 
68 80
 #endif