code wiki / (root) / nx_p256_fieldmul_3way_bench.nx

nx_p256_fieldmul_3way_bench.nx

buildroot/runtime/nx_p256_fieldmul_3way_bench.nx

5357 B94 linesdepth 6pulls 7 transitivereach 0 importersview sourcekind benchtopic p256
docsdependenciesstructsconstsfunctions

about

nx_p256_fieldmul_3way_bench.nx -- DEFINITIVE single-run decomposition of the P-256 field-mul win: [0] production = u256_mul_wide (8x32 sw) + production Solinas [1] mulx-only = fused __mul256_wide + production Solinas [2] full-opt = fused __mul256_wide + deferred-carry fast Solinas All three timed back-to-back on the same machine state against the SAME inputs, so the ratios are directly comparable (kills the cross-run wall-clock variance). Correctness pre-check on both variants. Dependent-chain (DCE/hoist-proof). Uses __mul256_wide -> nx_cand_build_run. expect_exit: 0 license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_p256_solinas_fast.nx nx_p256_fieldmul_3way_bench.nx

imports: nx_p256_solinas_fast.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main lcg p256_field_mul nx_scratch_save nx_scratch_init sys_mmap u256_wide_alloc nx_scratch nx_scratch_init ↻ nx_scratch_oom sys_write sys_exit sys_mmap ↻ u256_mul_wide _p256_solinas_reduce u256_alloc nx_scratch ↻ p256_field_load_p nx_scratch ↻ _r_reduce9 _r_cmp8 nx_scratch_restore fm_mulx pack_split_mul _p256_solinas_reduce ↻ fm_full pack_split_mul ↻ _p256_solinas_reduce_fast u256_alloc ↻ p256_field_load_p ↻ _r_reduce9 ↻ _r_cmp8 ↻ bp bn now_ns

structs

none

consts

10const N_MAGIC_1000000000: i64 = 1000000000
11const N_MAGIC_6364136223846793005: i64 = 6364136223846793005
12const N_MAGIC_1442695040888963407: i64 = 1442695040888963407
13const N_MAGIC_2000: i64 = 2000
15const N_ITER: i64 = 3000000

functions

17func bp(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
called by 1: main
18func bn(v: i64) -> i64
called by 1: main
24func now_ns(ts: *i64) -> i64 { __syscall(SYS_CLOCK_GETTIME, 1, ts as i64, 0, 0, 0, 0); return ts[0] * N_MAGIC_1000000000 + ts[1] }
called by 1: main
25func lcg(st: *i64) -> i64 { let x: i64 = st[0] * N_MAGIC_6364136223846793005 + N_MAGIC_1442695040888963407; st[0] = x; return x }
called by 1: main
27func pack_split_mul(a: *i64, b: *i64, a64: *i64, b64: *i64, prod: *i64, c16: *i64) -> i64
called by 2: fm_mulxfm_full
34func fm_mulx(out8: *i64, a: *i64, b: *i64, a64: *i64, b64: *i64, prod: *i64, c16: *i64) -> i64
37func fm_full(out8: *i64, a: *i64, b: *i64, a64: *i64, b64: *i64, prod: *i64, c16: *i64) -> i64
41func main() -> i64