[zlib] Wrap deflate crc_folding and fill_window_sse features in guards
Wrap these deflate features in their #ifdef BUILD.gn feature guards to
prevent BUILD.gn errors and ease code searching.
Move the Intel-specific <immintrin.h> include file for fill_window_sse
inside of it feature guard (to allow an #elif for fill_window_arm that
may arrive here in future, maybe).
Bug: 1072308
Change-Id: Ife15d073d096dde518794d3141ce19b89aedd66b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2156565
Commit-Queue: Noel Gordon <noel@chromium.org>
Reviewed-by: Adenilson Cavalcanti <cavalcantii@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#761282}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: b8f74959ed81246670d2f54a0cef32b245b88336
diff --git a/crc_folding.c b/crc_folding.c
index 48d7774..c693a7e 100644
--- a/crc_folding.c
+++ b/crc_folding.c
@@ -18,6 +18,8 @@
#include "deflate.h"
+#ifdef CRC32_SIMD_SSE42_PCLMUL
+
#include <inttypes.h>
#include <emmintrin.h>
#include <immintrin.h>
@@ -491,3 +493,5 @@
return ~crc;
CRC_SAVE(s)
}
+
+#endif /* CRC32_SIMD_SSE42_PCLMUL */
diff --git a/fill_window_sse.c b/fill_window_sse.c
index ed1e5d1..a841c99 100644
--- a/fill_window_sse.c
+++ b/fill_window_sse.c
@@ -9,9 +9,10 @@
* For conditions of distribution and use, see copyright notice in zlib.h
*/
-#include <immintrin.h>
#include "deflate.h"
+#ifdef DEFLATE_FILL_WINDOW_SSE2
+
#define UPDATE_HASH(s,h,i) \
{\
if (s->level < 6) { \
@@ -28,6 +29,8 @@
extern int deflate_read_buf OF((z_streamp strm, Bytef *buf, unsigned size));
+#include <immintrin.h>
+
void fill_window_sse(deflate_state *s)
{
const __m128i xmm_wsize = _mm_set1_epi16(s->w_size);
@@ -175,3 +178,5 @@
Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,
"not enough room for search");
}
+
+#endif /* DEFLATE_FILL_WINDOW_SSE2 */