diff --git a/c/common/platform.h b/c/common/platform.h
index c18ff02..713119e 100644
--- a/c/common/platform.h
+++ b/c/common/platform.h
@@ -282,6 +282,11 @@
   memcpy(&t, p, sizeof t);
   return t;
 }
+static BROTLI_INLINE size_t BrotliUnalignedReadSizeT(const void* p) {
+  size_t t;
+  memcpy(&t, p, sizeof t);
+  return t;
+}
 static BROTLI_INLINE void BrotliUnalignedWrite64(void* p, uint64_t v) {
   memcpy(p, &v, sizeof v);
 }
@@ -489,11 +494,29 @@
 /* Default brotli_free_func */
 BROTLI_COMMON_API void BrotliDefaultFreeFunc(void* opaque, void* address);
 
+/* Circular logical rotates. */
+static BROTLI_INLINE uint16_t BrotliRotateRight16(uint16_t const value,
+                                             size_t count) {
+  count &= 0x0F; /* for fickle pattern recognition */
+  return (value >> count) | (uint16_t)(value << ((0U - count) & 0x0F));
+}
+static BROTLI_INLINE uint32_t BrotliRotateRight32(uint32_t const value,
+                                             size_t count) {
+  count &= 0x1F; /* for fickle pattern recognition */
+  return (value >> count) | (uint32_t)(value << ((0U - count) & 0x1F));
+}
+static BROTLI_INLINE uint64_t BrotliRotateRight64(uint64_t const value,
+                                             size_t count) {
+  count &= 0x3F; /* for fickle pattern recognition */
+  return (value >> count) | (uint64_t)(value << ((0U - count) & 0x3F));
+}
+
 BROTLI_UNUSED_FUNCTION void BrotliSuppressUnusedFunctions(void) {
   BROTLI_UNUSED(&BrotliSuppressUnusedFunctions);
   BROTLI_UNUSED(&BrotliUnalignedRead16);
   BROTLI_UNUSED(&BrotliUnalignedRead32);
   BROTLI_UNUSED(&BrotliUnalignedRead64);
+  BROTLI_UNUSED(&BrotliUnalignedReadSizeT);
   BROTLI_UNUSED(&BrotliUnalignedWrite64);
   BROTLI_UNUSED(&BROTLI_UNALIGNED_LOAD16LE);
   BROTLI_UNUSED(&BROTLI_UNALIGNED_LOAD32LE);
@@ -516,6 +539,9 @@
   BROTLI_UNUSED(&brotli_max_uint8_t);
   BROTLI_UNUSED(&BrotliDefaultAllocFunc);
   BROTLI_UNUSED(&BrotliDefaultFreeFunc);
+  BROTLI_UNUSED(&BrotliRotateRight16);
+  BROTLI_UNUSED(&BrotliRotateRight32);
+  BROTLI_UNUSED(&BrotliRotateRight64);
 #if BROTLI_ENABLE_DUMP
   BROTLI_UNUSED(&BrotliDump);
 #endif
@@ -534,6 +560,13 @@
 #  define PREFETCH_L1(ptr) do { (void)(ptr); } while (0)  /* disabled */
 #  define PREFETCH_L2(ptr) do { (void)(ptr); } while (0)  /* disabled */
 #endif
+
+/* The SIMD matchers are only faster at certain quality levels. */
+#if defined(_M_X64) && defined(BROTLI_TZCNT64)
+#define BROTLI_MAX_SIMD_QUALITY 7
+#elif defined(BROTLI_TZCNT64)
+#define BROTLI_MAX_SIMD_QUALITY 6
+#endif
 }
 
 #endif  /* BROTLI_COMMON_PLATFORM_H_ */
diff --git a/c/enc/backward_references.c b/c/enc/backward_references.c
index f600e64..2531ceb 100644
--- a/c/enc/backward_references.c
+++ b/c/enc/backward_references.c
@@ -116,6 +116,18 @@
 #include "backward_references_inc.h"
 #undef HASHER
 
+#if defined(BROTLI_MAX_SIMD_QUALITY)
+#define HASHER() H58
+/* NOLINTNEXTLINE(build/include) */
+#include "backward_references_inc.h"
+#undef HASHER
+
+#define HASHER() H68
+/* NOLINTNEXTLINE(build/include) */
+#include "backward_references_inc.h"
+#undef HASHER
+#endif
+
 #undef ENABLE_COMPOUND_DICTIONARY
 #undef PREFIX
 #define PREFIX() D
@@ -149,6 +161,16 @@
 /* NOLINTNEXTLINE(build/include) */
 #include "backward_references_inc.h"
 #undef HASHER
+#if defined(BROTLI_MAX_SIMD_QUALITY)
+#define HASHER() H58
+/* NOLINTNEXTLINE(build/include) */
+#include "backward_references_inc.h"
+#undef HASHER
+#define HASHER() H68
+/* NOLINTNEXTLINE(build/include) */
+#include "backward_references_inc.h"
+#undef HASHER
+#endif
 
 #undef ENABLE_COMPOUND_DICTIONARY
 #undef PREFIX
@@ -174,6 +196,10 @@
         return;
       CASE_(5)
       CASE_(6)
+#if defined(BROTLI_MAX_SIMD_QUALITY)
+      CASE_(58)
+      CASE_(68)
+#endif
       CASE_(40)
       CASE_(41)
       CASE_(42)
