code wiki / _hdl_build / nx_modtest.nx
nx_modtest.nx
buildroot/runtime/_hdl_build/nx_modtest.nx
about
nx_modtest.nx -- MODOPT-001 gate witness: a hot loop with x % 2^k (% 1024).
Production compiler emits IDIV (slow); with the opt_strength_reduce % 2^k -> & (2^k-1) patch the
compiler should emit AND (fast). The RESULT must be identical either way (correctness); the .s
changes idivq -> andq (the win). i is a loop counter (>= 1) so VRA should prove non-negative.
dependencies 2 imports · 0 importers
imports: nx_syscalls.nxnx_estr.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
| 7 | const K_MAGIC_50000000: i64 = 50000000 |
| 8 | const K_MAGIC_1024: i64 = 1024 |
functions
| 12 | func main() -> i64 |