Home GnuPG

mpi/ec-inline: refactor i386 assembly to reduce register usage

Description

mpi/ec-inline: refactor i386 assembly to reduce register usage

* mpi/ec-inline.h [__i386__] (ADD2_LIMB32_CARRY_OUT)
(ADD2_LIMB32_CARRY_IN_OUT, ADD2_LIB32_CARRY_IN, SUB2_LIMB32_CARRY_OUT)
(SUB2_LIMB32_CARRY_IN_OUT, SUB2_LIB32_CARRY_IN, ADD8_LIMB32)
(ADD10_LIMB32, ADD14_LIMB32, SUB8_LIMB32, SUB10_LIMB32)
(SUB14_LIMB32): New.
[__i386__] (ADD4_LIMB32, ADD6_LIMB32, SUB4_LIMB32, SUB6_LIMB32): Rewrite
to use new *_CARRY_* macros.
[BYTES_PER_MPI_LIMB == 4] (ADD4_LIMB64): Use ADD8_LIMB32 if available.
[BYTES_PER_MPI_LIMB == 4] (ADD5_LIMB64): Use ADD10_LIMB32 if available.
[BYTES_PER_MPI_LIMB == 4] (ADD7_LIMB64): Use ADD14_LIMB32 if available.
[BYTES_PER_MPI_LIMB == 4] (SUB4_LIMB64): Use SUB8_LIMB32 if available.
[BYTES_PER_MPI_LIMB == 4] (SUB5_LIMB64): Use SUB10_LIMB32 if available.
[BYTES_PER_MPI_LIMB == 4] (SUB7_LIMB64): Use SUB14_LIMB32 if available.

This commit reduces number register operands and register pressure
at i386 assembly used in ec-nist.c NIST-P192, P224, P256, and P384.
Performance stays relatively same, with P192 being ~2% slower
than before and P384 being ~5% faster.

  • GnuPG-bug-id: T6892
  • Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>

Details

Provenance
jukiviliAuthored on Dec 19 2023, 7:23 PM
Parents
rC90097bd2f41c: mpi/ec-nist: fix for -Og build failure on i386
Branches
Unknown
Tags
Unknown
Tasks
T6892: libgcrypt-1.10.3 build failure on x86 with -Og