Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ms VisualStudio - Assembler speedups on x64 #376

Closed
wants to merge 64 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
8266563
Ms VisualStudio - Assembler speedups on x64
Sep 3, 2018
b23f0fb
Change version number to 1.2.11.1.
madler Jan 16, 2017
6da9ebc
Cygwin does not have _wopen(), so do not create gzopen_w() there.
madler Jan 16, 2017
77d6af6
Permit a deflateParams() parameter change as soon as possible.
madler Jan 16, 2017
5acb571
Limit hash table inserts after switch from stored deflate.
madler Jan 21, 2017
4d5c35b
Fix bug when window full in deflate_stored().
madler Jan 21, 2017
6b76809
Fix CLEAR_HASH macro to be usable as a single statement.
madler Jan 23, 2017
cb0bcfe
Avoid a conversion error in gzseek when off_t type too small.
madler Feb 5, 2017
4cf78d8
Have Makefile return non-zero error code on test failure.
madler Feb 12, 2017
e61cc34
Avoid some conversion warnings in gzread.c and gzwrite.c.
madler Feb 12, 2017
3b15763
Update use of errno for newer Windows CE versions.
madler Feb 12, 2017
de11b3b
Small speedup to inflate [psumbera].
madler Feb 12, 2017
f318b48
Return an error if the gzputs string length can't fit in an int.
madler Feb 12, 2017
8b5818b
Add address checking in clang to -w option of configure.
madler Feb 19, 2017
ba6ec4a
Don't compute check value for raw inflate if asked to validate.
madler Mar 30, 2017
7960bbd
Handle case where inflateSync used when header never processed.
madler Apr 16, 2017
ba91706
Avoid the use of ptrdiff_t.
madler Jun 3, 2017
a9653fe
Avoid an undefined behavior of memcpy() in gzappend().
madler Oct 13, 2017
c53077c
Avoid undefined behaviors of memcpy() in gz*printf().
madler Oct 13, 2017
3f58e6c
Avoid an undefined behavior of memcpy() in _tr_stored_block().
madler Oct 13, 2017
149bbdb
Make the names in functions declarations identical to definitions.
madler Oct 13, 2017
f3f795e
Remove old assembler code in which bugs have manifested.
madler Oct 13, 2017
5113477
Fix deflateEnd() to not report an error at start of raw deflate.
madler Oct 13, 2017
ca7d7d4
Add legal disclaimer to README.
madler Oct 13, 2017
b599703
Emphasize the need to continue decompressing gzip members.
madler Jan 9, 2018
4c07900
Correct the initialization requirements for deflateInit2().
madler Jan 31, 2018
ddca34e
Fix a bug that can crash deflate on some input when using Z_FIXED.
madler Apr 18, 2018
fe019c7
Assure that the number of bits for deflatePrime() is valid.
madler Apr 18, 2018
8f1269b
Use a structure to make globals in enough.c evident.
madler Aug 1, 2018
dfc85b6
Use a macro for the printf format of big_t in enough.c.
madler Aug 1, 2018
01a3b96
Clean up code style in enough.c, update version.
madler Aug 1, 2018
87345a4
Use inline function instead of macro for index in enough.c.
madler Aug 2, 2018
094ad2b
Clarify that prefix codes are counted in enough.c.
madler Aug 4, 2018
3f305a7
Show all the codes for the maximum tables size in enough.c.
madler Aug 4, 2018
1cc711e
Add gznorm.c example, which normalizes gzip files.
madler Oct 6, 2018
2f6044b
Fix the zran.c example to work on a multiple-member gzip file.
madler Oct 8, 2018
4562a25
Add tables for crc32_combine(), to speed it up by a factor of 200.
madler Nov 3, 2018
5702568
Add crc32_combine_gen() and crc32_combine_op() for fast combines.
madler Nov 4, 2018
a24cf67
Speed up software CRC-32 computation by a factor of 1.5 to 3.
madler Dec 11, 2018
b5a2a75
Use atomic test and set, if available, for dynamic CRC tables.
madler Dec 26, 2018
ff0f3d1
Don't bother computing check value after successful inflateSync().
madler Jan 3, 2019
e403bf1
Correct comment in crc32.c.
madler Feb 4, 2019
1da5c4c
Add use of the ARMv8 crc32 instructions when requested.
madler Feb 18, 2019
1c9e904
Use ARM crc32 instructions if the ARM architecture has them.
madler Feb 18, 2019
5e81e4c
Explicitly note that the 32-bit check values are 32 bits.
madler Apr 5, 2019
d793747
Avoid adding empty gzip member after gzflush with Z_FINISH.
madler Apr 14, 2019
9a9c47b
Fix memory leak on error in gzlog.c.
madler May 26, 2019
815fbe2
Fix error in comment on the polynomial representation of a byte.
madler Jul 9, 2019
77fbba8
Clarify gz* function interfaces, referring to parameter names.
madler Aug 31, 2020
d2fb6a8
Change macro name in inflate.c to avoid collision in VxWorks.
madler Sep 17, 2020
36e9f70
Correct typo in blast.c.
madler Jan 18, 2021
8129aa8
Improve portability of contrib/minizip.
madler Feb 10, 2021
5667ca1
Fix indentation in minizip's zip.c.
madler Jul 8, 2021
c7e2c7c
Replace black/white with allow/block. (theresa-m)
madler Jan 1, 2022
31b7702
minizip warning fix if MAXU32 already defined. (gvollant)
madler Jan 1, 2022
660a427
Fix unztell64() in minizip to work past 4GB. (Daniël Hörchner)
madler Jan 1, 2022
aa811fd
Clean up minizip to reduce warnings for testing.
madler Jan 1, 2022
aa1e101
Add fallthrough comments for gcc.
madler Mar 27, 2022
03decff
Eliminate use of ULL constants.
madler Mar 27, 2022
c990af7
Separate out address sanitizing from warnings in configure.
madler Mar 27, 2022
f191714
Remove destructive aspects of make distclean.
madler Mar 27, 2022
38c5f3b
Check for cc masquerading as gcc or clang in configure.
madler Mar 27, 2022
46da6a6
Fix crc32.c to compile local functions only if used.
madler Mar 27, 2022
8a346fc
zlib 1.2.12
madler Mar 27, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 24 additions & 20 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)

