cpu: add dedicated cpu_adx_aot lifter for 32-bit and 64-bit ADCX and ADOX #2890

Manually merged
github merged 3 commits from github-bot/gh-2890 into gh-pr/2890/base 2026-11-28 11:52:06 +00:00 AGit
Owner

@⁠Ammmae0x on GitHub · 2026-11-26 16:39 UTC · original
Ammmae0x:cpu/adx-aot → main · +1823 −0 · 6 files · 3 commits · merged 2026-11-28 11:47 UTC

Change

Add a dedicated standalone AOT lifter (tools/cpu_adx_aot.py), source-built MASM fixture (tests/cpu/adx_aot.asm, tests/cpu/adx_aot.def), differential/mutant/rejection check suite (tests/cpu/adx_aot_check.py), and CTest registration (tests/cmake/cpu_adx_aot.cmake) for 32-bit and 64-bit ADCX and ADOX (docs/coverage/x64_zen2.tsv group BMI/ADX).

Why a separate lifter alongside cpu_aot_adx (tools/ffx_version_query.py): cpu_aot_adx covers the shared query translator's 5 register-only exports; this slice provides a standalone flat-memory bounded leaf lifter and test harness (matching sibling dedicated leaf lifters cpu_bmi1_aot, cpu_bmi2_bit_aot, cpu_aes_pclmul_aot) adding differential memory-source ADCX/ADOX coverage, ALTER_ADX build divergence controls, 14 oracle-quirk controls, and /O2 discarded-read NULL fault verification.

  • Lowers ADCX r32, r/m32, ADCX r64, r/m64, ADOX r32, r/m32, and ADOX r64, r/m64 with exact dual-carry flag isolation (ADCX reads/writes only CF; ADOX reads/writes only OF; other flags preserved), 32-bit zero-extension into bits [63:32] (pinned directly in op_adcx32_c0, op_adox32_o0, op_adcx32_flags, and op_adox32_flags via mov rax, rcx), and unconditional load_always<>() flat [rcx|rdx|r8] memory reads so /O2 preserves faulting discarded loads.
  • Statically rejects undefined CF/OF/flag reads, ADC/SBB/VEX/EVEX/XOP, nonvolatile and high-byte GPRs, writes to argument GPRs (rcx/rdx/r8), displaced/indexed/RIP-relative memory operands, stores outside [r8], lock/rep/repne/segment prefixes, branches/calls, and missing/trailing ret.
  • Runtime CPUID check (CPUID.07H.00H:EBX[19]) runs portable lifted, /O2, ALTER_ADX, mutant, and rejection checks unconditionally before skipping native differential with exit 77 on hosts without ADX.

Verification

Commit: 362cede4 (merged with upstream/main 7e5c378d, Windows x64, MSVC 14.50):

  • cmake --build --preset dev --target cpu_adx_aot_original cpu_adx_aot_original_lifted cpu_adx_aot_altered cpu_adx_aot_altered_lifted cpu_adx cpu_adx_lifted -> exit 0.
  • ctest --preset dev --no-tests=error --output-on-failure -R '^cpu_aot_adx(_dedicated)?$' -V -> 2/2 Passed (cpu_aot_adx: 1144 cases; cpu_aot_adx_dedicated: rejections passed: 3 alt + 35 IR + 4 raw + 12 PE-patched + CLI; 1497 native + 1497 lifted + 1497 /O2 cases across 22 exports; ALTER_ADX checked on 12 exports + 14 mutants caught).
  • cmake --build --preset release --target cpu_adx_aot_original cpu_adx_aot_original_lifted cpu_adx_aot_altered cpu_adx_aot_altered_lifted cpu_adx cpu_adx_lifted -> exit 0.
  • ctest --preset release --no-tests=error --output-on-failure -R '^cpu_aot_adx(_dedicated)?$' -V -> 2/2 Passed (0 skips).
  • out\pe-env\Scripts\python.exe -B tests\form_coverage_check.py, tests\docs_links_check.py (154 md / 677 links), tests\bidi_controls_check.py (2542 files) -> all exit 0.

Evidence and follow-up

All fixtures are original source-built MASM leaf functions (tests/cpu/adx_aot.asm, MIT-licensed) with deterministic synthetic inputs, ALTER_ADX build divergence controls, 14 oracle-quirk controls, and /O2 discarded-read NULL fault verification; zero external or game files are used.

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.

