From 0de3ca79be9e5111019982280f606fc084ab846a Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Fri, 13 Jun 2003 21:13:51 +0000 Subject: [PATCH] Added prefetch functions. --- lib/prefetch.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 lib/prefetch.h diff --git a/lib/prefetch.h b/lib/prefetch.h new file mode 100644 index 00000000..5c675d17 --- /dev/null +++ b/lib/prefetch.h @@ -0,0 +1,32 @@ +/* + * Sherlock Library -- Prefetch + * + * (c) 1997--2003 Martin Mares + * + * This software may be freely distributed and used according to the terms + * of the GNU Lesser General Public License. + */ + +#ifndef _SHERLOCK_PREFETCH_H +#define _SHERLOCK_PREFETCH_H + +#if defined(__athlon) || defined(__i686) + +static inline void prefetch(void *addr) +{ + asm volatile ("prefetcht0 %0" : : "m" (*(byte*)addr)); +} + +#else + +#if !defined(__k6) +#warning "Don't know how to prefetch on your CPU. Please fix lib/prefetch.h." +#endif + +static inline void prefetch(void *addr UNUSED) +{ +} + +#endif + +#endif -- 2.39.2