]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Remove support for ASMV and ASMINF defines and clean up match.c handling.
authorhansr <hk-git@circlestorm.org>
Wed, 5 Nov 2014 12:54:07 +0000 (13:54 +0100)
committerhansr <hk-git@circlestorm.org>
Wed, 5 Nov 2014 13:00:25 +0000 (14:00 +0100)
This makes it easier to implement support for ASM replacements using
configure parameters if needed later. Also since zlib-ng uses
compiler intrinsics, this needed a cleanup in any case.

Makefile.in
configure
deflate.c
inffast.c
match.c
zutil.c

index e9dd54518c0dc10fa6460c158607cf7799a6ed40..972283fc3f2e2e311856b20ccae55557fbf740f7 100644 (file)
@@ -7,10 +7,6 @@
 # Normally configure builds both a static and a shared library.
 # If you want to build just a static library, use: ./configure --static
 
-# To use the asm code, type:
-#    cp contrib/asm?86/match.S ./match.S
-#    make LOC=-DASMV OBJA=match.o
-
 # To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type:
 #    make install
 # To install in $HOME instead of /usr/local, use:
@@ -28,7 +24,6 @@ SFLAGS=-O
 LDFLAGS=
 TEST_LDFLAGS=-L. libz.a
 LDSHARED=$(CC)
-CPP=$(CC) -E
 
 STATICLIB=libz.a
 SHAREDLIB=libz.so
@@ -58,21 +53,17 @@ mandir = ${prefix}/share/man
 man3dir = ${mandir}/man3
 pkgconfigdir = ${libdir}/pkgconfig
 
-OBJZ = adler32.o crc32.o deflate.o infback.o inffast.o inflate.o inftrees.o trees.o zutil.o $(ARCH_STATIC_OBJS)
+OBJZ = adler32.o crc32.o deflate.o match.o infback.o inffast.o inflate.o inftrees.o trees.o zutil.o $(ARCH_STATIC_OBJS)
 OBJG = compress.o uncompr.o gzclose.o gzlib.o gzread.o gzwrite.o
 OBJC = $(OBJZ) $(OBJG)
 
-PIC_OBJZ = adler32.lo crc32.lo deflate.lo infback.lo inffast.lo inflate.lo inftrees.lo trees.lo zutil.lo $(ARCH_SHARED_OBJS)
+PIC_OBJZ = adler32.lo crc32.lo deflate.lo match.o infback.lo inffast.lo inflate.lo inftrees.lo trees.lo zutil.lo $(ARCH_SHARED_OBJS)
 PIC_OBJG = compress.lo uncompr.lo gzclose.lo gzlib.lo gzread.lo gzwrite.lo
 PIC_OBJC = $(PIC_OBJZ) $(PIC_OBJG)
 
-# to use the asm code: make OBJA=match.o, PIC_OBJA=match.lo
-OBJA =
-PIC_OBJA =
-
-OBJS = $(OBJC) $(OBJA)
+OBJS = $(OBJC)
 
-PIC_OBJS = $(PIC_OBJC) $(PIC_OBJA)
+PIC_OBJS = $(PIC_OBJC)
 
 all: $(ARCHDIR) static shared
 
@@ -141,18 +132,6 @@ libz.a: $(OBJS)
        $(AR) $(ARFLAGS) $@ $(OBJS)
        -@ ($(RANLIB) $@ || true) >/dev/null 2>&1
 
-match.o: match.S
-       $(CPP) match.S > _match.s
-       $(CC) -c _match.s
-       mv _match.o match.o
-       rm -f _match.s
-
-match.lo: match.S
-       $(CPP) match.S > _match.s
-       $(CC) -c -fPIC _match.s
-       mv _match.o match.lo
-       rm -f _match.s
-
 example.o: test/example.c zlib.h zconf.h
        $(CC) $(CFLAGS) -I. -c -o $@ test/example.c
 
index 560324975b5541f1a64361a70a8fbe4450afdac3..6b5d8773b3dc97620021d92565a6bfec3d5bdbf5 100755 (executable)
--- a/configure
+++ b/configure
@@ -176,7 +176,6 @@ EOF
 test -z "$CC" && echo Checking for ${CROSS_PREFIX}gcc... | tee -a configure.log
 cc=${CC-${CROSS_PREFIX}gcc}
 cflags=${CFLAGS-"-O3"}
-# to force the asm version use: CFLAGS="-O3 -DASMV" ./configure
 case "$cc" in
   *gcc*) gcc=1 ;;
   *clang*) gcc=1 ;;
@@ -430,20 +429,6 @@ else
   TEST="all teststatic testshared"
 fi
 
-# check for underscores in external names for use by assembler code
-CPP=${CPP-"$CC -E"}
-case $CFLAGS in
-  *ASMV*)
-    echo >> configure.log
-    show "$NM $test.o | grep _hello"
-    if test "`$NM $test.o | grep _hello | tee -a configure.log`" = ""; then
-      CPP="$CPP -DNO_UNDERLINE"
-      echo Checking for underline in external names... No. | tee -a configure.log
-    else
-      echo Checking for underline in external names... Yes. | tee -a configure.log
-    fi ;;
-esac
-
 echo >> configure.log
 
 # check for large file support, and if none, check for fseeko()
@@ -724,7 +709,6 @@ echo AR = $AR >> configure.log
 echo ARFLAGS = $ARFLAGS >> configure.log
 echo CC = $CC >> configure.log
 echo CFLAGS = $CFLAGS >> configure.log
-echo CPP = $CPP >> configure.log
 echo EXE = $EXE >> configure.log
 echo LDCONFIG = $LDCONFIG >> configure.log
 echo LDFLAGS = $LDFLAGS >> configure.log