diff --git a/c/enc/hash.h b/c/enc/hash.h
index 9533b05..3ceb66c 100644
--- a/c/enc/hash.h
+++ b/c/enc/hash.h
@@ -22,6 +22,7 @@
 #include "encoder_dict.h"
 #include "fast_log.h"
 #include "find_match_length.h"
+#include "matching_tag_mask.h"
 #include "memory.h"
 #include "quality.h"
 #include "static_dict.h"
@@ -297,6 +298,16 @@
 #include "hash_longest_match64_inc.h"  /* NOLINT(build/include) */
 #undef HASHER
 
+#if defined(BROTLI_MAX_SIMD_QUALITY)
+#define HASHER() H58
+#include "hash_longest_match_simd_inc.h" /* NOLINT(build/include) */
+#undef HASHER
+
+#define HASHER() H68
+#include "hash_longest_match64_simd_inc.h" /* NOLINT(build/include) */
+#undef HASHER
+#endif
+
 #define BUCKET_BITS 15
 
 #define NUM_LAST_DISTANCES_TO_CHECK 4
@@ -388,7 +399,13 @@
 #undef CAT
 #undef EXPAND_CAT
 
-#define FOR_SIMPLE_HASHERS(H) H(2) H(3) H(4) H(5) H(6) H(40) H(41) H(42) H(54)
+#if defined(BROTLI_MAX_SIMD_QUALITY)
+#define FOR_SIMPLE_HASHERS(H) \
+  H(2) H(3) H(4) H(5) H(6) H(40) H(41) H(42) H(54) H(58) H(68)
+#else
+#define FOR_SIMPLE_HASHERS(H) \
+  H(2) H(3) H(4) H(5) H(6) H(40) H(41) H(42) H(54)
+#endif
 #define FOR_COMPOSITE_HASHERS(H) H(35) H(55) H(65)
 #define FOR_GENERIC_HASHERS(H) FOR_SIMPLE_HASHERS(H) FOR_COMPOSITE_HASHERS(H)
 #define FOR_ALL_HASHERS(H) FOR_GENERIC_HASHERS(H) H(10)
