Commit ab483570 authored by Andi Kleen's avatar Andi Kleen Committed by Thomas Gleixner

x86 & generic: change to __builtin_prefetch()

gcc 3.2+ supports __builtin_prefetch, so it's possible to use it on all
architectures. Change the generic fallback in linux/prefetch.h to use it
instead of noping it out. gcc should do the right thing when the
architecture doesn't support prefetching

Undefine the x86-64 inline assembler version and use the fallback.
Signed-off-by: default avatarAndi Kleen <ak@suse.de>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 124d395f
...@@ -390,12 +390,6 @@ static inline void sync_core(void) ...@@ -390,12 +390,6 @@ static inline void sync_core(void)
asm volatile("cpuid" : "=a" (tmp) : "0" (1) : "ebx","ecx","edx","memory"); asm volatile("cpuid" : "=a" (tmp) : "0" (1) : "ebx","ecx","edx","memory");
} }
#define ARCH_HAS_PREFETCH
static inline void prefetch(void *x)
{
asm volatile("prefetcht0 (%0)" :: "r" (x));
}
#define ARCH_HAS_PREFETCHW 1 #define ARCH_HAS_PREFETCHW 1
static inline void prefetchw(void *x) static inline void prefetchw(void *x)
{ {
......
...@@ -34,17 +34,12 @@ ...@@ -34,17 +34,12 @@
*/ */
/*
* These cannot be do{}while(0) macros. See the mental gymnastics in
* the loop macro.
*/
#ifndef ARCH_HAS_PREFETCH #ifndef ARCH_HAS_PREFETCH
static inline void prefetch(const void *x) {;} #define prefetch(x) __builtin_prefetch(x)
#endif #endif
#ifndef ARCH_HAS_PREFETCHW #ifndef ARCH_HAS_PREFETCHW
static inline void prefetchw(const void *x) {;} #define prefetchw(x) __builtin_prefetch(x,1)
#endif #endif
#ifndef ARCH_HAS_SPINLOCK_PREFETCH #ifndef ARCH_HAS_SPINLOCK_PREFETCH
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment