From 23873bfeb22b77bbbbddb425c3b87c59312554ee Mon Sep 17 00:00:00 2001 From: raisinten Date: Wed, 30 Dec 2020 20:13:15 +0530 Subject: [PATCH 1/5] build: enable sse4.2 in zlib Fixes: https://github.com/nodejs/node/issues/36678 --- deps/zlib/contrib/optimizations/insert_string.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/deps/zlib/contrib/optimizations/insert_string.h b/deps/zlib/contrib/optimizations/insert_string.h index 69eee3dc9e91fc..e4d23434b21882 100644 --- a/deps/zlib/contrib/optimizations/insert_string.h +++ b/deps/zlib/contrib/optimizations/insert_string.h @@ -16,6 +16,9 @@ // clang-format off #if defined(CRC32_SIMD_SSE42_PCLMUL) /* Required to make MSVC bot build pass. */ + // TODO(raisinten): When https://github.com/nodejs/node/pull/33044 lands, + // remove the next line and add `-msse4.2` to the command line options. + #pragma GCC target ("sse4.2") #include #if defined(__GNUC__) || defined(__clang__) #undef TARGET_CPU_WITH_CRC From c5e62b42f05cc7e3fe0e2617871f56b62d81bf68 Mon Sep 17 00:00:00 2001 From: raisinten Date: Fri, 1 Jan 2021 19:47:07 +0530 Subject: [PATCH 2/5] build: enable ssse3 in zlib Fixes: https://github.com/nodejs/node/issues/36678 --- deps/zlib/adler32_simd.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/deps/zlib/adler32_simd.c b/deps/zlib/adler32_simd.c index f8b07297b93840..1cd571bda52f2a 100644 --- a/deps/zlib/adler32_simd.c +++ b/deps/zlib/adler32_simd.c @@ -54,6 +54,9 @@ #define __attribute__() #endif +// TODO(raisinten): When https://github.com/nodejs/node/pull/33044 lands, +// remove the next line and add `-mssse3` to the command line options. +#pragma GCC target ("ssse3") #include __attribute__((target("ssse3"))) From b35ae3ba202e78081b1a37acbab774c01f87050d Mon Sep 17 00:00:00 2001 From: raisinten Date: Fri, 1 Jan 2021 19:52:42 +0530 Subject: [PATCH 3/5] build: add TODO comments to add -msse2 for zlib Refs: https://github.com/nodejs/node/pull/35679 --- deps/zlib/contrib/optimizations/chunkcopy.h | 2 ++ deps/zlib/fill_window_sse.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/deps/zlib/contrib/optimizations/chunkcopy.h b/deps/zlib/contrib/optimizations/chunkcopy.h index 8bcdadad05a817..944942c8f1a17a 100644 --- a/deps/zlib/contrib/optimizations/chunkcopy.h +++ b/deps/zlib/contrib/optimizations/chunkcopy.h @@ -29,6 +29,8 @@ #include typedef uint8x16_t z_vec128i_t; #elif defined(INFLATE_CHUNK_SIMD_SSE2) +// TODO(raisinten): When https://github.com/nodejs/node/pull/33044 lands, +// remove the next line and add `-msse2` to the command line options. #pragma GCC target ("sse2") #include typedef __m128i z_vec128i_t; diff --git a/deps/zlib/fill_window_sse.c b/deps/zlib/fill_window_sse.c index e19154bc14d238..8e5def24a36968 100644 --- a/deps/zlib/fill_window_sse.c +++ b/deps/zlib/fill_window_sse.c @@ -9,6 +9,8 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ +// TODO(raisinten): When https://github.com/nodejs/node/pull/33044 lands, +// remove the next line and add `-msse2` to the command line options. #pragma GCC target ("sse2") #include #include "deflate.h" From 4289461a80dcc8f5d88a3e407006baee98e8a919 Mon Sep 17 00:00:00 2001 From: raisinten Date: Sat, 2 Jan 2021 15:10:29 +0530 Subject: [PATCH 4/5] build: enable pclmul in zlib --- deps/zlib/crc32_simd.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/deps/zlib/crc32_simd.c b/deps/zlib/crc32_simd.c index 27481847e97b90..d7ebe5d65ed705 100644 --- a/deps/zlib/crc32_simd.c +++ b/deps/zlib/crc32_simd.c @@ -20,6 +20,11 @@ * V. Gopal, E. Ozturk, et al., 2009, http://intel.ly/2ySEwL0 */ +// TODO(raisinten): When https://github.com/nodejs/node/pull/33044 lands, +// remove the next line and add `-msse4.2` and `-mpclmul` to the +// command line options. +#pragma GCC target ("sse4.2", "pclmul") + #include #include #include From bc657ec3f417631fd90300638f37113af31db31f Mon Sep 17 00:00:00 2001 From: raisinten Date: Sat, 2 Jan 2021 18:46:24 +0530 Subject: [PATCH 5/5] build: enable sse4.2 and pclmul in zlib --- deps/zlib/crc_folding.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/deps/zlib/crc_folding.c b/deps/zlib/crc_folding.c index 54f4b5c9401089..4e19626da5e9ad 100644 --- a/deps/zlib/crc_folding.c +++ b/deps/zlib/crc_folding.c @@ -18,6 +18,11 @@ #include "deflate.h" +// TODO(raisinten): When https://github.com/nodejs/node/pull/33044 lands, +// remove the next line and add `-msse4.2` and `-mpclmul` to the +// command line options. +#pragma GCC target ("sse4.2", "pclmul") + #include #include #include