AVX implementation of BLAKE2s
authorJussi Kivilinna <jussi.kivilinna@iki.fi>
Thu, 8 Feb 2018 17:45:10 +0000 (19:45 +0200)
committerJussi Kivilinna <jussi.kivilinna@iki.fi>
Fri, 16 Feb 2018 17:28:04 +0000 (19:28 +0200)
commitda58a62ac1b7a8d97b0895dcb41d15af531e45e5
tree73d80d737507cf4fe7f88a93d1c227ff3387af18
parentaf7fc732f9a7af7a70276f1e8364d2132db314f1
AVX implementation of BLAKE2s

* cipher/Makefile.am: Add 'blake2s-amd64-avx.S'.
* cipher/blake2.c (USE_AVX, _gry_blake2s_transform_amd64_avx): New.
(BLAKE2S_CONTEXT) [USE_AVX]: Add 'use_avx'.
(blake2s_transform): Rename to ...
(blake2s_transform_generic): ... this.
(blake2s_transform): New.
(blake2s_final): Pass 'ctx' pointer to transform function instead of
'S'.
(blake2s_init_ctx): Check HW features and enable AVX implementation
if supported.
* cipher/blake2s-amd64-avx.S: New.
* configure.ac: Add 'blake2s-amd64-avx.lo'.
--

Benchmark on Intel Core i7-4790K (4.0 Ghz, no turbo):

Before:
                |  nanosecs/byte   mebibytes/sec   cycles/byte
 BLAKE2S_256    |      1.77 ns/B     538.2 MiB/s      7.09 c/B

After (~1.3x faster):
                |  nanosecs/byte   mebibytes/sec   cycles/byte
 BLAKE2S_256    |      1.34 ns/B     711.4 MiB/s      5.36 c/B

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
cipher/Makefile.am
cipher/blake2.c
cipher/blake2s-amd64-avx.S [new file with mode: 0644]
configure.ac