diff --git a/c/enc/hash_longest_match64_simd_inc.h b/c/enc/hash_longest_match64_simd_inc.h
new file mode 100644
index 0000000..cd4e7b1
--- /dev/null
+++ b/c/enc/hash_longest_match64_simd_inc.h
@@ -0,0 +1,300 @@
+/* NOLINT(build/header_guard) */
+/* Copyright 2010 Google Inc. All Rights Reserved.
+
+   Distributed under MIT license.
+   See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+
+/* template parameters: FN */
+
+/* A (forgetful) hash table to the data seen by the compressor, to
+   help create backward references to previous data.
+
+   This is a hash map of fixed size (bucket_size_) to a ring buffer of
+   fixed size (block_size_). The ring buffer contains the last block_size_
+   index positions of the given hash key in the compressed data. */
+
+#define HashLongestMatch HASHER()
+
+#define TAG_HASH_BITS 8
+#define TAG_HASH_MASK ((1 << TAG_HASH_BITS) - 1)
+
+static BROTLI_INLINE size_t FN(HashTypeLength)(void) { return 8; }
+static BROTLI_INLINE size_t FN(StoreLookahead)(void) { return 8; }
+
+/* HashBytes is the function that chooses the bucket to place the address in. */
+static BROTLI_INLINE size_t FN(HashBytes)(const uint8_t* BROTLI_RESTRICT data,
+                                          uint64_t hash_mul) {
+  const uint64_t h = BROTLI_UNALIGNED_LOAD64LE(data) * hash_mul;
+  /* The higher bits contain more mixture from the multiplication,
+     so we take our results from there. */
+  return (size_t)(h >> (64 - 15 - TAG_HASH_BITS));
+}
+
+typedef struct HashLongestMatch {
+  /* Number of hash buckets. */
+  size_t bucket_size_;
+  /* Only block_size_ newest backward references are kept,
+     and the older are forgotten. */
+  size_t block_size_;
+  /* Hash multiplier tuned to match length. */
+  uint64_t hash_mul_;
+  /* Mask for accessing entries in a block (in a ring-buffer manner). */
+  uint32_t block_mask_;
+
+  int block_bits_;
+  int num_last_distances_to_check_;
+
+  /* Shortcuts. */
+  HasherCommon* common_;
+
+  /* --- Dynamic size members --- */
+
+  /* Number of entries in a particular bucket. */
+  uint16_t* num_;  /* uint16_t[bucket_size]; */
+
+  uint8_t* tags_;
+
+  /* Buckets containing block_size_ of backward references. */
+  uint32_t* buckets_;  /* uint32_t[bucket_size * block_size]; */
+} HashLongestMatch;
+
+static void FN(Initialize)(
+    HasherCommon* common, HashLongestMatch* BROTLI_RESTRICT self,
+    const BrotliEncoderParams* params) {
+  self->common_ = common;
+
+  BROTLI_UNUSED(params);
+  self->hash_mul_ = kHashMul64 << (64 - 5 * 8);
+  BROTLI_DCHECK(common->params.bucket_bits == 15);
+  self->bucket_size_ = (size_t)1 << common->params.bucket_bits;
+  self->block_bits_ = common->params.block_bits;
+  self->block_size_ = (size_t)1 << common->params.block_bits;
+  self->block_mask_ = (uint32_t)(self->block_size_ - 1);
+  self->num_last_distances_to_check_ =
+      common->params.num_last_distances_to_check;
+  self->num_ = (uint16_t*)common->extra[0];
+  self->tags_ = (uint8_t*)common->extra[1];
+  self->buckets_ = (uint32_t*)common->extra[2];
+}
+
+static void FN(Prepare)(
+    HashLongestMatch* BROTLI_RESTRICT self, BROTLI_BOOL one_shot,
+    size_t input_size, const uint8_t* BROTLI_RESTRICT data) {
+  uint16_t* BROTLI_RESTRICT num = self->num_;
+  /* Partial preparation is 100 times slower (per socket). */
+  size_t partial_prepare_threshold = self->bucket_size_ >> 6;
+  if (one_shot && input_size <= partial_prepare_threshold) {
+    size_t i;
+    for (i = 0; i < input_size; ++i) {
+      const size_t hash = FN(HashBytes)(&data[i], self->hash_mul_);
+      const size_t key = hash >> TAG_HASH_BITS;
+      num[key] = 65535;
+    }
+  } else {
+    /* Set all the bytes of num to 255, which makes each uint16_t 65535. */
+    memset(num, 255, self->bucket_size_ * sizeof(num[0]));
+  }
+}
+
+static BROTLI_INLINE void FN(HashMemAllocInBytes)(
+    const BrotliEncoderParams* params, BROTLI_BOOL one_shot,
+    size_t input_size, size_t* alloc_size) {
+  size_t bucket_size = (size_t)1 << params->hasher.bucket_bits;
+  size_t block_size = (size_t)1 << params->hasher.block_bits;
+  BROTLI_UNUSED(one_shot);
+  BROTLI_UNUSED(input_size);
+  alloc_size[0] = sizeof(uint16_t) * bucket_size;
+  alloc_size[1] = sizeof(uint8_t) * bucket_size * block_size;
+  alloc_size[2] = sizeof(uint32_t) * bucket_size * block_size;
+}
+
+/* Look at 4 bytes at &data[ix & mask].
+   Compute a hash from these, and store the value of ix at that position. */
+static BROTLI_INLINE void FN(Store)(
+    HashLongestMatch* BROTLI_RESTRICT self, const uint8_t* BROTLI_RESTRICT data,
+    const size_t mask, const size_t ix) {
+  uint16_t* BROTLI_RESTRICT num = self->num_;
+  uint8_t* BROTLI_RESTRICT tags = self->tags_;
+  uint32_t* BROTLI_RESTRICT buckets = self->buckets_;
+  const size_t hash = FN(HashBytes)(&data[ix & mask], self->hash_mul_);
+  const size_t key = hash >> TAG_HASH_BITS;
+  const uint8_t tag = hash & TAG_HASH_MASK;
+  const size_t minor_ix = num[key] & self->block_mask_;
+  const size_t offset = minor_ix + (key << self->block_bits_);
+  --num[key];
+  buckets[offset] = (uint32_t)ix;
+  tags[offset] = tag;
+}
+
+static BROTLI_INLINE void FN(StoreRange)(HashLongestMatch* BROTLI_RESTRICT self,
+    const uint8_t* BROTLI_RESTRICT data, const size_t mask,
+    const size_t ix_start, const size_t ix_end) {
+  size_t i;
+  for (i = ix_start; i < ix_end; ++i) {
+    FN(Store)(self, data, mask, i);
+  }
+}
+
+static BROTLI_INLINE void FN(StitchToPreviousBlock)(
+    HashLongestMatch* BROTLI_RESTRICT self,
+    size_t num_bytes, size_t position, const uint8_t* ringbuffer,
+    size_t ringbuffer_mask) {
+  if (num_bytes >= FN(HashTypeLength)() - 1 && position >= 3) {
+    /* Prepare the hashes for three last bytes of the last write.
+       These could not be calculated before, since they require knowledge
+       of both the previous and the current block. */
+    FN(Store)(self, ringbuffer, ringbuffer_mask, position - 3);
+    FN(Store)(self, ringbuffer, ringbuffer_mask, position - 2);
+    FN(Store)(self, ringbuffer, ringbuffer_mask, position - 1);
+  }
+}
+
+static BROTLI_INLINE void FN(PrepareDistanceCache)(
+    HashLongestMatch* BROTLI_RESTRICT self,
+    int* BROTLI_RESTRICT distance_cache) {
+  PrepareDistanceCache(distance_cache, self->num_last_distances_to_check_);
+}
+
+/* Find a longest backward match of &data[cur_ix] up to the length of
+   max_length and stores the position cur_ix in the hash table.
+
+   REQUIRES: FN(PrepareDistanceCache) must be invoked for current distance cache
+             values; if this method is invoked repeatedly with the same distance
+             cache values, it is enough to invoke FN(PrepareDistanceCache) once.
+
+   Does not look for matches longer than max_length.
+   Does not look for matches further away than max_backward.
+   Writes the best match into |out|.
+   |out|->score is updated only if a better match is found. */
+static BROTLI_INLINE void FN(FindLongestMatch)(
+    HashLongestMatch* BROTLI_RESTRICT self,
+    const BrotliEncoderDictionary* dictionary,
+    const uint8_t* BROTLI_RESTRICT data, const size_t ring_buffer_mask,
+    const int* BROTLI_RESTRICT distance_cache, const size_t cur_ix,
+    const size_t max_length, const size_t max_backward,
+    const size_t dictionary_distance, const size_t max_distance,
+    HasherSearchResult* BROTLI_RESTRICT out) {
+  uint16_t* BROTLI_RESTRICT num = self->num_;
+  uint32_t* BROTLI_RESTRICT buckets = self->buckets_;
+  uint8_t* BROTLI_RESTRICT tags = self->tags_;
+  const size_t cur_ix_masked = cur_ix & ring_buffer_mask;
+  /* Don't accept a short copy from far away. */
+  score_t min_score = out->score;
+  score_t best_score = out->score;
+  size_t best_len = out->len;
+  size_t i;
+  /* Precalculate the hash key and prefetch the bucket. */
+  const size_t hash = FN(HashBytes)(&data[cur_ix_masked], self->hash_mul_);
+  const size_t key = hash >> TAG_HASH_BITS;
+  uint32_t* BROTLI_RESTRICT bucket = &buckets[key << self->block_bits_];
+  uint8_t* BROTLI_RESTRICT tag_bucket = &tags[key << self->block_bits_];
+  PREFETCH_L1(bucket);
+  PREFETCH_L1(tag_bucket);
+  if (self->block_bits_ > 4) PREFETCH_L1(bucket + 16);
+  out->len = 0;
+  out->len_code_delta = 0;
+
+  BROTLI_DCHECK(cur_ix_masked + max_length <= ring_buffer_mask);
+
+  /* Try last distance first. */
+  for (i = 0; i < (size_t)self->num_last_distances_to_check_; ++i) {
+    const size_t backward = (size_t)distance_cache[i];
+    size_t prev_ix = (size_t)(cur_ix - backward);
+    if (prev_ix >= cur_ix) {
+      continue;
+    }
+    if (BROTLI_PREDICT_FALSE(backward > max_backward)) {
+      continue;
+    }
+    prev_ix &= ring_buffer_mask;
+
+    if (cur_ix_masked + best_len > ring_buffer_mask ||
+        prev_ix + best_len > ring_buffer_mask ||
+        data[cur_ix_masked + best_len] != data[prev_ix + best_len]) {
+      continue;
+    }
+    {
+      const size_t len = FindMatchLengthWithLimit(&data[prev_ix],
+                                                  &data[cur_ix_masked],
+                                                  max_length);
+      if (len >= 3 || (len == 2 && i < 2)) {
+        /* Comparing for >= 2 does not change the semantics, but just saves for
+           a few unnecessary binary logarithms in backward reference score,
+           since we are not interested in such short matches. */
+        score_t score = BackwardReferenceScoreUsingLastDistance(len);
+        if (best_score < score) {
+          if (i != 0) score -= BackwardReferencePenaltyUsingLastDistance(i);
+          if (best_score < score) {
+            best_score = score;
+            best_len = len;
+            out->len = best_len;
+            out->distance = backward;
+            out->score = best_score;
+          }
+        }
+      }
+    }
+  }
+  /* we require matches of len >4, so increase best_len to 3, so we can compare
+   * 4 bytes all the time. */
+  if (best_len < 3) {
+    best_len = 3;
+  }
+  {
+    const uint8_t tag = hash & TAG_HASH_MASK;
+    const uint32_t first4 = BrotliUnalignedRead32(data + cur_ix_masked);
+    const size_t max_length_m4 = max_length - 4;
+    const size_t head = (num[key] + 1) & self->block_mask_;
+    uint64_t matches =
+        GetMatchingTagMask(self->block_size_ / 16, tag, tag_bucket, head);
+    /* Mask off any matches from uninitialized tags. */
+    uint16_t n = 65535 - num[key];
+    uint64_t block_has_unused_slots = self->block_size_ > n;
+    uint64_t mask = (block_has_unused_slots << (n & (64 - 1))) - 1;
+    matches &= mask;
+    for (; matches > 0; matches &= (matches - 1)) {
+      const size_t rb_index =
+          (head + (size_t)BROTLI_TZCNT64(matches)) & self->block_mask_;
+      size_t prev_ix = bucket[rb_index];
+      uint32_t current4;
+      const size_t backward = cur_ix - prev_ix;
+      if (BROTLI_PREDICT_FALSE(backward > max_backward)) {
+        break;
+      }
+      prev_ix &= ring_buffer_mask;
+      if (cur_ix_masked + best_len > ring_buffer_mask ||
+          prev_ix + best_len > ring_buffer_mask ||
+          /* compare 4 bytes ending at best_len + 1 */
+          BrotliUnalignedRead32(&data[cur_ix_masked + best_len - 3]) !=
+              BrotliUnalignedRead32(&data[prev_ix + best_len - 3])) {
+        continue;
+      }
+      current4 = BrotliUnalignedRead32(data + prev_ix);
+      if (first4 != current4) continue;
+      {
+        const size_t len = FindMatchLengthWithLimit(&data[prev_ix + 4],
+                                                    &data[cur_ix_masked + 4],
+                                                    max_length_m4) + 4;
+        const score_t score = BackwardReferenceScore(len, backward);
+        if (best_score < score) {
+          best_score = score;
+          best_len = len;
+          out->len = best_len;
+          out->distance = backward;
+          out->score = best_score;
+        }
+      }
+    }
+    bucket[num[key] & self->block_mask_] = (uint32_t)cur_ix;
+    tag_bucket[num[key] & self->block_mask_] = tag;
+    --num[key];
+  }
+  if (min_score == out->score) {
+    SearchInStaticDictionary(dictionary,
+        self->common_, &data[cur_ix_masked], max_length, dictionary_distance,
+        max_distance, out, BROTLI_FALSE);
+  }
+}
+
+#undef HashLongestMatch
diff --git a/c/enc/hash_longest_match_simd_inc.h b/c/enc/hash_longest_match_simd_inc.h
new file mode 100644
index 0000000..2bf9b6c
--- /dev/null
+++ b/c/enc/hash_longest_match_simd_inc.h
@@ -0,0 +1,274 @@
+/* NOLINT(build/header_guard) */
+/* Copyright 2010 Google Inc. All Rights Reserved.
+   Distributed under MIT license.
+   See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
+*/
+/* template parameters: FN */
+/* A (forgetful) hash table to the data seen by the compressor, to
+   help create backward references to previous data.
+   This is a hash map of fixed size (bucket_size_) to a ring buffer of
+   fixed size (block_size_). The ring buffer contains the last block_size_
+   index positions of the given hash key in the compressed data. */
+#define HashLongestMatch HASHER()
+#define TAG_HASH_BITS 8
+#define TAG_HASH_MASK ((1 << TAG_HASH_BITS) - 1)
+static BROTLI_INLINE size_t FN(HashTypeLength)(void) { return 4; }
+static BROTLI_INLINE size_t FN(StoreLookahead)(void) { return 4; }
+/* HashBytes is the function that chooses the bucket to place the address in. */
+static uint32_t FN(HashBytes)(
+    const uint8_t* BROTLI_RESTRICT data, const int shift) {
+  uint32_t h = BROTLI_UNALIGNED_LOAD32LE(data) * kHashMul32;
+  /* The higher bits contain more mixture from the multiplication,
+     so we take our results from there. */
+  return (uint32_t)(h >> shift);
+}
+typedef struct HashLongestMatch {
+  /* Number of hash buckets. */
+  size_t bucket_size_;
+  /* Only block_size_ newest backward references are kept,
+     and the older are forgotten. */
+  size_t block_size_;
+  /* Left-shift for computing hash bucket index from hash value. */
+  int hash_shift_;
+  /* Mask for accessing entries in a block (in a ring-buffer manner). */
+  uint32_t block_mask_;
+  int block_bits_;
+  int num_last_distances_to_check_;
+  /* Shortcuts. */
+  HasherCommon* common_;
+  /* --- Dynamic size members --- */
+  /* Number of entries in a particular bucket. */
+  uint16_t* num_;  /* uint16_t[bucket_size]; */
+  uint8_t* tags_;
+  /* Buckets containing block_size_ of backward references. */
+  uint32_t* buckets_;  /* uint32_t[bucket_size * block_size]; */
+} HashLongestMatch;
+static void FN(Initialize)(
+    HasherCommon* common, HashLongestMatch* BROTLI_RESTRICT self,
+    const BrotliEncoderParams* params) {
+  self->common_ = common;
+  BROTLI_UNUSED(params);
+  self->hash_shift_ = 32 - common->params.bucket_bits - TAG_HASH_BITS;
+  self->bucket_size_ = (size_t)1 << common->params.bucket_bits;
+  self->block_size_ = (size_t)1 << common->params.block_bits;
+  self->block_mask_ = (uint32_t)(self->block_size_ - 1);
+  self->num_ = (uint16_t*)common->extra[0];
+  self->tags_ = (uint8_t*)common->extra[1];
+  self->buckets_ = (uint32_t*)common->extra[2];
+  self->block_bits_ = common->params.block_bits;
+  self->num_last_distances_to_check_ =
+      common->params.num_last_distances_to_check;
+}
+static void FN(Prepare)(
+    HashLongestMatch* BROTLI_RESTRICT self, BROTLI_BOOL one_shot,
+    size_t input_size, const uint8_t* BROTLI_RESTRICT data) {
+  uint16_t* BROTLI_RESTRICT num = self->num_;
+  /* Partial preparation is 100 times slower (per socket). */
+  size_t partial_prepare_threshold = self->bucket_size_ >> 6;
+  if (one_shot && input_size <= partial_prepare_threshold) {
+    size_t i;
+    for (i = 0; i < input_size; ++i) {
+      const uint32_t hash = FN(HashBytes)(&data[i], self->hash_shift_);
+      const uint32_t key = hash >> TAG_HASH_BITS;
+      num[key] = 65535;
+    }
+  } else {
+    /* Set all the bytes of num to 255, which makes each uint16_t 65535. */
+    memset(num, 255, self->bucket_size_ * sizeof(num[0]));
+  }
+}
+static BROTLI_INLINE void FN(HashMemAllocInBytes)(
+    const BrotliEncoderParams* params, BROTLI_BOOL one_shot,
+    size_t input_size, size_t* alloc_size) {
+  size_t bucket_size = (size_t)1 << params->hasher.bucket_bits;
+  size_t block_size = (size_t)1 << params->hasher.block_bits;
+  BROTLI_UNUSED(one_shot);
+  BROTLI_UNUSED(input_size);
+  alloc_size[0] = sizeof(uint16_t) * bucket_size;
+  alloc_size[1] = sizeof(uint8_t) * bucket_size * block_size;
+  alloc_size[2] = sizeof(uint32_t) * bucket_size * block_size;
+}
+/* Look at 4 bytes at &data[ix & mask].
+   Compute a hash from these, and store the value of ix at that position. */
+static BROTLI_INLINE void FN(Store)(
+    HashLongestMatch* BROTLI_RESTRICT self, const uint8_t* BROTLI_RESTRICT data,
+    const size_t mask, const size_t ix) {
+  uint16_t* BROTLI_RESTRICT num = self->num_;
+  uint8_t* BROTLI_RESTRICT tags = self->tags_;
+  uint32_t* BROTLI_RESTRICT buckets = self->buckets_;
+  const size_t hash = FN(HashBytes)(&data[ix & mask], self->hash_shift_);
+  const size_t key = hash >> TAG_HASH_BITS;
+  const uint8_t tag = hash & TAG_HASH_MASK;
+  const size_t minor_ix = num[key] & self->block_mask_;
+  const size_t offset = minor_ix + (key << self->block_bits_);
+  --num[key];
+  buckets[offset] = (uint32_t)ix;
+  tags[offset] = tag;
+}
+static BROTLI_INLINE void FN(StoreRange)(HashLongestMatch* BROTLI_RESTRICT self,
+    const uint8_t* BROTLI_RESTRICT data, const size_t mask,
+    const size_t ix_start, const size_t ix_end) {
+  size_t i;
+  for (i = ix_start; i < ix_end; ++i) {
+    FN(Store)(self, data, mask, i);
+  }
+}
+static BROTLI_INLINE void FN(StitchToPreviousBlock)(
+    HashLongestMatch* BROTLI_RESTRICT self,
+    size_t num_bytes, size_t position, const uint8_t* ringbuffer,
+    size_t ringbuffer_mask) {
+  if (num_bytes >= FN(HashTypeLength)() - 1 && position >= 3) {
+    /* Prepare the hashes for three last bytes of the last write.
+       These could not be calculated before, since they require knowledge
+       of both the previous and the current block. */
+    FN(Store)(self, ringbuffer, ringbuffer_mask, position - 3);
+    FN(Store)(self, ringbuffer, ringbuffer_mask, position - 2);
+    FN(Store)(self, ringbuffer, ringbuffer_mask, position - 1);
+  }
+}
+static BROTLI_INLINE void FN(PrepareDistanceCache)(
+    HashLongestMatch* BROTLI_RESTRICT self,
+    int* BROTLI_RESTRICT distance_cache) {
+  PrepareDistanceCache(distance_cache, self->num_last_distances_to_check_);
+}
+
+/* Find a longest backward match of &data[cur_ix] up to the length of
+   max_length and stores the position cur_ix in the hash table.
+   REQUIRES: FN(PrepareDistanceCache) must be invoked for current distance cache
+             values; if this method is invoked repeatedly with the same distance
+             cache values, it is enough to invoke FN(PrepareDistanceCache) once.
+   Does not look for matches longer than max_length.
+   Does not look for matches further away than max_backward.
+   Writes the best match into |out|.
+   |out|->score is updated only if a better match is found. */
+static BROTLI_INLINE void FN(FindLongestMatch)(
+    HashLongestMatch* BROTLI_RESTRICT self,
+    const BrotliEncoderDictionary* dictionary,
+    const uint8_t* BROTLI_RESTRICT data, const size_t ring_buffer_mask,
+    const int* BROTLI_RESTRICT distance_cache, const size_t cur_ix,
+    const size_t max_length, const size_t max_backward,
+    const size_t dictionary_distance, const size_t max_distance,
+    HasherSearchResult* BROTLI_RESTRICT out) {
+  uint16_t* BROTLI_RESTRICT num = self->num_;
+  uint32_t* BROTLI_RESTRICT buckets = self->buckets_;
+  uint8_t* BROTLI_RESTRICT tags = self->tags_;
+  const size_t cur_ix_masked = cur_ix & ring_buffer_mask;
+  /* Don't accept a short copy from far away. */
+  score_t min_score = out->score;
+  score_t best_score = out->score;
+  size_t best_len = out->len;
+  size_t i;
+  /* Precalculate the hash key and prefetch the bucket. */
+  const uint32_t hash =
+      FN(HashBytes)(&data[cur_ix_masked], self->hash_shift_);
+  const uint32_t key = hash >> TAG_HASH_BITS;
+  uint32_t* BROTLI_RESTRICT bucket = &buckets[key << self->block_bits_];
+  uint8_t* BROTLI_RESTRICT tag_bucket = &tags[key << self->block_bits_];
+  PREFETCH_L1(bucket);
+  PREFETCH_L1(tag_bucket);
+  if (self->block_bits_ > 4) PREFETCH_L1(bucket + 16);
+  out->len = 0;
+  out->len_code_delta = 0;
+
+  BROTLI_DCHECK(cur_ix_masked + max_length <= ring_buffer_mask);
+
+  /* Try last distance first. */
+  for (i = 0; i < (size_t)self->num_last_distances_to_check_; ++i) {
+    const size_t backward = (size_t)distance_cache[i];
+    size_t prev_ix = (size_t)(cur_ix - backward);
+    if (prev_ix >= cur_ix) {
+      continue;
+    }
+    if (BROTLI_PREDICT_FALSE(backward > max_backward)) {
+      continue;
+    }
+    prev_ix &= ring_buffer_mask;
+
+    if (cur_ix_masked + best_len > ring_buffer_mask ||
+        prev_ix + best_len > ring_buffer_mask ||
+        data[cur_ix_masked + best_len] != data[prev_ix + best_len]) {
+      continue;
+    }
+    {
+      const size_t len = FindMatchLengthWithLimit(&data[prev_ix],
+                                                  &data[cur_ix_masked],
+                                                  max_length);
+      if (len >= 3 || (len == 2 && i < 2)) {
+        /* Comparing for >= 2 does not change the semantics, but just saves for
+           a few unnecessary binary logarithms in backward reference score,
+           since we are not interested in such short matches. */
+        score_t score = BackwardReferenceScoreUsingLastDistance(len);
+        if (best_score < score) {
+          if (i != 0) score -= BackwardReferencePenaltyUsingLastDistance(i);
+          if (best_score < score) {
+            best_score = score;
+            best_len = len;
+            out->len = best_len;
+            out->distance = backward;
+            out->score = best_score;
+          }
+        }
+      }
+    }
+  }
+  /* we require matches of len >4, so increase best_len to 3, so we can compare
+   * 4 bytes all the time. */
+  if (best_len < 3) {
+    best_len = 3;
+  }
+  {
+    const uint8_t tag = hash & TAG_HASH_MASK;
+    const size_t head = (num[key] + 1) & self->block_mask_;
+    uint64_t matches =
+        GetMatchingTagMask(self->block_size_ / 16, tag, tag_bucket, head);
+    /* Mask off any matches from uninitialized tags. */
+    uint16_t n = 65535 - num[key];
+    uint64_t block_has_unused_slots = self->block_size_ > n;
+    uint64_t mask = (block_has_unused_slots << (n & (64 - 1))) - 1;
+    matches &= mask;
+    for (; matches > 0; matches &= (matches - 1)) {
+      const size_t rb_index =
+          (head + (size_t)BROTLI_TZCNT64(matches)) & self->block_mask_;
+      size_t prev_ix = bucket[rb_index];
+      const size_t backward = cur_ix - prev_ix;
+      if (BROTLI_PREDICT_FALSE(backward > max_backward)) {
+        break;
+      }
+      prev_ix &= ring_buffer_mask;
+      if (cur_ix_masked + best_len > ring_buffer_mask ||
+          prev_ix + best_len > ring_buffer_mask ||
+          /* compare 4 bytes ending at best_len + 1 */
+          BrotliUnalignedRead32(&data[cur_ix_masked + best_len - 3]) !=
+              BrotliUnalignedRead32(&data[prev_ix + best_len - 3])) {
+        continue;
+      }
+      {
+        const size_t len = FindMatchLengthWithLimit(&data[prev_ix],
+                                                    &data[cur_ix_masked],
+                                                    max_length);
+        if (len >= 4) {
+          /* Comparing for >= 3 does not change the semantics, but just saves
+             for a few unnecessary binary logarithms in backward reference
+             score, since we are not interested in such short matches. */
+          score_t score = BackwardReferenceScore(len, backward);
+          if (best_score < score) {
+            best_score = score;
+            best_len = len;
+            out->len = best_len;
+            out->distance = backward;
+            out->score = best_score;
+          }
+        }
+      }
+    }
+    bucket[num[key] & self->block_mask_] = (uint32_t)cur_ix;
+    tag_bucket[num[key] & self->block_mask_] = tag;
+    --num[key];
+  }
+  if (min_score == out->score) {
+    SearchInStaticDictionary(dictionary,
+        self->common_, &data[cur_ix_masked], max_length, dictionary_distance,
+        max_distance, out, BROTLI_FALSE);
+  }
+}
+#undef HashLongestMatch
diff --git a/c/enc/matching_tag_mask.h b/c/enc/matching_tag_mask.h
new file mode 100644
index 0000000..c166255
--- /dev/null
+++ b/c/enc/matching_tag_mask.h
@@ -0,0 +1,68 @@
+#ifndef THIRD_PARTY_BROTLI_ENC_MATCHING_TAG_MASK_H_
+#define THIRD_PARTY_BROTLI_ENC_MATCHING_TAG_MASK_H_
+
+#include "../common/platform.h"
+
+#if defined(__SSE2__) || defined(_M_AMD64) || (defined (_M_IX86) && defined(_M_IX86_FP) && (_M_IX86_FP >= 2))
+#define SUPPORTS_SSE_2
+#endif
+
+#if defined(SUPPORTS_SSE_2)
+#include <immintrin.h>
+#endif
+
+
+static BROTLI_INLINE uint64_t GetMatchingTagMask(
+    size_t chunk_count, const uint8_t tag,
+    const uint8_t* BROTLI_RESTRICT tag_bucket, const size_t head) {
+  uint64_t matches = 0;
+#if defined(SUPPORTS_SSE_2)
+  const __m128i comparison_mask = _mm_set1_epi8((char)tag);
+  size_t i;
+  for (i = 0; i < chunk_count && i < 4; i++) {
+    const __m128i chunk =
+        _mm_loadu_si128((const __m128i*)(const void*)(tag_bucket + 16 * i));
+    const __m128i equal_mask = _mm_cmpeq_epi8(chunk, comparison_mask);
+    matches |= (uint64_t)_mm_movemask_epi8(equal_mask) << 16 * i;
+  }
+#else
+  const int chunk_size = sizeof(size_t);
+  const size_t shift_amount = ((chunk_size * 8) - chunk_size);
+  const size_t xFF = ~((size_t)0);
+  const size_t x01 = xFF / 0xFF;
+  const size_t x80 = x01 << 7;
+  const size_t splat_char = tag * x01;
+  int i = ((int)chunk_count * 16) - chunk_size;
+  BROTLI_DCHECK((sizeof(size_t) == 4) || (sizeof(size_t) == 8));
+#if BROTLI_LITTLE_ENDIAN
+  const size_t extractMagic = (xFF / 0x7F) >> chunk_size;
+  do {
+      size_t chunk = BrotliUnalignedReadSizeT(&tag_bucket[i]);
+      chunk ^= splat_char;
+      chunk = (((chunk | x80) - x01) | chunk) & x80;
+      matches <<= chunk_size;
+      matches |= (chunk * extractMagic) >> shift_amount;
+      i -= chunk_size;
+  } while (i >= 0);
+#else
+  const size_t msb = xFF ^ (xFF >> 1);
+  const size_t extractMagic = (msb / 0x1FF) | msb;
+  do {
+      size_t chunk = BrotliUnalignedReadSizeT(&tag_bucket[i]);
+      chunk ^= splat_char;
+      chunk = (((chunk | x80) - x01) | chunk) & x80;
+      matches <<= chunk_size;
+      matches |= ((chunk >> 7) * extractMagic) >> shift_amount;
+      i -= chunk_size;
+  } while (i >= 0);
+#endif
+  matches = ~matches;
+#endif
+  if (chunk_count == 1) return BrotliRotateRight16((uint16_t)matches, head);
+  if (chunk_count == 2) return BrotliRotateRight32((uint32_t)matches, head);
+  return BrotliRotateRight64(matches, head);
+}
+
+#undef SUPPORTS_SSE_2
+
+#endif  // THIRD_PARTY_BROTLI_ENC_MATCHING_TAG_MASK_H_
diff --git a/c/enc/quality.h b/c/enc/quality.h
index ffdfd72..4fe649e 100644
--- a/c/enc/quality.h
+++ b/c/enc/quality.h
@@ -128,16 +128,16 @@
    - q04: h04 (longest_match_quickly), b17, l5
    - q04: h54 (longest_match_quickly), b20, l7 | for large files
 
