diff --git a/SOURCES/zlib-1.2.11-x86_64-accelrated-slide-hash.patch b/SOURCES/zlib-1.2.11-x86_64-accelrated-slide-hash.patch index f4039af..44ec115 100644 --- a/SOURCES/zlib-1.2.11-x86_64-accelrated-slide-hash.patch +++ b/SOURCES/zlib-1.2.11-x86_64-accelrated-slide-hash.patch @@ -1,35 +1,27 @@ ---- a/configure 2023-03-01 08:14:25.954898388 +0200 -+++ b/configure 2023-03-01 08:24:45.239014676 +0200 -@@ -115,6 +115,8 @@ +--- a/configure ++++ b/configure +@@ -115,6 +115,7 @@ echo ' [--static] [--64] [--libdir=LIBDIR] [--sharedlibdir=LIBDIR]' | tee -a configure.log echo ' [--includedir=INCLUDEDIR] [--archs="-arch i386 -arch x86_64"]' | tee -a configure.log echo ' [--dfltcc]' | tee -a configure.log -+ echo ' [--enable-sse-slide]' | tee -a configure.log -+ echo ' [--enable-avx2-slide]' | tee -a configure.log ++ echo ' [--simd-slide-hash]' | tee -a configure.log exit 0 ;; -p*=* | --prefix=*) prefix=`echo $1 | sed 's/.*=//'`; shift ;; -e*=* | --eprefix=*) exec_prefix=`echo $1 | sed 's/.*=//'`; shift ;; -@@ -144,6 +146,18 @@ +@@ -144,6 +145,11 @@ PIC_OBJC="$PIC_OBJC dfltcc.lo" shift ;; -+ --enable-sse-slide) -+ CFLAGS="$CFLAGS -DUSE_SSE_SLIDE" -+ OBJC="$OBJC slide_sse.o" -+ PIC_OBJC="$PIC_OBJC slide_sse.lo" -+ shift -+ ;; -+ --enable-avx2-slide) -+ CFLAGS="$CFLAGS -DUSE_AVX2_SLIDE" -+ OBJC="$OBJC slide_avx2.o" -+ PIC_OBJC="$PIC_OBJC slide_avx2.lo" ++ --simd-slide-hash) ++ OBJC="$OBJC slide_avx2.o slide_sse.o" ++ PIC_OBJC="$PIC_OBJC slide_avx2.lo slide_sse.lo" + shift + ;; *) echo "unknown option: $1" | tee -a configure.log echo "$0 --help for help" | tee -a configure.log ---- a/Makefile.in 2023-03-01 17:50:52.047078672 +0200 -+++ b/Makefile.in 2023-03-01 17:53:21.889564523 +0200 +--- a/Makefile.in ++++ b/Makefile.in @@ -152,6 +152,22 @@ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/dfltcc.o $(SRCDIR)contrib/s390/dfltcc.c -@mv objs/dfltcc.o $@ @@ -53,49 +45,6 @@ crc32_test.o: $(SRCDIR)test/crc32_test.c $(SRCDIR)zlib.h zconf.h $(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/crc32_test.c ---- a/deflate.c 2023-03-01 14:04:13.871373364 +0200 -+++ b/deflate.c 2023-03-01 14:15:35.345276070 +0200 -@@ -90,6 +90,13 @@ - - local int deflateStateCheck OF((z_streamp strm)); - local void slide_hash OF((deflate_state *s)); -+local void slide_hash_c OF((deflate_state *s)); -+#ifdef USE_SSE_SLIDE -+extern void slide_hash_sse(deflate_state *s); -+#endif -+#ifdef USE_AVX2_SLIDE -+extern void slide_hash_avx2(deflate_state *s); -+#endif - local void fill_window OF((deflate_state *s)); - local block_state deflate_stored OF((deflate_state *s, int flush)); - local block_state deflate_fast OF((deflate_state *s, int flush)); -@@ -212,7 +219,7 @@ - * bit values at the expense of memory usage). We slide even when level == 0 to - * keep the hash table consistent if we switch back to level > 0 later. - */ --local void slide_hash(s) -+local void slide_hash_c(s) - deflate_state *s; - { - unsigned n, m; -@@ -238,6 +245,17 @@ - #endif - } - -+local void slide_hash(deflate_state *s) -+{ -+#ifdef USE_SSE_SLIDE -+ slide_hash_sse(s); -+#endif -+#ifdef USE_AVX2_SLIDE -+ slide_hash_avx2(s); -+#endif -+ slide_hash_c(s); -+} -+ - /* ========================================================================= */ - int ZEXPORT deflateInit_(strm, level, version, stream_size) - z_streamp strm; --- /dev/null +++ b/slide_sse.c @@ -0,0 +1,47 @@ @@ -193,3 +142,38 @@ + } while (n > 0); +#endif +} +--- a/deflate.c ++++ b/deflate.c +@@ -90,6 +90,9 @@ + + local int deflateStateCheck OF((z_streamp strm)); + local void slide_hash OF((deflate_state *s)); ++local void slide_hash_c OF((deflate_state *s)); ++extern void slide_hash_sse (deflate_state *s); ++extern void slide_hash_avx2 (deflate_state *s); + local void fill_window OF((deflate_state *s)); + local block_state deflate_stored OF((deflate_state *s, int flush)); + local block_state deflate_fast OF((deflate_state *s, int flush)); +@@ -212,7 +215,7 @@ + * bit values at the expense of memory usage). We slide even when level == 0 to + * keep the hash table consistent if we switch back to level > 0 later. + */ +-local void slide_hash(s) ++local void slide_hash_c(s) + deflate_state *s; + { + unsigned n, m; +@@ -238,6 +241,13 @@ + #endif + } + ++local void slide_hash(deflate_state *s) { ++ #ifdef AVX2_SLIDE ++ slide_hash_avx2(s); ++ #endif ++ slide_hash_sse(s); ++} ++ + /* ========================================================================= */ + int ZEXPORT deflateInit_(strm, level, version, stream_size) + z_streamp strm; diff --git a/SPECS/zlib.spec b/SPECS/zlib.spec index 79a6289..1d9d8a8 100644 --- a/SPECS/zlib.spec +++ b/SPECS/zlib.spec @@ -160,7 +160,8 @@ export LDFLAGS="$LDFLAGS -Wl,-z,relro -Wl,-z,now" ./configure --libdir=%{_libdir} --includedir=%{_includedir} --prefix=%{_prefix} --dfltcc %endif %ifarch x86_64 - ./configure --libdir=%{_libdir} --includedir=%{_includedir} --prefix=%{_prefix} --enable-avx2-slide +CFLAGS="$CFLAGS -DAVX2_SLIDE" + ./configure --libdir=%{_libdir} --includedir=%{_includedir} --prefix=%{_prefix} --simd-slide-hash %else ./configure --libdir=%{_libdir} --includedir=%{_includedir} --prefix=%{_prefix} %endif