project(zlib C)

set(VERSION "1.2.11")
set(VERSION "1.2.12")

option(ASM686 "Enable building i686 assembly implementation")
option(AMD64 "Enable building amd64 assembly implementation")
Expand Down Expand Up @@ -79,10 +79,10 @@ if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
endif()

set(ZLIB_PC ${CMAKE_CURRENT_BINARY_DIR}/zlib.pc)
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zlib.pc.cmakein
${ZLIB_PC} @ONLY)
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.cmakein
${CMAKE_CURRENT_BINARY_DIR}/zconf.h @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/zlib.pc.cmakein
${ZLIB_PC} @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.cmakein
${CMAKE_CURRENT_BINARY_DIR}/zconf.h @ONLY)
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR})


Expand Down Expand Up @@ -136,30 +136,34 @@ if(CMAKE_COMPILER_IS_GNUCC)
set(ZLIB_ASMS contrib/amd64/amd64-match.S)
endif ()

if(ZLIB_ASMS)
add_definitions(-DASMV)
set_source_files_properties(${ZLIB_ASMS} PROPERTIES LANGUAGE C COMPILE_FLAGS -DNO_UNDERLINE)
endif()
if(ZLIB_ASMS)
add_definitions(-DASMV)
set_source_files_properties(${ZLIB_ASMS} PROPERTIES LANGUAGE C COMPILE_FLAGS -DNO_UNDERLINE)
endif()
endif()

