code wiki / (root) / nx_g1_bridge_kat.nx

nx_g1_bridge_kat.nx

buildroot/runtime/nx_g1_bridge_kat.nx

2299 B49 linesdepth 0pulls 0 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_g1_bridge_kat.nx -- reusable register-survival KAT for codegen changes. Exercises the two correctness hazards that any callee-saved-register or cross-call register-allocation change must not break: (1) a value produced BEFORE a call and consumed AFTER it (the call, and in particular a result-unused call, must not corrupt a resident value); (2) a value in the CALLER that must survive a callee which itself performs a TAIL call (the tail-call frame teardown must restore callee-saved regs before jumping, or it corrupts the caller). Pure integer arithmetic with closed-form expected sums -> deterministic exit 0 on pass, nonzero on any miscompile. Self-contained (no imports) so it compiles under any backend. Used by bench/nx_codegen_selfhost_gauntlet.sh. expect_exit: 0 license_tier: ORIGINAL

dependencies 0 imports · 0 importers

imports: none

imported by: nobody (leaf or entry point)

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

main sink via_tail tail_target

structs

none

consts

none

functions

17func sink(x: i64) -> i64 { return x ^ 0x5a5a } // clobbers caller-saved regs
called by 1: main
18func tail_target(x: i64) -> i64 { return x + 1 }
called by 1: via_tail
19func via_tail(x: i64) -> i64
called by 1: main calls 1: tail_target
24func main() -> i64
calls 2: sinkvia_tail