tooling: record the forms of the CLZERO fixture for form coverage #1389

Merged
Maxim-Root merged 1 commit from upstream-pr/1396 into main 2026-11-24 10:45:04 +00:00
Maxim-Root commented 2026-11-24 10:29:55 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Maxim-Root on 2026-11-24T10:29:55Z.


Change

clzero is counted as unobserved in the x64 form-coverage report, although cpu_counted_clzero (#1230) translates and compares CLZERO loops and passes. tests/cpu/counted_clzero.asm has no ; coverage: first line, so tools/form_coverage.py lists it as unclassified. Adding a source line would not help either: ML64 has no CLZERO mnemonic, so the fixture spells it as db 0fh,01h,0fch and a source scan never sees it.

This PR registers the fixture the way CONTRIBUTING.md describes for such cases:

  • counted_clzero.asm gets ; coverage: record cpu_counted_clzero as its first line.
  • counted_clzero.py writes FORM_COVERAGE_RECORD after all its checks pass. It decodes the five functions it actually translates (counted, loop_dx, loop_r8, loop_r9, loop_r10) with cpu_switch_aot.translate, as switch_strings_check.py does, and asserts that clzero is among them. It removes a stale record first, so a failed run leaves none.
  • CMakeLists.txt sets the record path for cpu_counted_clzero.

The test's comparisons, its two rejection controls and its output are unchanged.

Verification

At 7261ab67+ (main), Windows 11 Pro 26300.9818, MSVC 14.44.35207, Python 3.12.10:

ctest --preset dev --no-tests=error -R '^cpu_counted_clzero$' -V
ctest --preset dev --no-tests=error -E '_hardware$' -j 16 --output-junit "$PWD/out/test-results.xml"
python -B tools/form_coverage.py out/test-results.xml --records out/build/dev/form_coverage --gaps x64_zen2
  • cpu_counted_clzero passed. Its record is add clzero cmp jb mov ret seta setb sete.
  • x64 form coverage went from 888 to 889 of 948, and the gap list from 60 to 59 rows. Integer clzero unobserved is gone. No other row changed.
  • tests/form_coverage_check.py passes.
  • Full non-hardware run, -j 16: 622/625. The three failures are not related to this change:
    • cpu_aot_jump_tables fails on main since #1374 (fix in #1388);
    • cpu_native_load_config_callback fails on this host because system CFG is off (#1366, fix in #1367);
    • xmem_shim_page_runs failed only under -j 16 load and passed 3/3 when run alone.
  • Negative control: without the CMake environment the record is not written, and the report keeps clzero as unobserved. That is the measured state on main.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture. (No new fixture. The record is written only after the existing checks pass and must contain clzero.)
  • I updated README/docs when a capability or build requirement changed. (No change. The coverage chart picks this up on the next main run.)
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted (Claude Code).

🤖 Generated with Claude Code

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6579765493 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1396). Originally posted by [Maxim-Root](https://github.com/Maxim-Root) on 2026-11-24T10:29:55Z. --- ## Change `clzero` is counted as `unobserved` in the x64 form-coverage report, although `cpu_counted_clzero` (#1230) translates and compares CLZERO loops and passes. `tests/cpu/counted_clzero.asm` has no `; coverage:` first line, so `tools/form_coverage.py` lists it as `unclassified`. Adding a `source` line would not help either: ML64 has no CLZERO mnemonic, so the fixture spells it as `db 0fh,01h,0fch` and a source scan never sees it. This PR registers the fixture the way `CONTRIBUTING.md` describes for such cases: - `counted_clzero.asm` gets `; coverage: record cpu_counted_clzero` as its first line. - `counted_clzero.py` writes `FORM_COVERAGE_RECORD` after all its checks pass. It decodes the five functions it actually translates (`counted`, `loop_dx`, `loop_r8`, `loop_r9`, `loop_r10`) with `cpu_switch_aot.translate`, as `switch_strings_check.py` does, and asserts that `clzero` is among them. It removes a stale record first, so a failed run leaves none. - `CMakeLists.txt` sets the record path for `cpu_counted_clzero`. The test's comparisons, its two rejection controls and its output are unchanged. ## Verification At `7261ab67`+ (`main`), Windows 11 Pro 26300.9818, MSVC 14.44.35207, Python 3.12.10: ```powershell ctest --preset dev --no-tests=error -R '^cpu_counted_clzero$' -V ctest --preset dev --no-tests=error -E '_hardware$' -j 16 --output-junit "$PWD/out/test-results.xml" python -B tools/form_coverage.py out/test-results.xml --records out/build/dev/form_coverage --gaps x64_zen2 ``` - `cpu_counted_clzero` passed. Its record is `add clzero cmp jb mov ret seta setb sete`. - x64 form coverage went from **888 to 889 of 948**, and the gap list from 60 to 59 rows. `Integer clzero unobserved` is gone. No other row changed. - `tests/form_coverage_check.py` passes. - Full non-hardware run, `-j 16`: 622/625. The three failures are not related to this change: - `cpu_aot_jump_tables` fails on `main` since #1374 (fix in #1388); - `cpu_native_load_config_callback` fails on this host because system CFG is off (#1366, fix in #1367); - `xmem_shim_page_runs` failed only under `-j 16` load and passed 3/3 when run alone. - Negative control: without the CMake environment the record is not written, and the report keeps `clzero` as `unobserved`. That is the measured state on `main`. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. (No new fixture. The record is written only after the existing checks pass and must contain `clzero`.) - [x] I updated README/docs when a capability or build requirement changed. (No change. The coverage chart picks this up on the next `main` run.) - [x] I did not include game files, dumps, distribution links or secrets. AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
upstream-sync closed this pull request 2026-11-24 11:02:49 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!1389
No description provided.