if(MSVC)
if(ASM686)
ENABLE_LANGUAGE(ASM_MASM)
ENABLE_LANGUAGE(ASM_MASM)
set(ZLIB_ASMS
contrib/masmx86/inffas32.asm
contrib/masmx86/match686.asm
)
contrib/masmx86/inffas32.asm
contrib/masmx86/match686.asm
)
elseif (AMD64)
ENABLE_LANGUAGE(ASM_MASM)
ENABLE_LANGUAGE(ASM_MASM)
set(ZLIB_ASMS
contrib/masmx64/gvmat64.asm
contrib/masmx64/inffasx64.asm
)
contrib/masmx64/gvmat64.asm
contrib/masmx64/inffasx64.asm
)
set(ZLIB_SRCS
${ZLIB_SRCS}
contrib/masmx64/inffas8664.c
)
endif()

if(ZLIB_ASMS)
add_definitions(-DASMV -DASMINF)
endif()
if(ZLIB_ASMS)
add_definitions(-DASMV -DASMINF)
endif()
endif()

# parse the full version number from zlib.h and include in ZLIB_FULL_VERSION
Expand Down
161 changes: 112 additions & 49 deletions ChangeLog

Large diffs are not rendered by default.

18 changes: 8 additions & 10 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ CPP=$(CC) -E

STATICLIB=libz.a
SHAREDLIB=libz.so
SHAREDLIBV=libz.so.1.2.11
SHAREDLIBV=libz.so.1.2.12
SHAREDLIBM=libz.so.1
LIBS=$(STATICLIB) $(SHAREDLIBV)

Expand Down Expand Up @@ -91,8 +91,8 @@ teststatic: static
echo ' *** zlib test OK ***'; \
else \
echo ' *** zlib test FAILED ***'; false; \
fi; \
rm -f $$TMPST
fi
@rm -f tmpst_$$

testshared: shared
@LD_LIBRARY_PATH=`pwd`:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
Expand All @@ -104,17 +104,17 @@ testshared: shared
echo ' *** zlib shared test OK ***'; \
else \
echo ' *** zlib shared test FAILED ***'; false; \
fi; \
rm -f $$TMPSH
fi
@rm -f tmpsh_$$

test64: all64
@TMP64=tmp64_$$; \
if echo hello world | ./minigzip64 | ./minigzip64 -d && ./example64 $$TMP64; then \
echo ' *** zlib 64-bit test OK ***'; \
else \
echo ' *** zlib 64-bit test FAILED ***'; false; \
fi; \
rm -f $$TMP64
fi
@rm -f tmp64_$$

