X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Fprefetch.h;h=8c97906d8630f85ca4435f146483edc16aae025a;hb=ccc6aa0a17952f8dacc0edd60de8e5aa11e2df60;hp=46d10ca328cf0f101867c9cf64fa0191b7431431;hpb=cad27e97e6370f96903d42aaf345c099af0a03bd;p=libucw.git diff --git a/lib/prefetch.h b/lib/prefetch.h index 46d10ca3..8c97906d 100644 --- a/lib/prefetch.h +++ b/lib/prefetch.h @@ -1,7 +1,7 @@ /* * UCW Library -- Prefetch * - * (c) 1997--2003 Martin Mares + * (c) 1997--2005 Martin Mares * * This software may be freely distributed and used according to the terms * of the GNU Lesser General Public License. @@ -10,23 +10,33 @@ #ifndef _UCW_PREFETCH_H #define _UCW_PREFETCH_H -#if defined(__athlon) || defined(__i686) +#if defined(__pentium4) +#define HAVE_PREFETCH static inline void prefetch(void *addr) { asm volatile ("prefetcht0 %0" : : "m" (*(byte*)addr)); } -#else +#elif defined(__k6) + /* K6 doesn't have prefetches */ + +#elif defined(__athlon) || defined(__i686) -#if !defined(__k6) +#define HAVE_PREFETCH +static inline void prefetch(void *addr) +{ + asm volatile ("prefetcht0 %0" : : "m" (*(byte*)addr)); +} + +#else #warning "Don't know how to prefetch on your CPU. Please fix lib/prefetch.h." #endif +#ifndef HAVE_PREFETCH static inline void prefetch(void *addr UNUSED) { } - #endif #endif