Re: [PATCH] x86/cpu: Use prefetcht0 for prefetch() on 64-bit
From: Martin Leitner-Ankerl
Date: Wed Nov 04 2026 - 01:50:03 EST
> Thanks for the patch!
> Is there a reason to have the cast vs simply use "r" constraint and
> deref in the inline asm?
> asm("prefetcht0 (%0)" : : "r" (x));
> https://godbolt.org/z/xezh15oMe
I mostly did it to be consistent with the 32-bit prefetch() and prefetchw()
in the same file, but it also has a codegen benefit. With "m" the compiler
can put an offset or index in the prefetcht0 itself, while with "r" it needs
to compute the address into a register first:
https://godbolt.org/z/j311eYzsY
Thanks for the ack!
Martin