Home GnuPG

chacha20-ppc: use target and optimize attributes for P8 and P9

Description

chacha20-ppc: use target and optimize attributes for P8 and P9

* cipher/chacha20-ppc.c (_gcry_chacha20_ppc8_blocks1): Rename to...
(chacha20_ppc_blocks1): ...this; Add 'always inline' attribute.
(_gcry_chacha20_ppc8_blocks4): Rename to...
(chacha20_ppc_blocks4): ...this; Add 'always inline' attribute.
(_gcry_chacha20_poly1305_ppc8_blocks4): Rename to...
(chacha20_poly1305_ppc_blocks4): ...this; Add 'always inline'
attribute.
(FUNC_ATTR_OPT_O2, FUNC_ATTR_TARGET_P8, FUNC_ATTR_TARGET_P9): New.
(_gcry_chacha20_ppc8_blocks1, _gcry_chacha20_ppc8_blocks4)
(_gcry_chacha20_poly1305_ppc8_blocks4): New.
(_gcry_chacha20_ppc9_blocks1, _gcry_chacha20_ppc9_blocks4)
(_gcry_chacha20_poly1305_ppc9_blocks4): New.
* cipher/chacha20.c (CHACHA20_context_t): Add 'use_p9'.
(_gcry_chacha20_ppc9_blocks1, _gcry_chacha20_ppc9_blocks4)
(_gcry_chacha20_poly1305_ppc9_blocks4): New.
(chacha20_do_setkey): Set 'use_p9' if HW has HWF_PPC_ARCH_3_00.
(chacha20_blocks, do_chacha20_encrypt_stream_tail)
(_gcry_chacha20_poly1305_encrypt)
(_gcry_chacha20_poly1305_decrypt) [USE_PPC_VEC]: Add 'use_p9' paths.

This change makes sure that chacha20-ppc gets compiled
with proper optimization level and right target setting.

Benchmark on POWER9:

CHACHA20 | nanosecs/byte mebibytes/sec cycles/byte

   STREAM enc |      1.11 ns/B     856.0 MiB/s      2.56 c/B
   STREAM dec |      1.11 ns/B     856.0 MiB/s      2.56 c/B
 POLY1305 enc |      1.57 ns/B     606.2 MiB/s      3.62 c/B
 POLY1305 dec |      1.56 ns/B     610.4 MiB/s      3.59 c/B
POLY1305 auth |     0.876 ns/B      1089 MiB/s      2.02 c/B
  • Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>

Details

Provenance
jukiviliAuthored on Feb 26 2023, 1:18 PM
Parents
rC100063cf4e1c: aes-ppc: use target and optimize attributes for P8 and P9
Branches
Unknown
Tags
Unknown