summaryrefslogtreecommitdiff
path: root/deflate.h
diff options
context:
space:
mode:
authorrobert.bradford <robert.bradford@intel.com>2014-10-23 04:11:00 -0700
committerCommit bot <commit-bot@chromium.org>2014-10-23 11:11:24 +0000
commit02acec9197b28f3f7e478876815ad9349f9360af (patch)
treecc1ed44717d42ee14eee5a1c3b8fb557c3c01527 /deflate.h
parent9c8881c4e1cba634c59e3c94c7bfcfe5b059fb03 (diff)
downloadzlib-02acec9197b28f3f7e478876815ad9349f9360af.tar.gz
Integrate SIMD optimisations for zlib
These optimisations have been published on zlib mailing list and at https://github.com/jtkukunas/zlib/ This change merges the following optimisation patches: - "For x86, add CPUID check." - "Adds SSE2 optimized hash shifting to fill_window." - "add SSE4.2 optimized hash function" - "add PCLMULQDQ optimized CRC folding" From Jim Kukunas <james.t.kukunas@linux.intel.com> and adapts them to the current zlib version in Chromium. The optimisations are enabled at runtime if all the necessary CPU features are present. As the optimisations require extra cflags to enable the compiler to use the instructions the optimisations are held in their own static library with a stub implementation to allow linking on other platforms. TEST=net_unittests(GZipUnitTest) passes, Chrome functions and performance improvement seen on RoboHornet benchmark on Linux Desktop BUG=401517 Review URL: https://codereview.chromium.org/552123005 Cr-Original-Commit-Position: refs/heads/master@{#300866} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: e045ec106de29562ae94eafccde49a7b73848471
Diffstat (limited to 'deflate.h')
-rw-r--r--deflate.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/deflate.h b/deflate.h
index 2fe6fd6..f5c7a8b 100644
--- a/deflate.h
+++ b/deflate.h
@@ -107,6 +107,8 @@ typedef struct internal_state {
Byte method; /* STORED (for zip only) or DEFLATED */
int last_flush; /* value of flush param for previous deflate call */
+ unsigned zalign(16) crc0[4 * 5];
+
/* used by deflate.c: */
uInt w_size; /* LZ77 window size (32K by default) */
@@ -344,4 +346,15 @@ void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf,
flush = _tr_tally(s, distance, length)
#endif
+/* Functions that are SIMD optimised on x86 */
+void ZLIB_INTERNAL crc_fold_init(deflate_state* const s);
+void ZLIB_INTERNAL crc_fold_copy(deflate_state* const s,
+ unsigned char* dst,
+ const unsigned char* src,
+ long len);
+unsigned ZLIB_INTERNAL crc_fold_512to32(deflate_state* const s);
+
+Pos ZLIB_INTERNAL insert_string_sse(deflate_state* const s, const Pos str);
+void ZLIB_INTERNAL fill_window_sse(deflate_state* s);
+
#endif /* DEFLATE_H */