HomePhabricator

[SECP256K1] Optimization: special-case zero modulus limbs in modinv64

Description

[SECP256K1] Optimization: special-case zero modulus limbs in modinv64

Summary:

Both the field and scalar modulus can be written in signed{30,62}
notation with one or more zero limbs. Make use of this in the update_de
function to avoid a few wide multiplications when that is the case.

This doesn't appear to be a win in the 32-bit implementation, so only
do it for the 64-bit one.

Partial backport of secp256k1#831:
https://github.com/bitcoin-core/secp256k1/pull/831/commits/9164a1b6582e2fc833c760a3403d26b9b0b3b7b3

Depends on D9408.

Test Plan:

ninja check-secp256k1

Reviewers: #bitcoin_abc, majcosta

Reviewed By: #bitcoin_abc, majcosta

Differential Revision: https://reviews.bitcoinabc.org/D9409

Details

Provenance
Pieter Wuille <pieter@wuille.net>Authored on Nov 28 2020, 23:58
FabienCommitted on Apr 14 2021, 09:17
FabienPushed on Apr 14 2021, 09:17
Reviewer
Restricted Project
Differential Revision
D9409: [SECP256K1] Optimization: special-case zero modulus limbs in modinv64
Parents
rABC6c967a512a3e: [SECP256K1] Remove num/gmp support
Branches
Unknown
Tags
Unknown