Added support for static branch hinting (XCC)
authorDavide Libenzi <dlibenzi@google.com>
Thu, 8 Oct 2015 18:39:56 +0000 (11:39 -0700)
committerBarret Rhoden <brho@cs.berkeley.edu>
Tue, 13 Oct 2015 19:28:35 +0000 (15:28 -0400)
Signed-off-by: Davide Libenzi <dlibenzi@google.com>
[Reinstall your kernel headers]
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
kern/include/ros/common.h
kern/include/ros/compiler.h [new file with mode: 0644]

index a09213c..6979967 100644 (file)
@@ -7,6 +7,7 @@
 #include <stdint.h>
 #include <sys/types.h>
 #include <stdbool.h>
+#include <ros/compiler.h>
 
 typedef uintptr_t physaddr_t;
 typedef long intreg_t;
diff --git a/kern/include/ros/compiler.h b/kern/include/ros/compiler.h
new file mode 100644 (file)
index 0000000..4f06112
--- /dev/null
@@ -0,0 +1,16 @@
+#ifndef ROS_KERN_COMPILER_H
+#define ROS_KERN_COMPILER_H
+
+#ifdef __GNUC__
+
+#define likely(x) __builtin_expect(!!(x), 1)
+#define unlikely(x) __builtin_expect(!!(x), 0)
+
+#else /* #ifdef __GNUC__ */
+
+#define likely(x) (x)
+#define unlikely(x) (x)
+
+#endif /* #ifdef __GNUC__ */
+
+#endif /* ROS_KERN_COMPILER_H */