Ask the hardware to prefetch the data at the given address into the L1 cache.
| 26 | |
| 27 | // Ask the hardware to prefetch the data at the given address into the L1 cache. |
| 28 | inline 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 |
no outgoing calls
no test coverage detected