Skip to content

Commit 7a7f438

Browse files
nodejs-github-bottargos
authored andcommitted
deps: update zlib to 1.3.0.1-motley-209717d
PR-URL: #53156 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent 710cf77 commit 7a7f438

File tree

4 files changed

+28
-22
lines changed

4 files changed

+28
-22
lines changed

deps/zlib/BUILD.gn

+9-7
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,13 @@ if (use_arm_neon_optimizations) {
151151
if (!is_win && !is_clang) {
152152
assert(!use_thin_lto,
153153
"ThinLTO fails mixing different module-level targets")
154-
cflags_c = [ "-march=armv8-a+aes+crc" ]
154+
if (current_cpu == "arm64") {
155+
cflags_c = [ "-march=armv8-a+aes+crc" ]
156+
} else if (current_cpu == "arm") {
157+
cflags_c = [ "-march=armv8-a+crc" ]
158+
} else {
159+
assert(false, "Unexpected cpu: $current_cpu")
160+
}
155161
}
156162

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

480486
if (is_clang) {
481-
cflags = [
482-
"-Wno-incompatible-pointer-types-discards-qualifiers",
483-
]
487+
cflags = [ "-Wno-incompatible-pointer-types-discards-qualifiers" ]
484488
}
485489

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

502506
if (is_clang) {
503-
cflags = [
504-
"-Wno-incompatible-pointer-types-discards-qualifiers",
505-
]
507+
cflags = [ "-Wno-incompatible-pointer-types-discards-qualifiers" ]
506508
}
507509

508510
if (!is_debug) {

deps/zlib/crc32.c

+16-13
Original file line numberDiff line numberDiff line change
@@ -700,24 +700,29 @@ local z_word_t crc_word_big(z_word_t data) {
700700
/* ========================================================================= */
701701
unsigned long ZEXPORT crc32_z(unsigned long crc, const unsigned char FAR *buf,
702702
z_size_t len) {
703+
704+
/* If no optimizations are enabled, do it as canonical zlib. */
705+
#if !defined(CRC32_SIMD_SSE42_PCLMUL) && !defined(CRC32_ARMV8_CRC32) && \
706+
!defined(RISCV_RVV) && !defined(CRC32_SIMD_AVX512_PCLMUL)
707+
if (buf == Z_NULL) {
708+
return 0UL;
709+
}
710+
#else
703711
/*
704712
* zlib convention is to call crc32(0, NULL, 0); before making
705713
* calls to crc32(). So this is a good, early (and infrequent)
706714
* place to cache CPU features if needed for those later, more
707715
* interesting crc32() calls.
708716
*/
709-
#if defined(CRC32_SIMD_SSE42_PCLMUL) || defined(CRC32_ARMV8_CRC32) \
710-
|| defined(RISCV_RVV)
711-
/*
712-
* Since this routine can be freely used, check CPU features here.
713-
*/
714717
if (buf == Z_NULL) {
715-
if (!len) /* Assume user is calling crc32(0, NULL, 0); */
718+
if (!len)
716719
cpu_check_features();
717720
return 0UL;
718721
}
719-
720722
#endif
723+
/* If AVX-512 is enabled, we will use it for longer inputs and fallback
724+
* to SSE4.2 and eventually the portable implementation to handle the tail.
725+
*/
721726
#if defined(CRC32_SIMD_AVX512_PCLMUL)
722727
if (x86_cpu_enable_avx512 && len >= Z_CRC32_AVX512_MINIMUM_LENGTH) {
723728
/* crc32 64-byte chunks */
@@ -730,7 +735,8 @@ unsigned long ZEXPORT crc32_z(unsigned long crc, const unsigned char FAR *buf,
730735
/* Fall into the default crc32 for the remaining data. */
731736
buf += chunk_size;
732737
}
733-
#elif defined(CRC32_SIMD_SSE42_PCLMUL)
738+
#endif
739+
#if defined(CRC32_SIMD_SSE42_PCLMUL)
734740
if (x86_cpu_enable_simd && len >= Z_CRC32_SSE42_MINIMUM_LENGTH) {
735741
/* crc32 16-byte chunks */
736742
z_size_t chunk_size = len & ~Z_CRC32_SSE42_CHUNKSIZE_MASK;
@@ -758,11 +764,8 @@ unsigned long ZEXPORT crc32_z(unsigned long crc, const unsigned char FAR *buf,
758764
buf += chunk_size;
759765
}
760766
#endif
761-
return armv8_crc32_little(buf, len, crc); /* Armv8@32bit or tail. */
762-
}
763-
#else
764-
if (buf == Z_NULL) {
765-
return 0UL;
767+
/* This is scalar and self contained, used on Armv8@32bit or tail. */
768+
return armv8_crc32_little(buf, len, crc);
766769
}
767770
#endif /* CRC32_SIMD */
768771

deps/zlib/crc32_simd.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,8 @@ uint32_t ZLIB_INTERNAL crc32_avx512_simd_( /* AVX512+PCLMUL */
200200
return _mm_extract_epi32(a1, 1);
201201
}
202202

203-
#elif defined(CRC32_SIMD_SSE42_PCLMUL)
203+
#endif
204+
#if defined(CRC32_SIMD_SSE42_PCLMUL)
204205

205206
/*
206207
* crc32_sse42_simd_(): compute the crc32 of the buffer, where the buffer

src/zlib_version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
// Refer to tools/dep_updaters/update-zlib.sh
33
#ifndef SRC_ZLIB_VERSION_H_
44
#define SRC_ZLIB_VERSION_H_
5-
#define ZLIB_VERSION "1.3.0.1-motley-4f653ff"
5+
#define ZLIB_VERSION "1.3.0.1-motley-209717d"
66
#endif // SRC_ZLIB_VERSION_H_

0 commit comments

Comments
 (0)