Skip to content

Commit

Permalink
Add optimized crc32 for POWER8 and later processors
Browse files Browse the repository at this point in the history
This commit adds an optimized version of the crc32 function based
on crc32-vpmsum from https://github.com/antonblanchard/crc32-vpmsum/ .
The code has been relicensed to the zlib license.

This is the C implementation created by Rogerio Alves <rogealve@br.ibm.com>

It makes use of vector instructions to speed up CRC32 algorithm. Decompression
times were improved by +30% on tests.

Based on Daniel Black's work for the original zlib (madler/zlib#478).
  • Loading branch information
mscastanho committed Aug 11, 2021
1 parent a56f926 commit 3e41361
Show file tree
Hide file tree
Showing 7 changed files with 1,770 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,10 @@ if(WITH_OPTIM)
add_definitions(-DPOWER8_VSX_CHUNKSET)
add_definitions(-DPOWER8_VSX_SLIDEHASH)
set(POWER8_SRCS ${ARCHDIR}/adler32_power8.c ${ARCHDIR}/chunkset_power8.c ${ARCHDIR}/slide_hash_power8.c)
if("${ARCH}" MATCHES "powerpc64(le)?")
add_definitions(-DPOWER8_VSX_CRC32)
list(APPEND POWER8_SRCS ${ARCHDIR}/crc32_power8.c)
endif()
list(APPEND ZLIB_ARCH_SRCS ${POWER8_SRCS})
set_property(SOURCE ${POWER8_SRCS} PROPERTY COMPILE_FLAGS "${POWER8FLAG} ${NOLTOFLAG}")
else()
Expand Down
8 changes: 8 additions & 0 deletions arch/power/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ all: power.o \
adler32_vmx.lo \
chunkset_power8.o \
chunkset_power8.lo \
crc32_power8.o \
crc32_power8.lo \
slide_hash_power8.o \
slide_hash_power8.lo \
slide_hash_vmx.o \
Expand Down Expand Up @@ -54,6 +56,12 @@ chunkset_power8.o:
chunkset_power8.lo:
$(CC) $(SFLAGS) $(P8FLAGS) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/chunkset_power8.c

crc32_power8.o:
$(CC) $(CFLAGS) $(P8FLAGS) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/crc32_power8.c

crc32_power8.lo:
$(CC) $(SFLAGS) $(P8FLAGS) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/crc32_power8.c

slide_hash_power8.o:
$(CC) $(CFLAGS) $(P8FLAGS) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/slide_hash_power8.c

Expand Down
1,123 changes: 1,123 additions & 0 deletions arch/power/crc32_constants.h

Large diffs are not rendered by default.

Loading

0 comments on commit 3e41361

Please sign in to comment.