diff options
author | Jussi Kivilinna <jussi.kivilinna@iki.fi> | 2020-12-30 17:46:04 +0200 |
---|---|---|
committer | Jussi Kivilinna <jussi.kivilinna@iki.fi> | 2020-12-30 17:46:04 +0200 |
commit | 6a0bb9ab7f886087d7edb0725c90485086a1c0b4 (patch) | |
tree | 660cef2ba05c1282425ee8d229ebe7fa57e070bf /configure.ac | |
parent | 1d13794780e3d052cd5ed6f900bf5900cf44b377 (diff) | |
download | libgcrypt-6a0bb9ab7f886087d7edb0725c90485086a1c0b4.tar.gz |
Add s390x/zSeries implementation of ChaCha20
* cipher/Makefile.am: Add 'asm-common-s390x.h' and 'chacha20-s390x.S'.
* cipher/asm-common-s390x.h: New.
* cipher/chacha20-s390x.S: New.
* cipher/chacha20.c (USE_S390X_VX): New.
(CHACHA20_context_t): Change 'use_*' bit-field to unsigned type; Add
'use_s390x'.
(_gcry_chacha20_s390x_vx_blocks8)
(_gcry_chacha20_s390x_vx_blocks4_2_1): New.
(chacha20_do_setkey): Add HW feature detect for s390x/VX.
(chacha20_blocks, do_chacha20_encrypt_stream_tail): Add s390x/VX
code-path.
* configure.ac: Add 'chacha20-s390x.lo'.
--
Patch adds VX vector instruction set accelerated ChaCha20
implementation for zSeries.
Benchmark on z15 (4504 Mhz):
Before:
CHACHA20 | nanosecs/byte mebibytes/sec cycles/byte
STREAM enc | 2.62 ns/B 364.0 MiB/s 11.80 c/B
STREAM dec | 2.62 ns/B 363.8 MiB/s 11.81 c/B
After (~5x faster):
CHACHA20 | nanosecs/byte mebibytes/sec cycles/byte
STREAM enc | 0.505 ns/B 1888 MiB/s 2.28 c/B
STREAM dec | 0.506 ns/B 1887 MiB/s 2.28 c/B
GnuPG-bug-id: 5201
Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac index dc91e6b5..c97d050e 100644 --- a/configure.ac +++ b/configure.ac @@ -2067,7 +2067,8 @@ AC_CACHE_CHECK([whether GCC inline assembler supports zSeries vector instruction AC_COMPILE_IFELSE([AC_LANG_SOURCE( [[void testfunc(void) { - asm volatile ("vx %%v0, %%v1, %%v31\n\t" + asm volatile (".machine \"z13+vx\"\n\t" + "vx %%v0, %%v1, %%v31\n\t" "verllf %%v11, %%v11, (16)(0)\n\t" : : @@ -2662,6 +2663,10 @@ if test "$found" = "1" ; then # Build with the ppc8 vector implementation GCRYPT_CIPHERS="$GCRYPT_CIPHERS chacha20-ppc.lo" ;; + s390x-*-*) + # Build with the s390x/zSeries vector implementation + GCRYPT_CIPHERS="$GCRYPT_CIPHERS chacha20-s390x.lo" + ;; esac if test x"$neonsupport" = xyes ; then |