Skip to content

Commit

Permalink
x86 & generic: change to __builtin_prefetch()
Browse files Browse the repository at this point in the history
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: Andi Kleen <ak@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
  • Loading branch information
Andi Kleen authored and Thomas Gleixner committed Oct 19, 2007
1 parent 124d395 commit ab48357
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
6 changes: 0 additions & 6 deletions include/asm-x86/processor_64.h
Original file line number Diff line number Diff line change
Expand Up @@ -390,12 +390,6 @@ static inline void sync_core(void)
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
static inline void prefetchw(void *x)
{
Expand Down
9 changes: 2 additions & 7 deletions include/linux/prefetch.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,12 @@
*/

/*
* These cannot be do{}while(0) macros. See the mental gymnastics in
* the loop macro.
*/

#ifndef ARCH_HAS_PREFETCH
static inline void prefetch(const void *x) {;}
#define prefetch(x) __builtin_prefetch(x)
#endif

#ifndef ARCH_HAS_PREFETCHW
static inline void prefetchw(const void *x) {;}
#define prefetchw(x) __builtin_prefetch(x,1)
#endif

#ifndef ARCH_HAS_SPINLOCK_PREFETCH
Expand Down

0 comments on commit ab48357

Please sign in to comment.