cpu: lower 128-bit legacy MOVDQU and 14 SSSE3 integer vector instructions #355

Manually merged
github merged 3 commits from gh-pr/355/head into gh-pr/355/base 2026-11-26 21:45:31 +00:00
Owner

@⁠Vonsek on GitHub · 2026-11-21 23:10 UTC · original
Vonsek:ag/cpu-lower-ssse3-int → main · +353 −0 · 6 files · 3 commits · merged 2026-11-22 16:18 UTC

Change

  • Lower 128-bit legacy movdqu and 14 SSSE3 integer vector instructions (pabsb, pabsw, pabsd, psignb, psignw, psignd, pshufb, palignr, phaddw, phaddd, phsubw, phsubd, phaddsw, phsubsw) in tools/ffx_version_query.py, rejecting 64-bit MMX forms.
  • Add a source-built MASM fixture (tests/cpu/ssse3_int.asm, tests/cpu/ssse3_int.def) and differential test (tests/cpu/ssse3_int.py) wired into CMakeLists.txt as cpu_aot_ssse3_int with a host_has_ssse3() CPUID leaf 1 ECX bit 9 check and SKIP_RETURN_CODE 77 on unsupported hosts.
  • Verify bit-for-bit agreement across all 15 exports (covering INT_MIN/INT_MAX, pshufb zeroing, palignr shifts > 16, and signed 16-bit saturation) plus a synthetic 64-bit MMX pabsb rejection control.
  • Classify ssse3_int -> cpu_aot_ssse3_int in tools/form_coverage.py (+14 SSE3-4 mnemonics and movdqu in docs/coverage/x64_zen2.tsv) and document the test in docs/experiments.md.

Verification

Tested on Windows 11 (VS 2022 Build Tools 17.14, MSVC 19.44, ML64 14.44, Windows SDK 10.0.26100, Python 3.12):

  • Before the change, cmake --build --preset dev --target cpu_ssse3_int_lifted failed with:
    ValueError: unsupported query operation at 0x1000: movdqu xmm1,[rcx]
    
  • After the change:
    • cmake --build --preset dev --target cpu_ssse3_int_lifted succeeded.
    • ctest --preset dev --no-tests=error -R "^(cpu_aot_ssse3_int|cpu_aot_bmi1|cpu_aot_shift_count|cpu_aot_version_query|cpu_aot_address_size)$" -V: 5/5 passed (15 SSSE3 integer vector cases across 14 instructions matched native and translated DLLs).
    • python -B tests/form_coverage_check.py: form coverage checks passed.

Evidence and follow-up

  • Adds 14 SSE3-4 mnemonics (0/86 -> 14/86) plus movdqu (SSE2) to docs/coverage/x64_zen2.tsv coverage.
  • All binaries are source-built via MASM and CMake; no game files or external dumps are included.

Checklist

  • Focused, single-purpose change
  • Source-built test that fails without the change and passes with it
  • Verified locally on Windows