**@⁠Ammmae0x** on GitHub · 2026-11-26 16:39 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2890) `Ammmae0x:cpu/adx-aot` → `main` · +1823 −0 · 6 files · 3 commits · merged 2026-11-28 11:47 UTC ## Change Add a dedicated standalone AOT lifter (`tools/cpu_adx_aot.py`), source-built MASM fixture (`tests/cpu/adx_aot.asm`, `tests/cpu/adx_aot.def`), differential/mutant/rejection check suite (`tests/cpu/adx_aot_check.py`), and CTest registration (`tests/cmake/cpu_adx_aot.cmake`) for 32-bit and 64-bit `ADCX` and `ADOX` (`docs/coverage/x64_zen2.tsv` group `BMI/ADX`). Why a separate lifter alongside `cpu_aot_adx` (`tools/ffx_version_query.py`): `cpu_aot_adx` covers the shared query translator's 5 register-only exports; this slice provides a standalone flat-memory bounded leaf lifter and test harness (matching sibling dedicated leaf lifters `cpu_bmi1_aot`, `cpu_bmi2_bit_aot`, `cpu_aes_pclmul_aot`) adding differential memory-source `ADCX`/`ADOX` coverage, `ALTER_ADX` build divergence controls, 14 oracle-quirk controls, and `/O2` discarded-read NULL fault verification. - Lowers `ADCX r32, r/m32`, `ADCX r64, r/m64`, `ADOX r32, r/m32`, and `ADOX r64, r/m64` with exact dual-carry flag isolation (`ADCX` reads/writes only `CF`; `ADOX` reads/writes only `OF`; other flags preserved), 32-bit zero-extension into bits `[63:32]` (pinned directly in `op_adcx32_c0`, `op_adox32_o0`, `op_adcx32_flags`, and `op_adox32_flags` via `mov rax, rcx`), and unconditional `load_always<>()` flat `[rcx|rdx|r8]` memory reads so `/O2` preserves faulting discarded loads. - Statically rejects undefined `CF`/`OF`/flag reads, `ADC`/`SBB`/VEX/EVEX/XOP, nonvolatile and high-byte GPRs, writes to argument GPRs (`rcx`/`rdx`/`r8`), displaced/indexed/RIP-relative memory operands, stores outside `[r8]`, `lock`/`rep`/`repne`/segment prefixes, branches/calls, and missing/trailing `ret`. - Runtime CPUID check (`CPUID.07H.00H:EBX[19]`) runs portable lifted, `/O2`, `ALTER_ADX`, mutant, and rejection checks unconditionally before skipping native differential with exit `77` on hosts without ADX. ## Verification Commit: `362cede4` (merged with `upstream/main` `7e5c378d`, Windows x64, MSVC 14.50): - `cmake --build --preset dev --target cpu_adx_aot_original cpu_adx_aot_original_lifted cpu_adx_aot_altered cpu_adx_aot_altered_lifted cpu_adx cpu_adx_lifted` -> exit 0. - `ctest --preset dev --no-tests=error --output-on-failure -R '^cpu_aot_adx(_dedicated)?$' -V` -> 2/2 Passed (`cpu_aot_adx`: 1144 cases; `cpu_aot_adx_dedicated`: `rejections passed: 3 alt + 35 IR + 4 raw + 12 PE-patched + CLI`; `1497 native + 1497 lifted + 1497 /O2 cases across 22 exports; ALTER_ADX checked on 12 exports + 14 mutants caught`). - `cmake --build --preset release --target cpu_adx_aot_original cpu_adx_aot_original_lifted cpu_adx_aot_altered cpu_adx_aot_altered_lifted cpu_adx cpu_adx_lifted` -> exit 0. - `ctest --preset release --no-tests=error --output-on-failure -R '^cpu_aot_adx(_dedicated)?$' -V` -> 2/2 Passed (0 skips). - `out\pe-env\Scripts\python.exe -B tests\form_coverage_check.py`, `tests\docs_links_check.py` (154 md / 677 links), `tests\bidi_controls_check.py` (2542 files) -> all exit 0. ## Evidence and follow-up All fixtures are original source-built MASM leaf functions (`tests/cpu/adx_aot.asm`, MIT-licensed) with deterministic synthetic inputs, `ALTER_ADX` build divergence controls, 14 oracle-quirk controls, and `/O2` discarded-read NULL fault verification; zero external or game files are used. ## 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 01:28:02 +00:00
Author
Owner