@@ -759,7 +743,6 @@ sed < Makefile.in "
 /^SFLAGS *=/s#=.*#=$SFLAGS#
 /^LDFLAGS *=/s#=.*#=$LDFLAGS#
 /^LDSHARED *=/s#=.*#=$LDSHARED#
-/^CPP *=/s#=.*#=$CPP#
 /^STATICLIB *=/s#=.*#=$STATICLIB#
 /^SHAREDLIB *=/s#=.*#=$SHAREDLIB#
 /^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV#
@@ -796,7 +779,6 @@ sed < $ARCHDIR/Makefile.in "
 sed < zlib.pc.in "
 /^CC *=/s#=.*#=$CC#
 /^CFLAGS *=/s#=.*#=$CFLAGS#
-/^CPP *=/s#=.*#=$CPP#
 /^LDSHARED *=/s#=.*#=$LDSHARED#
 /^STATICLIB *=/s#=.*#=$STATICLIB#
 /^SHAREDLIB *=/s#=.*#=$SHAREDLIB#
index 6ac69c41ff6065865babc6f42b3fc4dfa31cffc2..7b531b0173084e3869e5651ec6c3497d80b253b4 100644 (file)
--- a/deflate.c
+++ b/deflate.c
@@ -50,6 +50,7 @@
 /* @(#) $Id$ */
 
 #include "deflate.h"
+#include "match.h"
 
 #if defined(X86_CPUID)
 #include "arch/x86/x86.h"
@@ -83,12 +84,6 @@ local void lm_init        (deflate_state *s);
 local void putShortMSB    (deflate_state *s, uInt b);
 ZLIB_INTERNAL void flush_pending  (z_streamp strm);
 ZLIB_INTERNAL int read_buf        (z_streamp strm, Byte *buf, unsigned size);
-#ifdef ASMV
-      void match_init (void); /* asm code initialization */
-      uInt longest_match  (deflate_state *s, IPos cur_match);
-#else
-local uInt longest_match  (deflate_state *s, IPos cur_match);
-#endif
 
 #ifdef DEBUG
 local  void check_match (deflate_state *s, IPos start, IPos match, int length);
@@ -1170,13 +1165,8 @@ local void lm_init (deflate_state *s)
     s->match_length = s->prev_length = MIN_MATCH-1;
     s->match_available = 0;
     s->ins_h = 0;
-#ifdef ASMV
-    match_init(); /* initialize the asm code */
-#endif
 }
 
-#include "match.c"
-
 #ifdef DEBUG
 /* ===========================================================================
  * Check that the match at match_start is indeed a match.
index 9747028c045e5a02e4450c5bd8d6a0a479a49c5f..6ab7c558822c8eec7f602a793f1ff114fe9dd4c6 100644 (file)
--- a/inffast.c
+++ b/inffast.c
@@ -8,8 +8,6 @@
 #include "inflate.h"
 #include "inffast.h"
 
-#ifndef ASMINF
-
 /* Allow machine dependent optimization for post-increment or pre-increment.
    Based on testing to date,
    Pre-increment preferred for:
@@ -340,5 +338,3 @@ void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start)
    - Larger unrolled copy loops (three is about right)
    - Moving len -= 3 statement into middle of loop
  */
-
-#endif /* !ASMINF */
diff --git a/match.c b/match.c
index 5ca958fa2002f1ed661733217da6c6117a224ac2..0843933ace93fa5d13afbe7dc26a38e5dc17ca5f 100644 (file)
--- a/match.c
+++ b/match.c
 #include "deflate.h"
 
 #if (defined(UNALIGNED_OK) && MAX_MATCH == 258)
-#  define longest_match std2_longest_match
+#  define std2_longest_match
 #else
-#  define longest_match std1_longest_match
+#  define std1_longest_match
 #endif
 
+#ifdef std1_longest_match
+
 /*
  * Standard longest_match
  *
  */
-local unsigned std1_longest_match(deflate_state *z_const s, IPos cur_match)
+ZLIB_INTERNAL unsigned longest_match(deflate_state *z_const s, IPos cur_match)
 {
        z_const unsigned wmask = s->w_mask;
        z_const Pos *prev = s->prev;
@@ -135,12 +137,14 @@ local unsigned std1_longest_match(deflate_state *z_const s, IPos cur_match)
                return best_len;
        return s->lookahead;
 }
+#endif
 
+#ifdef std2_longest_match
 /*
  * UNALIGNED_OK longest_match
  *
  */
-local unsigned std2_longest_match(deflate_state *z_const s, IPos cur_match)
+ZLIB_INTERNAL unsigned longest_match(deflate_state *z_const s, IPos cur_match)
 {
        z_const unsigned wmask = s->w_mask;
        z_const Pos *prev = s->prev;
@@ -256,3 +260,4 @@ local unsigned std2_longest_match(deflate_state *z_const s, IPos cur_match)
                return best_len;
        return s->lookahead;
 }
+#endif
diff --git a/zutil.c b/zutil.c
index afad9804af4e6d69659919b64cdadb4caabd4b4d..cabca8683fd68bfc4d9f8e3e5544636b7da624d9 100644 (file)
--- a/zutil.c
+++ b/zutil.c
@@ -60,9 +60,6 @@ uLong ZEXPORT zlibCompileFlags()
 #ifdef DEBUG
     flags += 1 << 8;
 #endif
-#if defined(ASMV) || defined(ASMINF)
-    flags += 1 << 9;
-#endif
 #ifdef ZLIB_WINAPI
     flags += 1 << 10;
 #endif