**@⁠Vonsek** on GitHub · 2026-11-21 23:10 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/355) `Vonsek:ag/cpu-lower-ssse3-int` → `main` · +353 −0 · 6 files · 3 commits · merged 2026-11-22 16:18 UTC ## Change - Lower 128-bit legacy `movdqu` and 14 SSSE3 integer vector instructions (`pabsb`, `pabsw`, `pabsd`, `psignb`, `psignw`, `psignd`, `pshufb`, `palignr`, `phaddw`, `phaddd`, `phsubw`, `phsubd`, `phaddsw`, `phsubsw`) in `tools/ffx_version_query.py`, rejecting 64-bit MMX forms. - Add a source-built MASM fixture (`tests/cpu/ssse3_int.asm`, `tests/cpu/ssse3_int.def`) and differential test (`tests/cpu/ssse3_int.py`) wired into `CMakeLists.txt` as `cpu_aot_ssse3_int` with a `host_has_ssse3()` CPUID leaf 1 ECX bit 9 check and `SKIP_RETURN_CODE 77` on unsupported hosts. - Verify bit-for-bit agreement across all 15 exports (covering `INT_MIN`/`INT_MAX`, `pshufb` zeroing, `palignr` shifts > 16, and signed 16-bit saturation) plus a synthetic 64-bit MMX `pabsb` rejection control. - Classify `ssse3_int` -> `cpu_aot_ssse3_int` in `tools/form_coverage.py` (+14 `SSE3-4` mnemonics and `movdqu` in `docs/coverage/x64_zen2.tsv`) and document the test in `docs/experiments.md`. ## Verification Tested on Windows 11 (VS 2022 Build Tools 17.14, MSVC 19.44, ML64 14.44, Windows SDK 10.0.26100, Python 3.12): - Before the change, `cmake --build --preset dev --target cpu_ssse3_int_lifted` failed with: ```text ValueError: unsupported query operation at 0x1000: movdqu xmm1,[rcx] ``` - After the change: - `cmake --build --preset dev --target cpu_ssse3_int_lifted` succeeded. - `ctest --preset dev --no-tests=error -R "^(cpu_aot_ssse3_int|cpu_aot_bmi1|cpu_aot_shift_count|cpu_aot_version_query|cpu_aot_address_size)$" -V`: 5/5 passed (`15 SSSE3 integer vector cases across 14 instructions matched native and translated DLLs`). - `python -B tests/form_coverage_check.py`: `form coverage checks passed`. ## Evidence and follow-up - Adds 14 `SSE3-4` mnemonics (`0/86 -> 14/86`) plus `movdqu` (`SSE2`) to `docs/coverage/x64_zen2.tsv` coverage. - All binaries are source-built via MASM and CMake; no game files or external dumps are included. ## Checklist - [x] Focused, single-purpose change - [x] Source-built test that fails without the change and passes with it - [x] Verified locally on Windows
Add 128-bit legacy-encoding lowering for movdqu, pabsb/w/d, psignb/w/d,
pshufb, palignr, phaddw/d, phsubw/d, phaddsw, and phsubsw in
tools/ffx_version_query.py, rejecting 64-bit MMX forms.

Add a source-built MASM differential fixture (tests/cpu/ssse3_int.asm,
tests/cpu/ssse3_int.def, tests/cpu/ssse3_int.py) with a CPUID leaf 1
ECX bit 9 (SSSE3) gate and SKIP_RETURN_CODE 77 in CMakeLists.txt,
classified in tools/form_coverage.py and documented in
docs/experiments.md.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 21:45:29 +00:00
github manually merged commit 04c60bf4cf into gh-pr/355/base 2026-11-26 21:45:31 +00:00
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-21 23:14 UTC · original · edited 2026-11-21 23:17 UTC

Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-21T23:17:23.584847Z 1750e92 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@⁠codex review" or "@⁠codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-21 23:14 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/355#issuecomment-7070736221) · edited 2026-11-21 23:17 UTC <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"1750e92ea63ff69e64e67bae34662ec96244203f","has_any_findings":false,"has_unresolved_findings":false,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} --> <details> <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-11-21T23:17:23.584847Z">2026-11-21T23:17:23.584847Z</relative-time> | `1750e92` | Draft marked ready | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@⁠codex review" or "@⁠codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details> </details>
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-22 08:15 UTC · original · requested changes

On 7729344 I decoded 66 0f 38 1c c3 c3 (pabsb xmm0,xmm3; ret). lower() raises KeyError: 80 from wide_xmm[i.op1_register]. The destination is in the supported set but the source is outside it. Please check the register source before indexing, issue the normal unsupported-operation diagnostic with the instruction address, and add this sequence as a rejection control. A valid xmm0–2 source should continue to translate.

**@⁠R0Y00** on GitHub · 2026-11-22 08:15 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/355#pullrequestreview-6011186364) · **requested changes** On 7729344 I decoded 66 0f 38 1c c3 c3 (pabsb xmm0,xmm3; ret). lower() raises KeyError: 80 from wide_xmm[i.op1_register]. The destination is in the supported set but the source is outside it. Please check the register source before indexing, issue the normal unsupported-operation diagnostic with the instruction address, and add this sequence as a rejection control. A valid xmm0–2 source should continue to translate.
This discussion has been locked. Commenting is limited to contributors.
No description provided.