prefetchw()

Paul Campbell taniwha at gmail.com
Sat Jun 26 20:44:28 PDT 2021


On Sunday, 27 June 2021 3:31:18 PM NZST Paul Campbell wrote:
> i noticed today that __builtin_prefetch() emits nothing (at least in my gcc)
> 
> i wonder if it makes sense to do this for riscv linux?
> 
> static inline void prefetchw( volatile void  *addr)
> {
>         asm volatile("lb x0, 0(%0)" : : "r" (addr));
> }

I should add that gcc  __builtin_prefetch()  promises not to fault while the 
kernel prefetchw(), from my quick look through the code doesn't seem to depend 
on that (in fact loops get unrolled in places to make sure) 

	Paul





More information about the linux-riscv mailing list