diff options
author | Adenilson Cavalcanti <adenilson.cavalcanti@arm.com> | 2019-12-21 06:10:04 +0000 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-12-21 06:10:04 +0000 |
commit | ee4f17204f61e39851f833199965e72a76e5437f (patch) | |
tree | 4a6be5bd5a806ddb316ba61d8961112c63b24b06 /deflate.c | |
parent | d7f3ca98b2b0d5f72656502961a59353791c4f8a (diff) | |
download | zlib-ee4f17204f61e39851f833199965e72a76e5437f.tar.gz |
Unify CPU features detection code
This will allow to remove some duplicated code (i.e. thread synchronization)
while at same time removing unnecessary use of inline ASM for Intel features
detection.
A few other advantages:
- remove some extra logic (e.g. no need to test the platform to include the
correct CPU detection header).
- simplifies the buildsystem (i.e. we always include cpu_features.c)
- get rid of the simd_stub file.
Bug: 1032721
Change-Id: Ic93472d3337bc2cbe092d4cf8fbe4b31b1ceca6d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1976820
Reviewed-by: Chris Blume <cblume@chromium.org>
Reviewed-by: Adenilson Cavalcanti <cavalcantii@chromium.org>
Commit-Queue: Adenilson Cavalcanti <cavalcantii@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#727038}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 6f7e5e79cefe982ad84a88927565a88db2e592be
Diffstat (limited to 'deflate.c')
-rw-r--r-- | deflate.c | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -50,7 +50,7 @@ /* @(#) $Id$ */ #include <assert.h> #include "deflate.h" -#include "x86.h" +#include "cpu_features.h" #include "contrib/optimizations/insert_string.h" #if (defined(__ARM_NEON__) || defined(__ARM_NEON)) @@ -244,10 +244,8 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, // for all wrapper formats (e.g. RAW, ZLIB, GZIP). // Feature detection is not triggered while using RAW mode (i.e. we never // call crc32() with a NULL buffer). -#if defined(CRC32_ARMV8_CRC32) - arm_check_features(); -#elif defined(CRC32_SIMD_SSE42_PCLMUL) - x86_check_features(); +#if defined(CRC32_ARMV8_CRC32) || defined(CRC32_SIMD_SSE42_PCLMUL) + cpu_check_features(); #endif if (version == Z_NULL || version[0] != my_version[0] || @@ -1519,11 +1517,12 @@ local void fill_window_c(deflate_state *s); local void fill_window(deflate_state *s) { +#ifdef ADLER32_SIMD_SSSE3 if (x86_cpu_enable_simd) { fill_window_sse(s); return; } - +#endif fill_window_c(s); } |