summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlya Tokar <tokarip@google.com>2022-11-18 21:51:44 +0000
committerVictor Costan <pwnall@chromium.org>2023-01-12 13:33:10 +0000
commit37f375ddebbd0f2918c0036f7f9468bfd73cb86e (patch)
tree0eebb9cd0f6974a1dd90963a11238d9d1fbb5890
parent15e2a0e13ddd9c6444c8a95e611e6bda19e9c38f (diff)
downloadsnappy-git-37f375ddebbd0f2918c0036f7f9468bfd73cb86e.tar.gz
Add prefetch to zippy decompess,
PiperOrigin-RevId: 489554313
-rw-r--r--snappy.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/snappy.cc b/snappy.cc
index c830fb9..903a7f7 100644
--- a/snappy.cc
+++ b/snappy.cc
@@ -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]);