Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions deps/zlib/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,6 @@ source_set("zlib_adler32_simd") {
"adler32_simd.c",
"adler32_simd.h",
]

if (!is_win || is_clang) {
cflags = [ "-mssse3" ]
}
}

if (use_arm_neon_optimizations) {
Expand Down Expand Up @@ -234,13 +230,6 @@ source_set("zlib_crc32_simd") {
"crc32_simd.h",
"crc_folding.c",
]

if (!is_win || is_clang) {
cflags = [
"-msse4.2",
"-mpclmul",
]
}
}

configs += [ ":zlib_internal_config" ]
Expand Down
3 changes: 0 additions & 3 deletions deps/zlib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,6 @@ if (ENABLE_SIMD_OPTIMIZATIONS)
add_definitions(-DCRC32_SIMD_SSE42_PCLMUL)
if (ENABLE_SIMD_AVX512)
add_definitions(-DCRC32_SIMD_AVX512_PCLMUL)
add_compile_options(-mvpclmulqdq -msse2 -mavx512f -mpclmul)
else()
add_compile_options(-msse4.2 -mpclmul)
endif()
add_definitions(-DDEFLATE_SLIDE_HASH_SSE2)
# Required by CPU features detection code.
Expand Down
2 changes: 1 addition & 1 deletion deps/zlib/adler32_simd.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

#include <tmmintrin.h>

#if defined(__GNUC__)
#if defined(__GNUC__) || defined(__clang__)
__attribute__((__target__("ssse3")))
#endif
uint32_t ZLIB_INTERNAL adler32_simd_( /* SSSE3 */
Expand Down
5 changes: 5 additions & 0 deletions deps/zlib/cpu_features.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,11 @@ static void _cpu_check_features(void)
#include <immintrin.h>
#include <xsaveintrin.h>
#endif
/* _xgetbv() below needs the xsave ISA. Annotate it here so the build does not
* need -mxsave. */
#if defined(CRC32_SIMD_AVX512_PCLMUL) && (defined(__GNUC__) || defined(__clang__))
__attribute__((__target__("xsave")))
#endif
static void _cpu_check_features(void)
{
int x86_cpu_has_sse2;
Expand Down
6 changes: 6 additions & 0 deletions deps/zlib/crc32_simd.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
#include <wmmintrin.h>
#include <immintrin.h>

#if defined(__GNUC__) || defined(__clang__)
__attribute__((__target__("avx512f,avx512vl,vpclmulqdq")))
#endif
uint32_t ZLIB_INTERNAL crc32_avx512_simd_( /* AVX512+PCLMUL */
const unsigned char *buf,
z_size_t len,
Expand Down Expand Up @@ -212,6 +215,9 @@ uint32_t ZLIB_INTERNAL crc32_avx512_simd_( /* AVX512+PCLMUL */
#include <smmintrin.h>
#include <wmmintrin.h>

#if defined(__GNUC__) || defined(__clang__)
__attribute__((__target__("sse4.2,pclmul")))
#endif
uint32_t ZLIB_INTERNAL crc32_sse42_simd_( /* SSE4.2+PCLMUL */
const unsigned char *buf,
z_size_t len,
Expand Down
14 changes: 14 additions & 0 deletions deps/zlib/crc_folding.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
#include <immintrin.h>
#include <wmmintrin.h>

#if defined(__GNUC__) || defined(__clang__)
#define TARGET_SSE42_PCLMUL __attribute__((__target__("sse4.2,pclmul")))
#else
#define TARGET_SSE42_PCLMUL
#endif

#define CRC_LOAD(s) \
do { \
__m128i xmm_crc0 = _mm_loadu_si128((__m128i *)s->crc0 + 0);\
Expand All @@ -41,6 +47,7 @@
_mm_storeu_si128((__m128i *)s->crc0 + 4, xmm_crc_part);\
} while (0);

TARGET_SSE42_PCLMUL
ZLIB_INTERNAL void crc_fold_init(deflate_state *const s)
{
CRC_LOAD(s)
Expand All @@ -55,6 +62,7 @@ ZLIB_INTERNAL void crc_fold_init(deflate_state *const s)
s->strm->adler = 0;
}

TARGET_SSE42_PCLMUL
local void fold_1(deflate_state *const s,
__m128i *xmm_crc0, __m128i *xmm_crc1,
__m128i *xmm_crc2, __m128i *xmm_crc3)
Expand All @@ -81,6 +89,7 @@ local void fold_1(deflate_state *const s,
*xmm_crc3 = _mm_castps_si128(ps_res);
}

TARGET_SSE42_PCLMUL
local void fold_2(deflate_state *const s,
__m128i *xmm_crc0, __m128i *xmm_crc1,
__m128i *xmm_crc2, __m128i *xmm_crc3)
Expand Down Expand Up @@ -115,6 +124,7 @@ local void fold_2(deflate_state *const s,
*xmm_crc3 = _mm_castps_si128(ps_res31);
}

TARGET_SSE42_PCLMUL
local void fold_3(deflate_state *const s,
__m128i *xmm_crc0, __m128i *xmm_crc1,
__m128i *xmm_crc2, __m128i *xmm_crc3)
Expand Down Expand Up @@ -155,6 +165,7 @@ local void fold_3(deflate_state *const s,
*xmm_crc3 = _mm_castps_si128(ps_res32);
}

TARGET_SSE42_PCLMUL
local void fold_4(deflate_state *const s,
__m128i *xmm_crc0, __m128i *xmm_crc1,
__m128i *xmm_crc2, __m128i *xmm_crc3)
Expand Down Expand Up @@ -221,6 +232,7 @@ local const unsigned zalign(32) pshufb_shf_table[60] = {
0x0201008f,0x06050403,0x0a090807,0x0e0d0c0b /* shl 1 (16 -15)/shr15*/
};

TARGET_SSE42_PCLMUL
local void partial_fold(deflate_state *const s, const size_t len,
__m128i *xmm_crc0, __m128i *xmm_crc1,
__m128i *xmm_crc2, __m128i *xmm_crc3,
Expand Down Expand Up @@ -271,6 +283,7 @@ local void partial_fold(deflate_state *const s, const size_t len,
*xmm_crc3 = _mm_castps_si128(ps_res);
}

TARGET_SSE42_PCLMUL
ZLIB_INTERNAL void crc_fold_copy(deflate_state *const s,
unsigned char *dst, const unsigned char *src, long len)
{
Expand Down Expand Up @@ -427,6 +440,7 @@ local const unsigned zalign(16) crc_mask2[4] = {
0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF
};

TARGET_SSE42_PCLMUL
unsigned ZLIB_INTERNAL crc_fold_512to32(deflate_state *const s)
{
const __m128i xmm_mask = _mm_load_si128((__m128i *)crc_mask);
Expand Down
2 changes: 1 addition & 1 deletion src/zlib_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
// Refer to tools/dep_updaters/update-zlib.sh
#ifndef SRC_ZLIB_VERSION_H_
#define SRC_ZLIB_VERSION_H_
#define ZLIB_VERSION "1.3.2.1-motley-8002e91"
#define ZLIB_VERSION "1.3.2.1-motley-0165316"
#endif // SRC_ZLIB_VERSION_H_
Loading