code wiki / _hdl_build / nx_regalloc_exec_test.nx
nx_regalloc_exec_test.nx
buildroot/runtime/_hdl_build/nx_regalloc_exec_test.nx
about
nx_regalloc_exec_test.nx -- PROVE register-allocated execution is 1:1 with the
reference, on the race kernel's real arithmetic, over many inputs -- AND prove
the check CATCHES a corrupted allocation. This is the gate that makes absorbing
the allocator into codegen safe: any g1-style miscompile diverges here and fails.
v0=INPUT c, v1=INPUT acc, v2=INPUT i
v3=c*K, v4=v3+A, v5=v4>>31, v6=v4^v5(c2,live-out),
v7=v6&M, v8=acc+v7(acc1,live-out), v9=i+1(i1,live-out), v10=v9<KK
Known answer: allocation sound + 0 spills; ref==alloc for ALL random inputs; a
corrupted allocation (two overlapping vregs aliased to one register) DIVERGES
(the verifier catches the miscompile). exit 0.
dependencies 1 imports · 0 importers
imports: nx_regalloc_interp.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 27 | const RE_N: i64 = 11 |
| 28 | const RE_NREG: i64 = 8 |
| 29 | const RE_TRIALS: i64 = 256 |
| 30 | const RE_K: i64 = 6364136223846793005 |
| 31 | const RE_A: i64 = 1442695040888963407 |
| 32 | const RE_M: i64 = 65535 |
| 33 | const RE_KK: i64 = 1000000 |
functions
| 16 | func re_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 17 | func re_emit(name: *u8, v: i64) -> i64 |
| 35 | func re_rng(s: i64) -> i64 { return s * 6364136223846793005 + 1442695040888963407 } called by 1: main |
| 37 | func main() -> i64 |