cpu: skip native ADOX in cpu_aot_x87_compare on hosts without ADX #557

Merged
lukaslw-lab merged 1 commit from upstream-pr/563 into main 2026-11-22 12:51:45 +00:00
lukaslw-lab commented 2026-11-22 12:43:17 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-11-22T12:43:17Z.


Change

cpu_aot_x87_compare no longer crashes on CPUs without ADX. Fixes #562.

add_fcomi_of (#535) executes adox natively, which faults with 0xc000001d without ADX; the translated DLL doesn't need ADX. The CPUID check that cpu_aot_adx already uses (leaf 7 EBX bit 19) becomes a shared HOST_HAS_ADX constant in tests/cpu/adx.py and is also exported from the translated x87_compare DLL. Without ADX, only the native add_fcomi_of is left out: every other native and translated case, the x87_call preservation check, the seven controls and the rejections still run and still fail on a mismatch. The test then exits 77 (SKIP_RETURN_CODE added). With ADX nothing changes.

Overlap: #548 edits check_rejections() in tests/cpu/x87_compare.py; this change doesn't touch that function.

Verification

Commit 97f9322 (on upstream/main b1be506), Windows 10 22H2 (build 19045), Intel Core i7-4790K (no ADX), Visual Studio 2026 18.12 (MSVC 19.52), Windows SDK 10.0.26100, CMake 4.3.1, Python 3.13.7.

ctest --preset dev --no-tests=error -R '^cpu_aot_x87_compare$' -V
12230 cases over 12 exports (output block and guards) matched the reference in native and translated DLLs; ...
control keepof: 211/12230 mismatches
Host CPU lacks ADX (CPUID leaf 7 EBX bit 19): native add_fcomi_of not run; every other check passed. Skipping.
cpu_aot_x87_compare ...***Skipped

Before this change, at c4d5e8e: OSError: [WinError -1073741795] Windows Error 0xc000001d in the native add_fcomi_of; the other 11 native exports and all 12 translated exports ran.

Negative control: the keepof control DLL passed as the translated DLL still fails without ADX (AssertionError: lifted: 211/12230 mismatches, exit 1), so the skip can't hide a translation error.

With ADX: the same change at a5a4c67 (before the rebase) on the windows-2025 runner in my fork: all four workflow jobs pass, and cpu_aot_adx and cpu_aot_x87_compare report Passed in both Windows jobs (219/219).

CPU area locally at 97f9322: ctest --preset dev --no-tests=error -R '^cpu_': 111 tests, 108 passed, 0 failed, 3 skipped (capability, exit 77): cpu_aot_crypto_sha, cpu_aot_adx and cpu_aot_x87_compare.

Evidence and follow-up

  • No new fixture. The detection is the existing cpu_aot_adx code, moved into a constant.
  • Other tests that execute native ADX or other optional ISA extensions without a CPUID check would fail the same way on older CPUs. In a full local run on this PC, cpu_aot_x87_compare was the only failure of that kind.

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.
  • I updated README/docs when a capability or build requirement changed.
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted: prepared with Claude Code; the commands and results above were run on the author's PC.

🤖 Generated with Claude Code

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6542521927 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/563). Originally posted by [lukaslw-lab](https://github.com/lukaslw-lab) on 2026-11-22T12:43:17Z. --- ## Change `cpu_aot_x87_compare` no longer crashes on CPUs without ADX. Fixes #562. `add_fcomi_of` (#535) executes `adox` natively, which faults with `0xc000001d` without ADX; the translated DLL doesn't need ADX. The CPUID check that `cpu_aot_adx` already uses (leaf 7 EBX bit 19) becomes a shared `HOST_HAS_ADX` constant in `tests/cpu/adx.py` and is also exported from the translated x87_compare DLL. Without ADX, only the native `add_fcomi_of` is left out: every other native and translated case, the `x87_call` preservation check, the seven controls and the rejections still run and still fail on a mismatch. The test then exits 77 (`SKIP_RETURN_CODE` added). With ADX nothing changes. Overlap: #548 edits `check_rejections()` in `tests/cpu/x87_compare.py`; this change doesn't touch that function. ## Verification Commit `97f9322` (on `upstream/main` `b1be506`), Windows 10 22H2 (build 19045), Intel Core i7-4790K (no ADX), Visual Studio 2026 18.12 (MSVC 19.52), Windows SDK 10.0.26100, CMake 4.3.1, Python 3.13.7. ```powershell ctest --preset dev --no-tests=error -R '^cpu_aot_x87_compare$' -V ``` ```text 12230 cases over 12 exports (output block and guards) matched the reference in native and translated DLLs; ... control keepof: 211/12230 mismatches Host CPU lacks ADX (CPUID leaf 7 EBX bit 19): native add_fcomi_of not run; every other check passed. Skipping. cpu_aot_x87_compare ...***Skipped ``` Before this change, at `c4d5e8e`: `OSError: [WinError -1073741795] Windows Error 0xc000001d` in the native `add_fcomi_of`; the other 11 native exports and all 12 translated exports ran. **Negative control:** the `keepof` control DLL passed as the translated DLL still fails without ADX (`AssertionError: lifted: 211/12230 mismatches`, exit 1), so the skip can't hide a translation error. **With ADX:** the same change at `a5a4c67` (before the rebase) on the `windows-2025` runner in my fork: all four workflow jobs pass, and `cpu_aot_adx` and `cpu_aot_x87_compare` report Passed in both Windows jobs (219/219). CPU area locally at `97f9322`: `ctest --preset dev --no-tests=error -R '^cpu_'`: 111 tests, 108 passed, 0 failed, 3 skipped (capability, exit 77): `cpu_aot_crypto_sha`, `cpu_aot_adx` and `cpu_aot_x87_compare`. ## Evidence and follow-up - No new fixture. The detection is the existing `cpu_aot_adx` code, moved into a constant. - Other tests that execute native ADX or other optional ISA extensions without a CPUID check would fail the same way on older CPUs. In a full local run on this PC, `cpu_aot_x87_compare` was the only failure of that kind. ## 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. - [x] I updated README/docs when a capability or build requirement changed. - [x] I did not include game files, dumps, distribution links or secrets. _AI-assisted: prepared with Claude Code; the commands and results above were run on the author's PC._ 🤖 Generated with [Claude Code](https://claude.com/claude-code)
upstream-sync closed this pull request 2026-11-24 06:43:42 +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!557
No description provided.