diff options
author | Adenilson Cavalcanti <adenilson.cavalcanti@arm.com> | 2018-08-15 01:06:05 +0000 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2018-08-15 01:06:05 +0000 |
commit | 21cc38ff700a0719127fec958b67a8bbb737c826 (patch) | |
tree | 5c15470e8b59381e72b242e6f99efb4ea7ad7c21 /deflate.c | |
parent | d6d1961d89ea288546c348d23ab11bc29102c670 (diff) | |
download | zlib-21cc38ff700a0719127fec958b67a8bbb737c826.tar.gz |
ARM optimized insert_string
Using a faster hash function yields a considerable performance boost
in compression (average 8% on A53 and 24% on A72).
This change was enabled by previous patch with optimized crc32 using
ARMv8-1 crypto extensions for performing CPU feature detection
(so won't help older ARMv7 SoCs).
Bug: 873759
Change-Id: I88ece549a63d923beef4f96a046acdf09e529784
Reviewed-on: https://chromium-review.googlesource.com/1173262
Reviewed-by: Chris Blume <cblume@chromium.org>
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Adenilson Cavalcanti <cavalcantii@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#583113}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 1364a33fe0f2b9588a2d018f62ff4d966a525f37
Diffstat (limited to 'deflate.c')
-rw-r--r-- | deflate.c | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -51,9 +51,17 @@ #include <assert.h> #include "deflate.h" #include "x86.h" + #if (defined(__ARM_NEON__) || defined(__ARM_NEON)) #include "contrib/optimizations/slide_hash_neon.h" #endif +/* We need crypto extension crc32 to implement optimized hash in + * insert_string. + */ +#if defined(CRC32_ARMV8_CRC32) +#include "arm_features.h" +#include "crc32_simd.h" +#endif const char deflate_copyright[] = " deflate 1.2.11 Copyright 1995-2017 Jean-loup Gailly and Mark Adler "; @@ -207,12 +215,16 @@ local INLINE Pos insert_string_c(deflate_state *const s, const Pos str) local INLINE Pos insert_string(deflate_state *const s, const Pos str) { +#if defined(CRC32_ARMV8_CRC32) + if (arm_cpu_enable_crc32) + return insert_string_arm(s, str); +#endif if (x86_cpu_enable_simd) return insert_string_sse(s, str); + return insert_string_c(s, str); } - /* =========================================================================== * Initialize the hash table (avoiding 64K overflow for 16 bit systems). * prev[] will be initialized on the fly. |