code wiki / _hdl_build / nx_selfix.nx

nx_selfix.nx

buildroot/runtime/_hdl_build/nx_selfix.nx

1911 B38 linesdepth 4pulls 5 transitivereach 1 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_selfix.nx -- the team SELF-FIXES its diagnosed gap. Last loop it read the competitor's machine code and reported "the generator LACKS: imul". This closes that itself: a strategy TOOLKIT {shift-add chain, imul} with COST-based self-selection. For a constant it tries the chain; if the chain can't reach the constant (a gap) OR the chain's cost (~latency = its instruction count of 1-cycle ops) exceeds imul's ~3-cycle latency, it falls back to imul. So the team now handles EVERY constant, picking the cost-best strategy on its own -- the generator's gaps are closed with the very op it diagnosed it was missing. license_tier: ORIGINAL

dependencies 2 imports · 1 importers

nx_mulchain.nx nx_superopt_emit.nx nx_selfix.nx nx_selfix_test.nx

imports: nx_mulchain.nxnx_superopt_emit.nx

imported by: nx_selfix_test.nx

structs

none

consts

12const SFX_CHAIN: i64 = 0
13const SFX_IMUL: i64 = 1

functions

17func selfix_emit(c: i64, dd: *i64, nin: i64, buf: *u8, icnt: *i64, strat: *i64) -> i64
38func sfx_name(s: i64) -> *u8 { if s == SFX_IMUL { return "imul" as *u8 } return "chain" as *u8 }
called by 1: sf_report