Add prefetch to zippy decompess,

PiperOrigin-RevId: 489554313
This commit is contained in:
Ilya Tokar 2022-11-18 21:51:44 +00:00 committed by Victor Costan
parent 15e2a0e13d
commit 37f375ddeb
1 changed files with 8 additions and 0 deletions

View File

@ -69,6 +69,12 @@
#include <arm_acle.h>
#endif
#if defined(__GNUC__)
#define SNAPPY_PREFETCH(ptr) __builtin_prefetch(ptr, 0, 3)
#else
#define SNAPPY_PREFETCH(ptr) (void)(ptr)
#endif
#include <algorithm>
#include <array>
#include <cstddef>
@ -1192,6 +1198,8 @@ std::pair<const uint8_t*, ptrdiff_t> DecompressBranchless(
// The throughput is limited by instructions, unrolling the inner loop
// twice reduces the amount of instructions checking limits and also
// leads to reduced mov's.
SNAPPY_PREFETCH(ip+128);
for (int i = 0; i < 2; i++) {
const uint8_t* old_ip = ip;
assert(tag == ip[-1]);