code wiki / (root) / nx_x86_64_arith_test.nx

nx_x86_64_arith_test.nx

buildroot/runtime/nx_x86_64_arith_test.nx

2356 B69 linesdepth 4pulls 5 transitivereach 0 importersview sourcekind gate/prooftopic x86
docsdependenciesstructsconstsfunctions

about

nx_x86_64_arith_test.nx -- session 4 smoke for mul/div/shift/bitwise. Computes ((7 * 6) - 30) / 4 = 3 entirely on the x86_64 stack machine, ASCII-encodes the result (0x30 + 3 = '3') and writes one byte to stdout. Validates imulq + subq + cqo + idivq. Then ALSO does: (0xFF & 0x0F) | 0x40 = 0x4F = 'O' -- and/or (5 ^ 3) << 1 = 12 -> '<' -- xor/shlq_imm not(~0xFFFFFFFFFFFFFFFB) = 5 -> '5' -- notq + neg But the SMOKE asserts ONLY the first one to keep things minimal. Stdout: "3" (one byte 0x33).

dependencies 3 imports · 0 importers

syscalls.nx nx_outbuf.nx nx_x86_64.nx nx_x86_64_arith_test.nx

imports: syscalls.nxnx_outbuf.nxnx_x86_64.nx

imported by: nobody (leaf or entry point)

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

main out_new sys_mmap out_str out_char x86_emit_function_start x86_emit_section_text out_str ↻ out_str ↻ out_char ↻ x86_emit_label out_str ↻ out_char ↻ x86_emit_movabsq out_str ↻ out_i64 out_char ↻ sys_mmap ↻ out_char ↻ x86_emit_syscall out_str ↻ x86_emit_function_end out_str ↻ out_char ↻ x86_emit_prologue x86_round_up_16 out_str ↻ out_i64 ↻ x86_emit_imulq_rr out_str ↻ out_char ↻ x86_emit_subq_rr out_str ↻ out_char ↻ x86_emit_cqo out_str ↻ x86_emit_idivq_r out_str ↻ out_char ↻ x86_emit_addq_rr

structs

none

consts

none

functions

18func main() -> i64