Skip to contentSkip to conversation

Move likely()/unlikely() to exec-all.h

PATCH In review Aurelien Jarno 2 participants 2 messages Sep 19, 2007 – Sep 20, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Move likely()/unlikely() to exec-all.h

Hi all,

The patch below moves likely()/unlikely() definitions to exec-all.h from target-alpha/cpu.h and target-ppc/cpu.h. This way they can be used on other targets.

Bye,
Aurelien

Index: exec-all.h
===================================================================
RCS file: /sources/qemu/qemu/exec-all.h,v
retrieving revision 1.61

exec-all.h +3 -0
diff -u -d -p -r1.61 exec-all.h
@@ -32,6 +32,9 @@
 #define __builtin_expect(x, n) (x)
 #endif
 
+#define likely(x) __builtin_expect(!!(x), 1)
+#define unlikely(x) __builtin_expect(!!(x), 0)
+
 #ifdef __i386__
 #define REGPARM(n) __attribute((regparm(n)))
 #else

Index: target-alpha/cpu.h
===================================================================
RCS file: /sources/qemu/qemu/target-alpha/cpu.h,v
retrieving revision 1.5

cpu.h +0 -4
diff -u -d -p -r1.5 cpu.h
@@ -32,10 +32,6 @@
 
 #include "softfloat.h"
 
-/* XXX: put this in a common place */
-#define likely(x)   __builtin_expect(!!(x), 1)
-#define unlikely(x)   __builtin_expect(!!(x), 0)
-
 #define TARGET_HAS_ICE 1
 
 #define ELF_MACHINE	EM_ALPHA

Index: target-ppc/cpu.h
===================================================================
RCS file: /sources/qemu/qemu/target-ppc/cpu.h,v
retrieving revision 1.54

cpu.h +0 -4
diff -u -d -p -r1.54 cpu.h
@@ -88,10 +88,6 @@ typedef uint32_t ppc_gpr_t;
 #define ICACHE_LINE_SIZE 32
 #define DCACHE_LINE_SIZE 32
 
-/* XXX: put this in a common place */
-#define likely(x)   __builtin_expect(!!(x), 1)
-#define unlikely(x) __builtin_expect(!!(x), 0)
-
 /*****************************************************************************/
 /* PVR definitions for most known PowerPC */
 enum {
Signature · 4 lines
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   [email protected]         | [email protected]
   `-    people.debian.org/~aurel32 | www.aurel32.net
#1 lore raw
Quoted 1 line · Aurelien Jarno

Hi all,

Hi,

Quoted 3 lines

The patch below moves likely()/unlikely() definitions to exec-all.h from target-alpha/cpu.h and target-ppc/cpu.h. This way they can be used on other targets.

Good idea, I will apply this.

Regards.

Signature · 2 lines
J. Mayer <[email protected]>
Never organized