nx_g1_bridge_kat.nx
buildroot/runtime/nx_g1_bridge_kat.nx
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
structs
| none |
consts
| none |
functions
| 17 | func sink(x: i64) -> i64 { return x ^ 0x5a5a } // clobbers caller-saved regs called by 1: main |
| 18 | func tail_target(x: i64) -> i64 { return x + 1 } called by 1: via_tail |
| 19 | func via_tail(x: i64) -> i64 |
| 24 | func main() -> i64 |