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 10, 2021
1 parent a3185a4 commit 0ac7c57
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 @@ -619,6 +619,10 @@ if(WITH_OPTIM)
list(APPEND ZLIB_ARCH_HDRS ${ARCHDIR}/power.h)
list(APPEND ZLIB_ARCH_SRCS ${ARCHDIR}/power.c)
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 @@ -21,6 +21,8 @@ all: power.o \
adler32_power8.lo \
chunkset_power8.o \
chunkset_power8.lo \
crc32_power8.o \
crc32_power8.lo \
slide_hash_power8.o \
slide_hash_power8.lo

Expand All @@ -42,6 +44,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 0ac7c57

Please sign in to comment.