-   - q05: h05 (longest_match        ), b14, l4
-   - q05: h06 (longest_match64      ), b15, l5 | for large files
+   - q05: h58 (longest_match_simd   ), b14, l4
+   - q05: h68 (longest_match64_simd ), b15, l5 | for large files
    - q05: h40 (forgetful_chain      ), b15, l4 | for small window
 
-   - q06: h05 (longest_match        ), b14, l4
-   - q06: h06 (longest_match64      ), b15, l5 | for large files
+   - q06: h58 (longest_match_simd   ), b14, l4
+   - q06: h68 (longest_match64_simd ), b15, l5 | for large files
    - q06: h40 (forgetful_chain      ), b15, l4 | for small window
 
-   - q07: h05 (longest_match        ), b15, l4
-   - q07: h06 (longest_match64      ), b15, l5 | for large files
+   - q07: h58 (longest_match_simd   ), b15, l4
+   - q07: h68 (longest_match64_simd ), b15, l5 | for large files
    - q07: h41 (forgetful_chain      ), b15, l4 | for small window
 
    - q08: h05 (longest_match        ), b15, l4
@@ -165,7 +165,11 @@
   } else if (params->lgwin <= 16) {
     hparams->type = params->quality < 7 ? 40 : params->quality < 9 ? 41 : 42;
   } else if (params->size_hint >= (1 << 20) && params->lgwin >= 19) {
+#if defined(BROTLI_MAX_SIMD_QUALITY)
+    hparams->type = params->quality <= BROTLI_MAX_SIMD_QUALITY ? 68 : 6;
+#else
     hparams->type = 6;
+#endif
     hparams->block_bits = params->quality - 1;
     hparams->bucket_bits = 15;
     hparams->num_last_distances_to_check =
@@ -173,7 +177,11 @@
   } else {
     /* TODO(eustas): often previous setting (H6) is faster and denser; consider
                      adding an option to use it. */
+#if defined(BROTLI_MAX_SIMD_QUALITY)
+    hparams->type = params->quality <= BROTLI_MAX_SIMD_QUALITY ? 58 : 5;
+#else
     hparams->type = 5;
+#endif
     hparams->block_bits = params->quality - 1;
     hparams->bucket_bits = params->quality < 7 ? 14 : 15;
     hparams->num_last_distances_to_check =
