MCPcopy Create free account
hub / github.com/ElementsProject/elements / RequestPrefetch

Function RequestPrefetch

src/crc32c/src/crc32c_prefetch.h:28–42  ·  view source on GitHub ↗

Ask the hardware to prefetch the data at the given address into the L1 cache.

Source from the content-addressed store, hash-verified

26
27// Ask the hardware to prefetch the data at the given address into the L1 cache.
28inline void RequestPrefetch(const uint8_t* address) {
29#if HAVE_BUILTIN_PREFETCH
30 // Clang and GCC implement the __builtin_prefetch non-standard extension,
31 // which maps to the best instruction on the target architecture.
32 __builtin_prefetch(reinterpret_cast<const char*>(address), 0 /* Read only. */,
33 0 /* No temporal locality. */);
34#elif HAVE_MM_PREFETCH
35 // Visual Studio doesn't implement __builtin_prefetch, but exposes the
36 // PREFETCHNTA instruction via the _mm_prefetch intrinsic.
37 _mm_prefetch(reinterpret_cast<const char*>(address), _MM_HINT_NTA);
38#else
39 // No prefetch support. Silence compiler warnings.
40 (void)address;
41#endif // HAVE_BUILTIN_PREFETCH
42}
43
44} // namespace crc32c
45

Callers 2

ExtendSse42Function · 0.85
ExtendPortableFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected