Skip to content

crypto: Use local accumulator t[] in mul_amm_256 to avoid aliasing#1477

Open
chfast wants to merge 1 commit intomasterfrom
crypto/modexp_n4_cpp
Open

crypto: Use local accumulator t[] in mul_amm_256 to avoid aliasing#1477
chfast wants to merge 1 commit intomasterfrom
crypto/modexp_n4_cpp

Conversation

@chfast
Copy link
Copy Markdown
Member

@chfast chfast commented Apr 2, 2026

Use a local array t[4] instead of writing directly to the output span r, which may alias the inputs x or y. This allows the compiler to keep the accumulator in registers without reloading after stores. The result is copied to r at the end.

~6% speedup on 256-bit modexp benchmarks (25846 → 24256 cycles).

Use a local array t[4] instead of writing directly to the output
span r, which may alias the inputs x or y. This allows the compiler
to keep the accumulator in registers without reloading after stores.
The result is copied to r at the end.

~6% speedup on 256-bit modexp benchmarks (25846 → 24256 cycles).
@chfast chfast force-pushed the crypto/modexp_n4_cpp branch from 57c8426 to 6e5a998 Compare April 2, 2026 16:51
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.79%. Comparing base (27a16a1) to head (6e5a998).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1477   +/-   ##
=======================================
  Coverage   96.79%   96.79%           
=======================================
  Files         154      154           
  Lines       13932    13934    +2     
  Branches     3265     3265           
=======================================
+ Hits        13486    13488    +2     
  Misses        306      306           
  Partials      140      140           
Flag Coverage Δ
eest-develop 92.76% <100.00%> (+<0.01%) ⬆️
eest-develop-gmp 28.06% <0.00%> (-0.01%) ⬇️
eest-legacy 15.24% <0.00%> (-0.01%) ⬇️
eest-libsecp256k1 29.78% <100.00%> (+0.01%) ⬆️
evmone-unittests 91.51% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
core 95.94% <100.00%> (+<0.01%) ⬆️
tooling 85.03% <ø> (ø)
tests 99.77% <ø> (ø)
Files with missing lines Coverage Δ
lib/evmone_precompiles/mulmod.cpp 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant