]> mj.ucw.cz Git - libucw.git/blob - lib/prefetch.h
When pre-sorting a regular file, use lib/arraysort.h on an array of items
[libucw.git] / lib / prefetch.h
1 /*
2  *      Sherlock Library -- Prefetch
3  *
4  *      (c) 1997--2003 Martin Mares <mj@ucw.cz>
5  *
6  *      This software may be freely distributed and used according to the terms
7  *      of the GNU Lesser General Public License.
8  */
9
10 #ifndef _SHERLOCK_PREFETCH_H
11 #define _SHERLOCK_PREFETCH_H
12
13 #if defined(__athlon) || defined(__i686)
14
15 static inline void prefetch(void *addr)
16 {
17   asm volatile ("prefetcht0 %0" : : "m" (*(byte*)addr));
18 }
19
20 #else
21
22 #if !defined(__k6)
23 #warning "Don't know how to prefetch on your CPU. Please fix lib/prefetch.h."
24 #endif
25
26 static inline void prefetch(void *addr UNUSED)
27 {
28 }
29
30 #endif
31
32 #endif