diff options
author | Adenilson Cavalcanti <adenilson.cavalcanti@arm.com> | 2017-11-30 01:34:16 +0000 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2017-11-30 01:34:16 +0000 |
commit | d7601c23c6fe4a8061394af350df935772f520f3 (patch) | |
tree | feadec9e4490d87ecf8b4feade6e41780d8516e0 /deflate.c | |
parent | 079f41943ea7fb4ec0ccb726a21fd86ee37b024b (diff) | |
download | zlib-d7601c23c6fe4a8061394af350df935772f520f3.tar.gz |
Using ARMv8 CRC32 specific instruction
CRC32 affects performance for both image decompression (PNG)
as also in general browsing while accessing websites that serve
content using compression (i.e. Content-Encoding: gzip).
This patch implements an optimized CRC32 function using the
dedicated instruction available in ARMv8. This instruction is available
in new Android devices featuring an ARMv8 SoC, like Nexus 5x and
Google Pixel.
It should be between 6x (A53: 116ms X 22ms for a 4Kx4Kx4 buffer) to
10x faster (A72: 91ms x 9ms) than the C implementation currently used
by zlib.
PNG decoding performance gains should be around 5-9%.
Finally it also introduces code to perform the ARM CPU features detection
using getauxval()@Linux/CrOS or android_getCpuFeatures(). We pre-built
and link the CRC32 instruction dependent code but will decide if to
use it at run time.
If the feature is not supported, we fallback to the C implementation.
This approach allows to use the instruction in both 32bits and 64bits
builds and works fine either in ARMv7 or ARMv8 processor. I tested the
generated Chromium apk in both a ARMv7 (Nexus 4 and 6) and ARMv8 (Nexus 5x and
Google Pixel).
Change-Id: I069408ebc06c49a3c2be4ba3253319e025ee09d7
Bug: 709716
Reviewed-on: https://chromium-review.googlesource.com/612629
Reviewed-by: Chris Blume <cblume@chromium.org>
Commit-Queue: Adenilson Cavalcanti <cavalcantii@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#520377}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 35988c821c051a57e30c76f9fcd87b7b677bd9bd
Diffstat (limited to 'deflate.c')
-rw-r--r-- | deflate.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -51,6 +51,9 @@ #include <assert.h> #include "deflate.h" #include "x86.h" +#if defined(USE_ARMV8_CRC32) +#include "contrib/optimizations/arm/arm_features.h" +#endif const char deflate_copyright[] = " deflate 1.2.11 Copyright 1995-2017 Jean-loup Gailly and Mark Adler "; @@ -283,7 +286,11 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, * output size for (length,distance) codes is <= 24 bits. */ +#if defined(ADLER32_SIMD_SSE3) x86_check_features(); +#elif defined(USE_ARMV8_CRC32) + arm_check_features(); +#endif if (version == Z_NULL || version[0] != my_version[0] || stream_size != sizeof(z_stream)) { |