@⁠pigalot on GitHub · 2026-11-27 19:58 UTC · original · reviewed

I reviewed 4f7b8544 merged into main 454fc0ed (tree 93c1b101, clean merge).

What I ran. I built the four cpu_adx_aot_* targets in dev, then ran:
ctest --test-dir out/build/dev --no-tests=error -j 1 -V -R '^cpu_aot_adx(_dedicated)?$'

  • Both tests pass.
  • cpu_aot_adx_dedicated reports 1497 native + 1497 lifted + 1497 /O2 cases across 22 exports; ALTER_ADX checked on 12 exports + 14 mutants caught.
  • git diff --check is clean.

The host has ADX (RTX 5090 machine, Windows 11 25H2 build 26200.9974, MSVC 19.52.37029, Python 3.12.10), so neither test skipped.

main already lowers these four forms.

  • tools/ffx_version_query.py lowers ADCX / ADOX r32 and r64, including memory sources through operand(1). That arrived in #335 (2620000f).

  • tests/cpu/adx.asm is the fixture for it. Its header is ; coverage: source cpu_aot_adx, so form_coverage already counts adcx and adox as covered. This PR adds no new forms to x64_zen2.tsv's BMI/ADX group.

  • I ran main's ffx_version_query.lower on this PR's built cpu_adx_aot_original.dll. It lowers all of the following without refusal:

    • op_adcx32_mem, op_adcx64_mem, op_adox32_mem, op_adox64_mem;
    • op_adcx64_mem_flags, op_adox64_mem_flags;
    • op_adx_dst_alias, op_adx_discarded_read, op_adx_dual64_adcx.

    That shows translation only. I didn't run those lowered bodies differentially.

So the body doesn't say what this lifter adds over cpu_aot_adx. It also covers less: flat [rcx|rdx|r8] addressing only.

What this PR does have that main lacks. Differential cases for memory-source ADX, /O2 builds, and the ALTER_ADX mutants. Those look worth keeping. A smaller change could add them to tests/cpu/adx.asm and tests/cpu/adx.py, so they test the lifter the runtime uses, without adding 693 lines of a second ADX lowering that will need to be kept in step with the first.

Verdict: comment on 4f7b8544. The code works as described. Whether a second, dedicated ADX lifter is wanted is the maintainer's call. If it is, please add a line to the body saying why cpu_aot_adx isn't enough.

CI: all required checks pass on 4f7b8544. There are no reviews or threads.

This reply was AI-assisted.

**@⁠pigalot** on GitHub · 2026-11-27 19:58 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2890#pullrequestreview-6092846051) · **reviewed** I reviewed `4f7b8544` merged into `main` `454fc0ed` (tree `93c1b101`, clean merge). **What I ran.** I built the four `cpu_adx_aot_*` targets in `dev`, then ran: `ctest --test-dir out/build/dev --no-tests=error -j 1 -V -R '^cpu_aot_adx(_dedicated)?$'` - Both tests pass. - `cpu_aot_adx_dedicated` reports `1497 native + 1497 lifted + 1497 /O2 cases across 22 exports; ALTER_ADX checked on 12 exports + 14 mutants caught`. - `git diff --check` is clean. The host has ADX (RTX 5090 machine, Windows 11 25H2 build 26200.9974, MSVC 19.52.37029, Python 3.12.10), so neither test skipped. **`main` already lowers these four forms.** - `tools/ffx_version_query.py` lowers `ADCX` / `ADOX` r32 and r64, including memory sources through `operand(1)`. That arrived in #335 (`2620000f`). - `tests/cpu/adx.asm` is the fixture for it. Its header is `; coverage: source cpu_aot_adx`, so `form_coverage` already counts `adcx` and `adox` as covered. This PR adds no new forms to `x64_zen2.tsv`'s `BMI/ADX` group. - I ran `main`'s `ffx_version_query.lower` on this PR's built `cpu_adx_aot_original.dll`. It lowers all of the following without refusal: - `op_adcx32_mem`, `op_adcx64_mem`, `op_adox32_mem`, `op_adox64_mem`; - `op_adcx64_mem_flags`, `op_adox64_mem_flags`; - `op_adx_dst_alias`, `op_adx_discarded_read`, `op_adx_dual64_adcx`. That shows translation only. I didn't run those lowered bodies differentially. So the body doesn't say what this lifter adds over `cpu_aot_adx`. It also covers less: flat `[rcx|rdx|r8]` addressing only. **What this PR does have that `main` lacks.** Differential cases for memory-source ADX, `/O2` builds, and the `ALTER_ADX` mutants. Those look worth keeping. A smaller change could add them to `tests/cpu/adx.asm` and `tests/cpu/adx.py`, so they test the lifter the runtime uses, without adding 693 lines of a second ADX lowering that will need to be kept in step with the first. **Verdict:** comment on `4f7b8544`. The code works as described. Whether a second, dedicated ADX lifter is wanted is the maintainer's call. If it is, please add a line to the body saying why `cpu_aot_adx` isn't enough. CI: all required checks pass on `4f7b8544`. There are no reviews or threads. This reply was AI-assisted.
Author
Owner

