[libc-commits] [llvm] [libc] [libc] Adding a version of memset with software prefetching (PR #70857)

Guillaume Chatelet via libc-commits libc-commits at lists.llvm.org
Tue Nov 7 04:17:42 PST 2023


================
@@ -48,6 +48,13 @@ using generic_v256 = uint8_t __attribute__((__vector_size__(32)));
 using generic_v512 = uint8_t __attribute__((__vector_size__(64)));
 } // namespace LIBC_NAMESPACE
 
+namespace LIBC_NAMESPACE::sw_prefetch {
+// Size of a cacheline for software prefetching
+static constexpr size_t kCachelineSize = 64;
+// prefetch for write
+static inline void PrefetchW(CPtr dst) { __builtin_prefetch(dst, 1, 3); }
----------------
gchatelet wrote:

Let's move this in `src/string/memory_utils/utils.h` with the name `prefetch_for_write`.

We currently have the `prefetch_to_local_cache` in `src/string/memory_utils/x86_64/inline_memcpy.h` but I would like to move them all to the same place.

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


More information about the libc-commits mailing list