[libc-commits] [libc] [libc][x86] Use prefetch for write for memcpy (PR #90450)

Guillaume Chatelet via libc-commits libc-commits at lists.llvm.org
Mon Apr 29 07:30:37 PDT 2024


================
@@ -69,14 +69,21 @@ inline_memcpy_x86_avx_ge64(Ptr __restrict dst, CPtr __restrict src,
   return builtin::Memcpy<64>::loop_and_tail(dst, src, count);
 }
 
+[[maybe_unused]] LIBC_INLINE void inline_memcpy_prefetch(Ptr __restrict dst,
+                                                         CPtr __restrict src,
+                                                         size_t distance) {
+  prefetch_to_local_cache(src + distance);
+  prefetch_for_write(dst + distance);
----------------
gchatelet wrote:

The prefetching behavior is controlled by `LIBC_COPT_MEMCPY_X86_USE_SOFTWARE_PREFETCHING`, I don't want to split this further down into "prefetch for write" and "prefetch for read", we already have a lot of combinations to test.

https://github.com/llvm/llvm-project/pull/90450


More information about the libc-commits mailing list