code wiki / _hdl_build / nx_race_native_opt.nx

nx_race_native_opt.nx

buildroot/runtime/_hdl_build/nx_race_native_opt.nx

1564 B38 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tooltopic race
docsdependenciesstructsconstsfunctions

about

nx_race_native_opt.nx -- "OURS, OPTIMIZED": the SAME MINSTD LCG as nx_race_native, but with the mod-by-(2^31-1) DIVIDE replaced by MERSENNE STRENGTH-REDUCTION (shifts/adds) -- exactly the optimization gcc -O2 applies automatically. Since 2^31 == 1 (mod 2^31-1), p mod (2^31-1) = fold the 31-bit halves. PURPOSE: prove the measured ~1.7x Nishi-vs-gcc-O2 gap is PURELY auto-strength-reduction (nx_cc doesn't do it yet) -- when the optimization is expressed, Nishi's sovereign codegen reaches the optimizing-gcc frontier. MUST print 668950819 (identical to the divide version) or the reduction is wrong. license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_race_native_opt.nx

imports: nx_syscalls.nx

imported by: nobody (leaf or entry point)

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

main putn sys_mmap sys_write sys_write ↻

structs

none

consts

8const K_MAGIC_50000000: i64 = 50000000
9const K_MAGIC_48271: i64 = 48271
10const K_MAGIC_2147483647: i64 = 2147483647

functions

11func putn(v: i64) -> i64
called by 1: main calls 2: sys_mmapsys_write
24func main() -> i64
calls 2: putnsys_write