]> mj.ucw.cz Git - libucw.git/blob - lib/prefetch.h
IP parsing code moved to lib/conf.c, closes Bug #2375.
[libucw.git] / lib / prefetch.h
1 /*
2  *      UCW Library -- Prefetch
3  *
4  *      (c) 1997--2005 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 _UCW_PREFETCH_H
11 #define _UCW_PREFETCH_H
12
13 #if defined(__pentium4)
14
15 #define HAVE_PREFETCH
16 static inline void prefetch(void *addr)
17 {
18   asm volatile ("prefetcht0 %0" : : "m" (*(byte*)addr));
19 }
20
21 #elif defined(__k6)
22   /* K6 doesn't have prefetches */
23
24 #elif defined(__athlon) || defined(__i686)
25
26 #define HAVE_PREFETCH
27 static inline void prefetch(void *addr)
28 {
29   asm volatile ("prefetcht0 %0" : : "m" (*(byte*)addr));
30 }
31
32 #else
33 #warning "Don't know how to prefetch on your CPU. Please fix lib/prefetch.h."
34 #endif
35
36 #ifndef HAVE_PREFETCH
37 static inline void prefetch(void *addr UNUSED)
38 {
39 }
40 #endif
41
42 #endif