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 Jun 22, 2021
1 parent 366d9ba commit 3f261b7
Show file tree
Hide file tree
Showing 7 changed files with 1,830 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,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}/slide_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 @@ -19,6 +19,8 @@ all: power.o \
power.lo \
adler32_power8.o \
adler32_power8.lo \
crc32_power8.o \
crc32_power8.lo \
slide_power8.o \
slide_power8.lo

Expand All @@ -34,6 +36,12 @@ adler32_power8.o:
adler32_power8.lo:
$(CC) $(SFLAGS) $(P8FLAGS) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/adler32_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_power8.o:
$(CC) $(CFLAGS) $(P8FLAGS) $(NOLTOFLAG) $(INCLUDES) -c -o $@ $(SRCDIR)/slide_power8.c

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

Large diffs are not rendered by default.

Loading

0 comments on commit 3f261b7

Please sign in to comment.