feat(gasm): audit a .s corpus with audit-instructions --corpus

Assisted-by: GLM 5.3 Flash
This commit is contained in:
2026-09-19 19:27:30 +02:00
parent 1d0969ed64
commit 1e77e58250
3 changed files with 286 additions and 2 deletions
+25 -1
View File
@@ -338,7 +338,7 @@ add: 16 bytes, args=24, frame=0 NOSPLIT
## audit-instructions
```text
Usage: gasm audit-instructions [amd64|arm64|riscv64|loong64]
Usage: gasm audit-instructions [--corpus [dir]] [amd64|arm64|riscv64|loong64]
```
Compare the gasm encoder for the given architecture (default amd64) against the
@@ -361,6 +361,30 @@ gasm encodable: 580 go tool asm recognized: 1542
shared: 580
```
With `--corpus` the audit changes shape: it assembles every `.s` file under
DIR (default `GOROOT/src`) with the gasm encoder only, no toolchain probing.
A file whose name carries a recognisable `_arch` suffix is attempted for that
architecture; a file without one is attempted for all four, exactly as a
`GOARCH` build would compile it. The report gives the headline number (files
that assemble for every target architecture), the per-architecture pass rates
and the most common failure reasons with one representative file each, which
drive the encodability backlog by frequency rather than by table order. A run
over GOROOT takes under a second.
```sh
gasm audit-instructions --corpus
gasm audit-instructions --corpus "$(go env GOROOT)/src/crypto"
```
```text
corpus /usr/local/go/src: 627 files (365 generic, attempted for all architectures)
assemble for every target architecture: 108 (17.2%)
amd64: 77/464 attempted
148 instruction not encodable
e.g. /usr/local/go/src/cmd/asm/internal/asm/testdata/386enc.s
...
```
## scaffold
```text