@⁠JohnConnorNPC on GitHub · 2026-11-28 08:17 UTC · original

I reviewed 4f7b8544 without building it. The lowering looks correct to me, and nothing here should block a merge. If a dedicated ADX lifter is wanted, I'd merge it once the first item below is fixed.

What I checked

  • The merge into current main (1f07b2c1) is clean: git merge-tree --write-tree origin/main pr/2890 → rc=0. The cpu_leaf_aot.py helpers this PR imports, bounded_code and export_rva, have the same AST on both bases.
  • The carry rule in op_adcx64/op_adox64 is sum < dst || (cin != 0 && sum == dst), which is the formula main already uses (tools/ffx_version_query.py: {flag} = v < a || ({flag} && v == a)). ref_adx also writes only CF for adcx and only OF for adox.
  • CI passes, but the Windows job runs ctest --preset pr (100% tests passed out of 40), and grep -ci adx on that job log gives 0. So cpu_aot_adx_dedicated has only been run locally so far.

Suggestions

  1. Nothing observes the 32-bit zero-extension that ADCX/ADOX do themselves. All 8 32-bit exports run mov rax, -1 and then mov eax, ecx right before the ADX instruction (git show pr/2890:tests/cpu/adx_aot.asm | grep -c 'mov eax, ecx' → 8). That mov already clears bits [63:32]. So a lowering that kept the destination's upper half would still pass the native, lifted and /O2 checks, and no_zext32 would still be caught. Using mov rax, rcx in at least one ADCX r32 and one ADOX r32 export would pin it: 48 of the 60 test pairs have a nonzero upper half in a, and the expected values don't change.
  2. The earlier review asked for a line in the body on why cpu_aot_adx isn't enough. The body doesn't have it yet (grep -c -E 'cpu_aot_adx\b|ffx_version_query' → 0).
  3. Minor: the checklist says docs were updated, but the diff touches no file under docs/. cpu_aot_adx has a paragraph in docs/experiments.md, so a short one for this test would help. Also, the body says prefixes are rejected, but only lock, rep and segment prefixes are; a redundant 66 before ADCX is accepted. That's harmless, but the wording could be narrower.

This comment was AI-assisted.

**@⁠JohnConnorNPC** on GitHub · 2026-11-28 08:17 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2890#issuecomment-7236491332) I reviewed `4f7b8544` without building it. The lowering looks correct to me, and nothing here should block a merge. If a dedicated ADX lifter is wanted, I'd merge it once the first item below is fixed. **What I checked** - The merge into current `main` (`1f07b2c1`) is clean: `git merge-tree --write-tree origin/main pr/2890` → rc=0. The `cpu_leaf_aot.py` helpers this PR imports, `bounded_code` and `export_rva`, have the same AST on both bases. - The carry rule in `op_adcx64`/`op_adox64` is `sum < dst || (cin != 0 && sum == dst)`, which is the formula `main` already uses (`tools/ffx_version_query.py`: `{flag} = v < a || ({flag} && v == a)`). `ref_adx` also writes only CF for `adcx` and only OF for `adox`. - CI passes, but the Windows job runs `ctest --preset pr` (`100% tests passed out of 40`), and `grep -ci adx` on that job log gives `0`. So `cpu_aot_adx_dedicated` has only been run locally so far. **Suggestions** 1. Nothing observes the 32-bit zero-extension that ADCX/ADOX do themselves. All 8 32-bit exports run `mov rax, -1` and then `mov eax, ecx` right before the ADX instruction (`git show pr/2890:tests/cpu/adx_aot.asm | grep -c 'mov eax, ecx'` → `8`). That `mov` already clears bits [63:32]. So a lowering that kept the destination's upper half would still pass the native, lifted and `/O2` checks, and `no_zext32` would still be caught. Using `mov rax, rcx` in at least one ADCX r32 and one ADOX r32 export would pin it: 48 of the 60 test pairs have a nonzero upper half in `a`, and the expected values don't change. 2. The earlier review asked for a line in the body on why `cpu_aot_adx` isn't enough. The body doesn't have it yet (`grep -c -E 'cpu_aot_adx\b|ffx_version_query'` → `0`). 3. Minor: the checklist says docs were updated, but the diff touches no file under `docs/`. `cpu_aot_adx` has a paragraph in `docs/experiments.md`, so a short one for this test would help. Also, the body says prefixes are rejected, but only lock, rep and segment prefixes are; a redundant `66` before ADCX is accepted. That's harmless, but the wording could be narrower. This comment was AI-assisted.
Author
Owner

