code wiki / (root) / nx_p256_fieldmul_mulx_bench.nx

nx_p256_fieldmul_mulx_bench.nx

buildroot/runtime/nx_p256_fieldmul_mulx_bench.nx

3256 B60 linesdepth 6pulls 7 transitivereach 0 importersview sourcekind benchtopic p256
docsdependenciesstructsconstsfunctions

about

nx_p256_fieldmul_mulx_bench.nx -- field-mul-level speed: production p256_field_mul (u256_mul_wide 8x32 + Solinas) vs p256_field_mul_mulx_s (fused __mul256_wide + the SAME Solinas, reused scratch). The Solinas reduction is IDENTICAL in both, so the delta isolates the multiply. Dependent-chain harness (DCE/hoist-proof). HONEST caveat printed: the mulx variant reuses scratch (the optimized form); the production field_mul mmaps its product buffer per call -- so this reflects a real drop-in optimized field_mul, and the ratio shows how the 53x primitive win survives Amdahl once the common (unchanged) reduce cost is included. expect_exit: 0 license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_p256_fieldmul_mulx.nx nx_p256_fieldmul_mulx_bench.nx

imports: nx_p256_fieldmul_mulx.nx

imported by: nobody (leaf or entry point)

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

main bp now_ns 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 p256_field_mul_mulx_s fmx_pack64 fmx_split32 _p256_solinas_reduce ↻ bn

structs

none

consts

9const N_MAGIC_1000000000: i64 = 1000000000
11const N_ITER: i64 = 3000000

functions

13func 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
14func bn(v: i64) -> i64
called by 1: main
20func 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
22func main() -> i64