infcover.o: $(SRCDIR)test/infcover.c $(SRCDIR)zlib.h zconf.h
$(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/infcover.c
Expand Down Expand Up @@ -376,15 +376,13 @@ clean:
rm -f contrib/infback9/*.gcda contrib/infback9/*.gcno contrib/infback9/*.gcov

maintainer-clean: distclean
distclean: clean zconf zconf.h.cmakein docs
distclean: clean zconf zconf.h.cmakein
rm -f Makefile zlib.pc configure.log
-@rm -f .DS_Store
@if [ -f Makefile.in ]; then \
printf 'all:\n\t-@echo "Please use ./configure first. Thank you."\n' > Makefile ; \
printf '\ndistclean:\n\tmake -f Makefile.in distclean\n' >> Makefile ; \
touch -r $(SRCDIR)Makefile.in Makefile ; fi
@if [ ! -f zconf.h.in ]; then rm -f zconf.h zconf.h.cmakein ; fi
@if [ ! -f zlib.3 ]; then rm -f zlib.3.pdf ; fi

tags:
etags $(SRCDIR)*.[ch]
Expand Down
11 changes: 7 additions & 4 deletions README
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ZLIB DATA COMPRESSION LIBRARY

zlib 1.2.11 is a general purpose data compression library. All the code is
zlib 1.2.12 is a general purpose data compression library. All the code is
thread safe. The data format used by the zlib library is described by RFCs
(Request for Comments) 1950 to 1952 in the files
http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and
Expand Down Expand Up @@ -31,7 +31,7 @@ Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan. 1997
issue of Dr. Dobb's Journal; a copy of the article is available at
http://marknelson.us/1997/01/01/zlib-engine/ .

The changes made in version 1.2.11 are documented in the file ChangeLog.
The changes made in version 1.2.12 are documented in the file ChangeLog.

Unsupported third party contributions are provided in directory contrib/ .

Expand Down Expand Up @@ -84,7 +84,7 @@ Acknowledgments:

Copyright notice:

(C) 1995-2017 Jean-loup Gailly and Mark Adler
(C) 1995-2022 Jean-loup Gailly and Mark Adler

This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
Expand All @@ -108,7 +108,10 @@ Copyright notice:
If you use the zlib library in a product, we would appreciate *not* receiving
lengthy legal documents to sign. The sources are provided for free but without
warranty of any kind. The library has been entirely written by Jean-loup
Gailly and Mark Adler; it does not include third-party code.
Gailly and Mark Adler; it does not include third-party code. We make all
contributions to and distributions of this project solely in our personal
capacity, and are not conveying any rights to any intellectual property of
any third parties.

If you redistribute modified sources, we would appreciate that you include in
the file ChangeLog history information documenting your changes. Please read
Expand Down
48 changes: 27 additions & 21 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ build64=0
gcc=0
warn=0
debug=0
sanitize=0
old_cc="$CC"
old_cflags="$CFLAGS"
OBJC='$(OBJZ) $(OBJG)'
Expand Down Expand Up @@ -137,6 +138,7 @@ case "$1" in
-c* | --const) zconst=1; shift ;;
-w* | --warn) warn=1; shift ;;
-d* | --debug) debug=1; shift ;;
--sanitize) sanitize=1; shift ;;
*)
echo "unknown option: $1" | tee -a configure.log
echo "$0 --help for help" | tee -a configure.log
Expand Down Expand Up @@ -165,8 +167,14 @@ extern int getchar();
int hello() {return getchar();}
EOF

test -z "$CC" && echo Checking for ${CROSS_PREFIX}gcc... | tee -a configure.log
cc=${CC-${CROSS_PREFIX}gcc}
if test -z "$CC"; then
echo Checking for ${CROSS_PREFIX}gcc... | tee -a configure.log
if ${CROSS_PREFIX}gcc -v >/dev/null 2>&1; then
cc=${CROSS_PREFIX}gcc
else
cc=${CROSS_PREFIX}cc
fi
fi
cflags=${CFLAGS-"-O3"}
# to force the asm version use: CFLAGS="-O3 -DASMV" ./configure
case "$cc" in
Expand Down Expand Up @@ -199,6 +207,9 @@ if test "$gcc" -eq 1 && ($cc -c $test.c) >> configure.log 2>&1; then
CFLAGS="${CFLAGS} -Wall -Wextra -pedantic"
fi
fi
if test $sanitize -eq 1; then
CFLAGS="${CFLAGS} -fsanitize=address"
fi
if test $debug -eq 1; then
CFLAGS="${CFLAGS} -DZLIB_DEBUG"
SFLAGS="${SFLAGS} -DZLIB_DEBUG"
Expand Down Expand Up @@ -367,8 +378,11 @@ else
try()
{
show $*
( $* ) >> configure.log 2>&1
got=`( $* ) 2>&1`
ret=$?
if test "$got" != ""; then
printf "%s\n" "$got" >> configure.log
fi
if test $ret -ne 0; then
echo "(exit code "$ret")" >> configure.log
fi
Expand All @@ -381,8 +395,11 @@ tryboth()
show $*
got=`( $* ) 2>&1`
ret=$?
printf %s "$got" >> configure.log
if test "$got" != ""; then
printf "%s\n" "$got" >> configure.log
fi
if test $ret -ne 0; then
echo "(exit code "$ret")" >> configure.log
return $ret
fi
test "$got" = ""
Expand Down Expand Up @@ -457,17 +474,11 @@ size_t dummy = 0;
EOF
if try $CC -c $CFLAGS $test.c; then
echo "Checking for size_t... Yes." | tee -a configure.log
need_sizet=0
else
echo "Checking for size_t... No." | tee -a configure.log
need_sizet=1
fi

echo >> configure.log

# find the size_t integer type, if needed
if test $need_sizet -eq 1; then
cat > $test.c <<EOF
# find a size_t integer type
# check for long long
cat > $test.c << EOF
long long dummy = 0;
EOF
if try $CC -c $CFLAGS $test.c; then
Expand Down Expand Up @@ -495,17 +506,13 @@ EOF
if try $CC $CFLAGS -o $test $test.c; then
sizet=`./$test`
echo "Checking for a pointer-size integer type..." $sizet"." | tee -a configure.log
CFLAGS="${CFLAGS} -DNO_SIZE_T=${sizet}"
SFLAGS="${SFLAGS} -DNO_SIZE_T=${sizet}"
else
echo "Failed to find a pointer-size integer type." | tee -a configure.log
leave 1
echo "Checking for a pointer-size integer type... not found." | tee -a configure.log
fi
fi

if test $need_sizet -eq 1; then
CFLAGS="${CFLAGS} -DNO_SIZE_T=${sizet}"
SFLAGS="${SFLAGS} -DNO_SIZE_T=${sizet}"
fi

echo >> configure.log

# check for large file support, and if none, check for fseeko()
Expand Down Expand Up @@ -849,7 +856,6 @@ echo SHAREDLIBV = $SHAREDLIBV >> configure.log
echo STATICLIB = $STATICLIB >> configure.log
echo TEST = $TEST >> configure.log
echo VER = $VER >> configure.log
echo Z_U4 = $Z_U4 >> configure.log
echo SRCDIR = $SRCDIR >> configure.log
echo exec_prefix = $exec_prefix >> configure.log
echo includedir = $includedir >> configure.log
Expand Down
21 changes: 0 additions & 21 deletions contrib/README.contrib
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@ ada/ by Dmitriy Anisimkov <anisimkov@yahoo.com>
Support for Ada
See http://zlib-ada.sourceforge.net/

amd64/ by Mikhail Teterin <mi@ALDAN.algebra.com>
asm code for AMD64
See patch at http://www.freebsd.org/cgi/query-pr.cgi?pr=bin/96393

asm686/ by Brian Raiter <breadbox@muppetlabs.com>
asm code for Pentium and PPro/PII, using the AT&T (GNU as) syntax
See http://www.muppetlabs.com/~breadbox/software/assembly.html

blast/ by Mark Adler <madler@alumni.caltech.edu>
Decompressor for output of PKWare Data Compression Library (DCL)

Expand All @@ -32,9 +24,6 @@ gcc_gvmat64/by Gilles Vollant <info@winimage.com>
infback9/ by Mark Adler <madler@alumni.caltech.edu>
Unsupported diffs to infback to decode the deflate64 format

inflate86/ by Chris Anderson <christop@charm.net>
Tuned x86 gcc asm code to replace inflate_fast()

iostream/ by Kevin Ruland <kevin@rodin.wustl.edu>
A C++ I/O streams interface to the zlib gz* functions

Expand All @@ -45,16 +34,6 @@ iostream3/ by Ludwig Schwardt <schwardt@sun.ac.za>
and Kevin Ruland <kevin@rodin.wustl.edu>
Yet another C++ I/O streams interface

masmx64/ by Gilles Vollant <info@winimage.com>
x86 64-bit (AMD64 and Intel EM64t) code for x64 assembler to
replace longest_match() and inflate_fast(), also masm x86
64-bits translation of Chris Anderson inflate_fast()

masmx86/ by Gilles Vollant <info@winimage.com>
x86 asm code to replace longest_match() and inflate_fast(),
for Visual C++ and MASM (32 bits).
Based on Brian Raiter (asm686) and Chris Anderson (inflate86)

minizip/ by Gilles Vollant <info@winimage.com>
Mini zip and unzip based on zlib
Includes Zip64 support by Mathias Svensson <mathias@result42.com>
Expand Down
Loading