@⁠Ammmae0x on GitHub · 2026-11-28 11:15 UTC · original

Addressed all items from pigalot and JohnConnorNPC in 362cede4 (merged with upstream/main 7e5c378d):

  • 32-bit zero-extension pinning (tests/cpu/adx_aot.asm): replaced mov rax, -1; mov eax, ecx with mov rax, rcx in op_adcx32_c0, op_adox32_o0, op_adcx32_flags, and op_adox32_flags so nonzero upper bits in rcx[63:32] reach adcx eax, edx / adox eax, edx directly and only 32-bit zero-extension clears bits [63:32].
  • Docs (docs/experiments.md): added the cpu_aot_adx_dedicated paragraph alongside cpu_aot_adx with reproduction commands and measured counts.
  • PR body: added the rationale for keeping a standalone cpu_adx_aot leaf lifter alongside cpu_aot_adx, narrowed the rejected-prefix wording to lock/rep/repne/segment prefixes, and updated the verification receipt.

Verified in both dev and release (/O2): cpu_aot_adx and cpu_aot_adx_dedicated both pass (1497 native/lifted//O2 cases across 22 exports, 14 mutants, 54+ rejections), and form_coverage_check.py / docs_links_check.py / bidi_controls_check.py exit 0.

AI-assisted.

**@⁠Ammmae0x** on GitHub · 2026-11-28 11:15 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2890#issuecomment-7238428494) Addressed all items from pigalot and JohnConnorNPC in `362cede4` (merged with `upstream/main` `7e5c378d`): - **32-bit zero-extension pinning (`tests/cpu/adx_aot.asm`)**: replaced `mov rax, -1; mov eax, ecx` with `mov rax, rcx` in `op_adcx32_c0`, `op_adox32_o0`, `op_adcx32_flags`, and `op_adox32_flags` so nonzero upper bits in `rcx[63:32]` reach `adcx eax, edx` / `adox eax, edx` directly and only 32-bit zero-extension clears bits `[63:32]`. - **Docs (`docs/experiments.md`)**: added the `cpu_aot_adx_dedicated` paragraph alongside `cpu_aot_adx` with reproduction commands and measured counts. - **PR body**: added the rationale for keeping a standalone `cpu_adx_aot` leaf lifter alongside `cpu_aot_adx`, narrowed the rejected-prefix wording to `lock`/`rep`/`repne`/segment prefixes, and updated the verification receipt. Verified in both `dev` and `release` (`/O2`): `cpu_aot_adx` and `cpu_aot_adx_dedicated` both pass (`1497` native/lifted/`/O2` cases across 22 exports, 14 mutants, 54+ rejections), and `form_coverage_check.py` / `docs_links_check.py` / `bidi_controls_check.py` exit 0. AI-assisted.
github-bot changed target branch from main to gh-pr/2890/base 2026-11-28 11:52:00 +00:00
github manually merged commit 362cede4bc into gh-pr/2890/base 2026-11-28 11:52:06 +00:00
Author
Owner

@⁠pigalot on GitHub · 2026-11-28 11:47 UTC · original · approved these changes

Retested 362cede4 integrated over main 24fcd0b5 (tree f32478ac, clean merge). This follows my comment review on 4f7b8544.

Earlier points

  • Why a second ADX lifter (mine). The body now says it: cpu_aot_adx covers the shared translator's five register-only exports, and this one is a bounded leaf lifter in the same style as cpu_bmi1_aot, cpu_bmi2_bit_aot and cpu_aes_pclmul_aot, which main already carries. That answers my question, so I'm dropping it.
  • 32-bit zero-extension not observed (JohnConnorNPC, item 1). Fixed. op_adcx32_c0, op_adox32_o0, op_adcx32_flags and op_adox32_flags now use mov rax, rcx, so the upper half reaches the instruction. I checked it with a lifter mutant that keeps the destination's bits [63:32] for the 32-bit forms:
    • at this head it fails: lifted op_adcx32_c0(0xffffffffffffffff, 0x0): got 0xffffffffffffffff != exp 0xffffffff;
    • with tests/cpu/adx_aot.asm put back to its 4f7b8544 version, the same mutant passes all 1497 + 1497 + 1497 cases. So the old fixture could not see it and the new one does.
  • Docs paragraph and prefix wording (JohnConnorNPC, items 2 and 3). docs/experiments.md has the cpu_aot_adx_dedicated paragraph, and the body now names lock/rep/repne/segment prefixes only.

What I ran
Built cpu_adx_aot_original, cpu_adx_aot_original_lifted, cpu_adx_aot_altered, cpu_adx_aot_altered_lifted, cpu_adx and cpu_adx_lifted in dev and release, then
ctest --test-dir out/build/<preset> --no-tests=error -j 1 -V -R '^cpu_aot_adx(_dedicated)?$':

  • 2/2 passed in Debug and in Release /O2, no skips (the host has ADX).
  • cpu_aot_adx_dedicated: rejections passed: 3 alt + 35 IR + 4 raw + 12 PE-patched + CLI and 1497 native + 1497 lifted + 1497 /O2 cases across 22 exports; ALTER_ADX checked on 12 exports + 14 mutants caught.
  • cpu_aot_adx: 1144 cases, unchanged.
  • On main 24fcd0b5 the test is not registered (the PR only adds files, plus two lines in docs/experiments.md).

After a full dev build, the ^cpu_ family plus form_coverage, coverage_svg and the coverage CLI checks: 320 non-hardware tests passed and 1 skipped (cpu_aot_sysdesc, a capability skip that this PR does not touch). tests/form_coverage_check.py, tests/docs_links_check.py (155 files, 677 links) and tests/bidi_controls_check.py exit 0. git diff --cached --check origin/main is clean.

Lifter mutants (each applied to tools/cpu_adx_aot.py, lifted DLLs rebuilt, cpu_aot_adx_dedicated rerun in dev)

Killed, 14:

  • keep bits [63:32] on 32-bit forms (see above);
  • drop the sum == dst carry term in op_adcx64, and the same in op_adox64 (op_adcx64_flags / op_adox64_flags at (0xffffffffffffffff, 0xffffffffffffffff));
  • drop the carry-in in op_adcx32 (op_adcx32_c1(0x0, 0x0): got 0x0 != exp 0x1);
  • op_adox32 writes CF instead of OF;
  • map ADOX r32 to the adcx helper;
  • invert seto;
  • remove volatile from load_always (lifted_o2 op_adx_discarded_read(NULL) dropped faulting m64 read, so the /O2 control is real);
  • accept stores through a base other than r8, displaced operands, segment prefixes, writes to argument registers, an undefined flag read by ADX, and OF as defined after shl by more than 1.

Equivalent, 1: removing the memory-size check in flat_address. The decoder fixes the operand size from the instruction code for every form the lifter accepts, so that branch cannot fire. Fine as a guard.

Survived: none.

Notes, none blocking

  • cpu_aot_adx_dedicated is not in the pr preset, so CI on this head has not run it; the results above are local.
  • The semantics match what main already uses for these forms in tools/ffx_version_query.py: the destination and the one carry flag are written, the other flags are left alone, and 32-bit destinations are zero-extended.

Environment: Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; Python 3.12.10; ADX-capable host. No GPU tests are part of this result.
CI: Build and test on Windows passes on 362cede4.

Approving 362cede4.

This reply was AI-assisted.

**@⁠pigalot** on GitHub · 2026-11-28 11:47 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2890#pullrequestreview-6097607465) · **approved these changes** Retested `362cede4` integrated over `main` `24fcd0b5` (tree `f32478ac`, clean merge). This follows my comment review on `4f7b8544`. **Earlier points** - *Why a second ADX lifter (mine).* The body now says it: `cpu_aot_adx` covers the shared translator's five register-only exports, and this one is a bounded leaf lifter in the same style as `cpu_bmi1_aot`, `cpu_bmi2_bit_aot` and `cpu_aes_pclmul_aot`, which `main` already carries. That answers my question, so I'm dropping it. - *32-bit zero-extension not observed (JohnConnorNPC, item 1).* Fixed. `op_adcx32_c0`, `op_adox32_o0`, `op_adcx32_flags` and `op_adox32_flags` now use `mov rax, rcx`, so the upper half reaches the instruction. I checked it with a lifter mutant that keeps the destination's bits [63:32] for the 32-bit forms: - at this head it fails: `lifted op_adcx32_c0(0xffffffffffffffff, 0x0): got 0xffffffffffffffff != exp 0xffffffff`; - with `tests/cpu/adx_aot.asm` put back to its `4f7b8544` version, the same mutant passes all 1497 + 1497 + 1497 cases. So the old fixture could not see it and the new one does. - *Docs paragraph and prefix wording (JohnConnorNPC, items 2 and 3).* `docs/experiments.md` has the `cpu_aot_adx_dedicated` paragraph, and the body now names `lock`/`rep`/`repne`/segment prefixes only. **What I ran** Built `cpu_adx_aot_original`, `cpu_adx_aot_original_lifted`, `cpu_adx_aot_altered`, `cpu_adx_aot_altered_lifted`, `cpu_adx` and `cpu_adx_lifted` in `dev` and `release`, then `ctest --test-dir out/build/<preset> --no-tests=error -j 1 -V -R '^cpu_aot_adx(_dedicated)?$'`: - 2/2 passed in Debug and in Release `/O2`, no skips (the host has ADX). - `cpu_aot_adx_dedicated`: `rejections passed: 3 alt + 35 IR + 4 raw + 12 PE-patched + CLI` and `1497 native + 1497 lifted + 1497 /O2 cases across 22 exports; ALTER_ADX checked on 12 exports + 14 mutants caught`. - `cpu_aot_adx`: 1144 cases, unchanged. - On `main` `24fcd0b5` the test is not registered (the PR only adds files, plus two lines in `docs/experiments.md`). After a full `dev` build, the `^cpu_` family plus `form_coverage`, `coverage_svg` and the coverage CLI checks: 320 non-hardware tests passed and 1 skipped (`cpu_aot_sysdesc`, a capability skip that this PR does not touch). `tests/form_coverage_check.py`, `tests/docs_links_check.py` (155 files, 677 links) and `tests/bidi_controls_check.py` exit 0. `git diff --cached --check origin/main` is clean. **Lifter mutants** (each applied to `tools/cpu_adx_aot.py`, lifted DLLs rebuilt, `cpu_aot_adx_dedicated` rerun in `dev`) Killed, 14: - keep bits [63:32] on 32-bit forms (see above); - drop the `sum == dst` carry term in `op_adcx64`, and the same in `op_adox64` (`op_adcx64_flags` / `op_adox64_flags` at `(0xffffffffffffffff, 0xffffffffffffffff)`); - drop the carry-in in `op_adcx32` (`op_adcx32_c1(0x0, 0x0): got 0x0 != exp 0x1`); - `op_adox32` writes CF instead of OF; - map `ADOX r32` to the `adcx` helper; - invert `seto`; - remove `volatile` from `load_always` (`lifted_o2 op_adx_discarded_read(NULL) dropped faulting m64 read`, so the `/O2` control is real); - accept stores through a base other than `r8`, displaced operands, segment prefixes, writes to argument registers, an undefined flag read by ADX, and OF as defined after `shl` by more than 1. Equivalent, 1: removing the memory-size check in `flat_address`. The decoder fixes the operand size from the instruction code for every form the lifter accepts, so that branch cannot fire. Fine as a guard. Survived: none. **Notes, none blocking** - `cpu_aot_adx_dedicated` is not in the `pr` preset, so CI on this head has not run it; the results above are local. - The semantics match what `main` already uses for these forms in `tools/ffx_version_query.py`: the destination and the one carry flag are written, the other flags are left alone, and 32-bit destinations are zero-extended. Environment: Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; Python 3.12.10; ADX-capable host. No GPU tests are part of this result. CI: `Build and test on Windows` passes on `362cede4`. Approving `362cede4`. This reply was AI-assisted.
This discussion has been locked. Commenting is limited to contributors.
No description provided.