GeezerVison is showing github.com — deps: fix zlib compilation for CPUs without SIMD features · nodejs/node@4874db7
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: deps/zlib/adler32_simd.c +4Lines changed: 4 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 50 | 50 | #define NMAX 5552 | 51 | 51 |
| 52 | 52 | #if defined(ADLER32_SIMD_SSSE3) | | 53 | +#ifndef __GNUC__ | | 54 | +#define __attribute__() | | 55 | +#endif | 53 | 56 |
| 54 | 57 | #include <tmmintrin.h> | 55 | 58 |
| | 59 | +__attribute__((target("ssse3"))) | 56 | 60 | uint32_t ZLIB_INTERNAL adler32_simd_( /* SSSE3 */ | 57 | 61 | uint32_t adler, | 58 | 62 | const unsigned char *buf, | |
Collapse file Copy file name to clipboardExpand all lines: deps/zlib/crc32_simd.c +4Lines changed: 4 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 8 | 8 | #include "crc32_simd.h" | 9 | 9 |
| 10 | 10 | #if defined(CRC32_SIMD_SSE42_PCLMUL) | | 11 | +#ifndef __GNUC__ | | 12 | +#define __attribute__() | | 13 | +#endif | 11 | 14 |
| 12 | 15 | /* | 13 | 16 | * crc32_sse42_simd_(): compute the crc32 of the buffer, where the buffer | | 21 | 24 | #include <smmintrin.h> | 22 | 25 | #include <wmmintrin.h> | 23 | 26 |
| | 27 | +__attribute__((target("sse4.2,pclmul"))) | 24 | 28 | uint32_t ZLIB_INTERNAL crc32_sse42_simd_( /* SSE4.2+PCLMUL */ | 25 | 29 | const unsigned char *buf, | 26 | 30 | z_size_t len, | |
Collapse file Copy file name to clipboardExpand all lines: deps/zlib/crc_folding.c +12Lines changed: 12 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 23 | 23 | #include <immintrin.h> | 24 | 24 | #include <wmmintrin.h> | 25 | 25 |
| | 26 | +#ifndef __GNUC__ | | 27 | +#define __attribute__() | | 28 | +#endif | | 29 | + | 26 | 30 | #define CRC_LOAD(s) \ | 27 | 31 | do { \ | 28 | 32 | __m128i xmm_crc0 = _mm_loadu_si128((__m128i *)s->crc0 + 0);\ | | 39 | 43 | _mm_storeu_si128((__m128i *)s->crc0 + 4, xmm_crc_part);\ | 40 | 44 | } while (0); | 41 | 45 |
| | 46 | +__attribute__((target("sse4.2,pclmul"))) | 42 | 47 | ZLIB_INTERNAL void crc_fold_init(deflate_state *const s) | 43 | 48 | { | 44 | 49 | CRC_LOAD(s) | @@ -53,6 +58,7 @@ ZLIB_INTERNAL void crc_fold_init(deflate_state *const s) | 53 | 58 | s->strm->adler = 0; | 54 | 59 | } | 55 | 60 |
| | 61 | +__attribute__((target("sse4.2,pclmul"))) | 56 | 62 | local void fold_1(deflate_state *const s, | 57 | 63 | __m128i *xmm_crc0, __m128i *xmm_crc1, | 58 | 64 | __m128i *xmm_crc2, __m128i *xmm_crc3) | @@ -79,6 +85,7 @@ local void fold_1(deflate_state *const s, | 79 | 85 | *xmm_crc3 = _mm_castps_si128(ps_res); | 80 | 86 | } | 81 | 87 |
| | 88 | +__attribute__((target("sse4.2,pclmul"))) | 82 | 89 | local void fold_2(deflate_state *const s, | 83 | 90 | __m128i *xmm_crc0, __m128i *xmm_crc1, | 84 | 91 | __m128i *xmm_crc2, __m128i *xmm_crc3) | @@ -113,6 +120,7 @@ local void fold_2(deflate_state *const s, | 113 | 120 | *xmm_crc3 = _mm_castps_si128(ps_res31); | 114 | 121 | } | 115 | 122 |
| | 123 | +__attribute__((target("sse4.2,pclmul"))) | 116 | 124 | local void fold_3(deflate_state *const s, | 117 | 125 | __m128i *xmm_crc0, __m128i *xmm_crc1, | 118 | 126 | __m128i *xmm_crc2, __m128i *xmm_crc3) | @@ -153,6 +161,7 @@ local void fold_3(deflate_state *const s, | 153 | 161 | *xmm_crc3 = _mm_castps_si128(ps_res32); | 154 | 162 | } | 155 | 163 |
| | 164 | +__attribute__((target("sse4.2,pclmul"))) | 156 | 165 | local void fold_4(deflate_state *const s, | 157 | 166 | __m128i *xmm_crc0, __m128i *xmm_crc1, | 158 | 167 | __m128i *xmm_crc2, __m128i *xmm_crc3) | @@ -219,6 +228,7 @@ local const unsigned zalign(32) pshufb_shf_table[60] = { | 219 | 228 | 0x0201008f,0x06050403,0x0a090807,0x0e0d0c0b /* shl 1 (16 -15)/shr15*/ | 220 | 229 | }; | 221 | 230 |
| | 231 | +__attribute__((target("sse4.2,pclmul"))) | 222 | 232 | local void partial_fold(deflate_state *const s, const size_t len, | 223 | 233 | __m128i *xmm_crc0, __m128i *xmm_crc1, | 224 | 234 | __m128i *xmm_crc2, __m128i *xmm_crc3, | @@ -269,6 +279,7 @@ local void partial_fold(deflate_state *const s, const size_t len, | 269 | 279 | *xmm_crc3 = _mm_castps_si128(ps_res); | 270 | 280 | } | 271 | 281 |
| | 282 | +__attribute__((target("sse4.2,pclmul"))) | 272 | 283 | ZLIB_INTERNAL void crc_fold_copy(deflate_state *const s, | 273 | 284 | unsigned char *dst, const unsigned char *src, long len) | 274 | 285 | { | @@ -425,6 +436,7 @@ local const unsigned zalign(16) crc_mask2[4] = { | 425 | 436 | 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF | 426 | 437 | }; | 427 | 438 |
| | 439 | +__attribute__((target("sse4.2,pclmul"))) | 428 | 440 | unsigned ZLIB_INTERNAL crc_fold_512to32(deflate_state *const s) | 429 | 441 | { | 430 | 442 | const __m128i xmm_mask = _mm_load_si128((__m128i *)crc_mask); | |
Collapse file Copy file name to clipboardExpand all lines: deps/zlib/zlib.gyp -14Lines changed: 0 additions & 14 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 91 | 91 | 'x86.c', | 92 | 92 | ], | 93 | 93 | 'conditions': [ | 94 | | - ['OS!="win" or llvm_version!="0.0"', { | 95 | | - 'cflags': [ | 96 | | - '-mssse3', | 97 | | - '-msse4.2', | 98 | | - '-mpclmul', | 99 | | - ], | 100 | | - 'xcode_settings': { | 101 | | - 'OTHER_CFLAGS': [ | 102 | | - '-mssse3', | 103 | | - '-msse4.2', | 104 | | - '-mpclmul', | 105 | | - ], | 106 | | - }, | 107 | | - }], | 108 | 94 | ['target_arch=="x64"', { | 109 | 95 | 'defines': [ 'INFLATE_CHUNK_READ_64LE' ], | 110 | 96 | }], | |
|