nasm/travis/insns/cpu_write
H. Peter Anvin (Intel) 28bf46e532 tools/testgen: pseudorandom instruction test generator
Add gen-insn-tests.pl, a prototype tool that generates one travis test
directory per non-pseudo instruction mnemonic (asm + json + golden
output), by parsing x86/insns.xda (the already-generated, macro-
expanded, one-template-per-line intermediate NASM produces from
insns.dat) rather than insnsa.c/insnsb.c or hooking insns.pl.

Rationale: insnsa.c/insnsb.c encode operands as opaque bitmask
constants and index into an explicitly-unstable, shared bytecode array
(x86/bytecode.txt: byte codes can be moved and recycled at any time),
making them fragile/high-effort to parse from outside insns.pl.
insns.xda already provides exactly the needed semantic info (mnemonic,
comma-separated operand-type tokens, flags) in a small stable text
grammar, with zero changes to insns.pl or the build. We only need
valid operand *syntax* per operand-type token -- NASM picks the
encoding itself from mnemonic + operand syntax -- so the generated
tests are regression tests against a golden captured from a known-good
nasm build, consistent with the rest of travis/.

Includes UNDOC/OBSOLETE/NEVER-flagged instructions (only PSEUDO
pseudo-ops are excluded): where these emit an expected warning (e.g.
-w+obsolete-removed), the generator declares a stderr target so the
warning text itself becomes part of the golden, verifying the warning
fires rather than skipping the coverage.

Delegates golden capture to tools/travis/nasm-t.py update instead of
re-implementing it, so goldens get the harness's existing correctness
properties (reproducible-build NASMENV, path-embedding conventions,
etc.) for free.

Generated travis/insns/<mnemonic>/ for all 2432 assemblable mnemonics
(16/32/64-bit variants as applicable). Full suite validated via
tools/travis/nasm-t.py: 4225 total, 4224 PASS, 1 pre-existing SKIP,
0 FAIL.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-07-01 23:42:14 -07:00
..
cpu_write.asm tools/testgen: pseudorandom instruction test generator 2026-07-01 23:42:14 -07:00
cpu_write.bin16.t tools/testgen: pseudorandom instruction test generator 2026-07-01 23:42:14 -07:00
cpu_write.bin32.t tools/testgen: pseudorandom instruction test generator 2026-07-01 23:42:14 -07:00
cpu_write.json tools/testgen: pseudorandom instruction test generator 2026-07-01 23:42:14 -07:00
cpu_write.stderr16 tools/testgen: pseudorandom instruction test generator 2026-07-01 23:42:14 -07:00
cpu_write.stderr32 tools/testgen: pseudorandom instruction test generator 2026-07-01 23:42:14 -07:00