Skip to contentSkip to conversation

Athlon/3DNow write prefetch?

DISCUSSION Andreas Franck 2 participants 2 messages Aug 23, 2001

lore
Share & tools
lore
#0 lore raw

Hello people,

in looking at the prefetch code from include/asm-i386/processor.h on 2.4.9-ac9, I have noticed that prefetchw seems not to be implemented right:

The Athlon/3DNow prefetchw() implementation uses the prefetch' assembler instruction, which is in fact a read prefetch, while it should use the prefetchw' instruction, which is for write prefetch.

Any comments on this?

Greetings,
Andreas

(Here the excerpt from the code...)

[...]

/* Prefetch instructions for Pentium III and AMD Athlon */ #ifdef CONFIG_MPENTIUMIII

#define ARCH_HAS_PREFETCH
extern inline void prefetch(const void *x)

{
        __asm__ __volatile__ ("prefetchnta (%0)" : : "r"(x));
}

#elif CONFIG_X86_USE_3DNOW

#define ARCH_HAS_PREFETCH
#define ARCH_HAS_PREFETCHW
#define ARCH_HAS_SPINLOCK_PREFETCH

extern inline void prefetch(const void *x)

{
         __asm__ __volatile__ ("prefetch (%0)" : : "r"(x));
}

extern inline void prefetchw(const void *x)

{
         __asm__ __volatile__ ("prefetch (%0)" : : "r"(x));
                                ^^^^^^^^ <- Shouldn't this be prefetchw ???
} 

#define spin_lock_prefetch(x) prefetchw(x)

#endif

#1 lore raw
Quoted 3 lines

The Athlon/3DNow prefetchw() implementation uses the prefetch' assembler instruction, which is in fact a read prefetch, while it should use the prefetchw' instruction, which is for write prefetch.

Yep