Author: allanjude Date: Sat Jul 1 21:18:06 2017 New Revision: 320554 URL: https://svnweb.freebsd.org/changeset/base/320554
Log: Increase loop unrolling for skein hashes This patch was inspired by an opposite change made to shrink the code for the boot loader. On my i7-4770, it increases the skein1024 speed from 470 to 550 MB/s Reviewed by: sbruno MFC after: 1 month Sponsored by: ScaleEngine Inc. Differential Revision: https://reviews.freebsd.org/D7824 Modified: head/lib/libmd/Makefile head/sys/modules/crypto/Makefile Modified: head/lib/libmd/Makefile ============================================================================== --- head/lib/libmd/Makefile Sat Jul 1 20:25:22 2017 (r320553) +++ head/lib/libmd/Makefile Sat Jul 1 21:18:06 2017 (r320554) @@ -88,6 +88,8 @@ sys/md5.h: ${SRCTOP}/sys/${.TARGET} .NOMETA CFLAGS+= -I${.CURDIR} -I${SRCTOP}/sys/crypto/sha2 CFLAGS+= -I${SRCTOP}/sys/crypto/skein CFLAGS+= -DWEAK_REFS +# unroll the 256 and 512 loops, half unroll the 1024 +CFLAGS+= -DSKEIN_LOOP=995 .PATH: ${.CURDIR}/${MACHINE_ARCH} ${SRCTOP}/sys/crypto/sha2 .PATH: ${SRCTOP}/sys/crypto/skein ${SRCTOP}/sys/crypto/skein/${MACHINE_ARCH} @@ -101,6 +103,8 @@ CFLAGS+= -DRMD160_ASM .endif .if exists(${MACHINE_ARCH}/skein_block_asm.s) AFLAGS += --strip-local-absolute +# Fully unroll all loops in the assembly optimized version +AFLAGS+= --defsym SKEIN_LOOP=0 SRCS+= skein_block_asm.s CFLAGS+= -DSKEIN_ASM -DSKEIN_USE_ASM=1792 # list of block functions to replace with assembly: 256+512+1024 = 1792 .endif Modified: head/sys/modules/crypto/Makefile ============================================================================== --- head/sys/modules/crypto/Makefile Sat Jul 1 20:25:22 2017 (r320553) +++ head/sys/modules/crypto/Makefile Sat Jul 1 21:18:06 2017 (r320554) @@ -19,11 +19,15 @@ SRCS += camellia.c camellia-api.c SRCS += des_ecb.c des_enc.c des_setkey.c SRCS += sha1.c sha256c.c sha512c.c SRCS += skein.c skein_block.c +# unroll the 256 and 512 loops, half unroll the 1024 +CFLAGS+= -DSKEIN_LOOP=995 .if exists(${MACHINE_ARCH}/skein_block_asm.s) .PATH: ${SRCTOP}/sys/crypto/skein/${MACHINE_ARCH} SRCS += skein_block_asm.s CFLAGS += -DSKEIN_ASM -DSKEIN_USE_ASM=1792 # list of block functions to replace with assembly: 256+512+1024 = 1792 ACFLAGS += -DELF -Wa,--noexecstack +# Fully unroll all loops in the assembly optimized version +AFLAGS+= --defsym SKEIN_LOOP=0 .endif SRCS += siphash.c SRCS += gmac.c gfmult.c _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"