Mamy Ratsimbazafy c6d9a213f2
Rework assembly to be compatible with LTO (#231)
* rework assembler register/mem and constraint declarations

* Introduce constraint UnmutatedPointerToWriteMem

* Create invidual memory cell operands

* [Assembly] fully support indirect memory addressing

* fix calling convention for exported procs

* Prepare for switch to intel syntax to avoid clang constant propagation asm symbol name interfering OR pointer+offset addressing

* use modifiers to prevent bad string mixin fo assembler to linker of propagated consts

* Assembly: switch to intel syntax

* with working memory operand - now works with LTO on both GCC and clang and constant folding

* use memory operand in more places

* remove some inline now that we have lto

* cleanup compiler config and benches

* tracer shouldn't force dependencies when unused

* fix cc on linux

* nimble fixes

* update README [skip CI]

* update MacOS CI with Homebrew Clang

* oops nimble bindings disappeared

* more nimble fixes

* fix sha256 exported symbol

* improve constraints on modular addition

* Add extra constraint to force reloading of pointer in reg inputs

* Fix LLVM gold linker running out of registers

* workaround MinGW64 GCC 12.2 bad codegen in t_pairing_cyclotomic_subgroup with LTO
2023-04-26 06:58:31 +02:00
..
2023-02-24 09:47:36 +01:00
2022-04-27 14:59:14 +02:00
2023-01-24 02:32:28 +01:00
2022-08-14 09:48:10 +02:00

BigInt and Finite Field Arithmetic

This folder contains the implementation of

  • big integers
  • finite field arithmetic (i.e. modular arithmetic)

As a tradeoff between speed, code size and compiler-enforced dependent type checking, the library is structured the following way:

  • Finite Field: statically parametrized by an elliptic curve
  • Big Integers: statically parametrized by the bit width of the field modulus
  • Limbs: statically parametrized by the number of words to handle the bitwidth

This allows to reuse the same implementation at the limbs-level for curves that required the same number of words to save on code size, for example secp256k1 and BN254. It also enables compiler unrolling, inlining and register optimization, where code size is not an issue for example for multi-precision addition.

Algorithms

Finite field multiplication

Square roots