Skip to content

Commit

Permalink
deps: update zlib to 1.3.0.1-motley-209717d
Browse files Browse the repository at this point in the history
PR-URL: #53156
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Marco Ippolito <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Ulises Gascón <[email protected]>
Reviewed-By: Rafael Gonzaga <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
  • Loading branch information
nodejs-github-bot authored and aduh95 committed Nov 3, 2024
1 parent 033f1e2 commit 569a739
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 21 deletions.
16 changes: 9 additions & 7 deletions deps/zlib/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,13 @@ if (use_arm_neon_optimizations) {
if (!is_win && !is_clang) {
assert(!use_thin_lto,
"ThinLTO fails mixing different module-level targets")
cflags_c = [ "-march=armv8-a+aes+crc" ]
if (current_cpu == "arm64") {
cflags_c = [ "-march=armv8-a+aes+crc" ]
} else if (current_cpu == "arm") {
cflags_c = [ "-march=armv8-a+crc" ]
} else {
assert(false, "Unexpected cpu: $current_cpu")
}
}

sources = [
Expand Down Expand Up @@ -478,9 +484,7 @@ if (!is_win || target_os != "winuwp") {
sources = [ "contrib/minizip/minizip.c" ]

if (is_clang) {
cflags = [
"-Wno-incompatible-pointer-types-discards-qualifiers",
]
cflags = [ "-Wno-incompatible-pointer-types-discards-qualifiers" ]
}

if (!is_debug) {
Expand All @@ -500,9 +504,7 @@ if (!is_win || target_os != "winuwp") {
sources = [ "contrib/minizip/miniunz.c" ]

if (is_clang) {
cflags = [
"-Wno-incompatible-pointer-types-discards-qualifiers",
]
cflags = [ "-Wno-incompatible-pointer-types-discards-qualifiers" ]
}

if (!is_debug) {
Expand Down
29 changes: 16 additions & 13 deletions deps/zlib/crc32.c
Original file line number Diff line number Diff line change
Expand Up @@ -700,24 +700,29 @@ local z_word_t crc_word_big(z_word_t data) {
/* ========================================================================= */
unsigned long ZEXPORT crc32_z(unsigned long crc, const unsigned char FAR *buf,
z_size_t len) {

/* If no optimizations are enabled, do it as canonical zlib. */
#if !defined(CRC32_SIMD_SSE42_PCLMUL) && !defined(CRC32_ARMV8_CRC32) && \
!defined(RISCV_RVV) && !defined(CRC32_SIMD_AVX512_PCLMUL)
if (buf == Z_NULL) {
return 0UL;
}
#else
/*
* zlib convention is to call crc32(0, NULL, 0); before making
* calls to crc32(). So this is a good, early (and infrequent)
* place to cache CPU features if needed for those later, more
* interesting crc32() calls.
*/
#if defined(CRC32_SIMD_SSE42_PCLMUL) || defined(CRC32_ARMV8_CRC32) \
|| defined(RISCV_RVV)
/*
* Since this routine can be freely used, check CPU features here.
*/
if (buf == Z_NULL) {
if (!len) /* Assume user is calling crc32(0, NULL, 0); */
if (!len)
cpu_check_features();
return 0UL;
}

#endif
/* If AVX-512 is enabled, we will use it for longer inputs and fallback
* to SSE4.2 and eventually the portable implementation to handle the tail.
*/
#if defined(CRC32_SIMD_AVX512_PCLMUL)
if (x86_cpu_enable_avx512 && len >= Z_CRC32_AVX512_MINIMUM_LENGTH) {
/* crc32 64-byte chunks */
Expand All @@ -730,7 +735,8 @@ unsigned long ZEXPORT crc32_z(unsigned long crc, const unsigned char FAR *buf,
/* Fall into the default crc32 for the remaining data. */
buf += chunk_size;
}
#elif defined(CRC32_SIMD_SSE42_PCLMUL)
#endif
#if defined(CRC32_SIMD_SSE42_PCLMUL)
if (x86_cpu_enable_simd && len >= Z_CRC32_SSE42_MINIMUM_LENGTH) {
/* crc32 16-byte chunks */
z_size_t chunk_size = len & ~Z_CRC32_SSE42_CHUNKSIZE_MASK;
Expand Down Expand Up @@ -758,11 +764,8 @@ unsigned long ZEXPORT crc32_z(unsigned long crc, const unsigned char FAR *buf,
buf += chunk_size;
}
#endif
return armv8_crc32_little(buf, len, crc); /* Armv8@32bit or tail. */
}
#else
if (buf == Z_NULL) {
return 0UL;
/* This is scalar and self contained, used on Armv8@32bit or tail. */
return armv8_crc32_little(buf, len, crc);
}
#endif /* CRC32_SIMD */

Expand Down
3 changes: 2 additions & 1 deletion deps/zlib/crc32_simd.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@ uint32_t ZLIB_INTERNAL crc32_avx512_simd_( /* AVX512+PCLMUL */
return _mm_extract_epi32(a1, 1);
}

#elif defined(CRC32_SIMD_SSE42_PCLMUL)
#endif
#if defined(CRC32_SIMD_SSE42_PCLMUL)

/*
* crc32_sse42_simd_(): compute the crc32 of the buffer, where the buffer
Expand Down

0 comments on commit 569a739

Please sign in to comment.