cpu: lower VLDMXCSR and VSTMXCSR in the host-MXCSR profile #1130

Closed
github-bot wants to merge 1 commit from gh-pr/1130/head into gh-pr/1130/base
Owner

@⁠tedin7 on GitHub · 2026-11-24 01:35 UTC · original
tedin7:x2w-cpu-host-mxcsr-vex → main · +403 −62 · 6 files · 1 commits · closed without merging

Change

Lowers the VEX.128 MXCSR forms VLDMXCSR and VSTMXCSR (L=0, vvvv=1111, 32-bit memory operand) under the opt-in host-MXCSR profile, with the same checks and refusal statuses as LDMXCSR and STMXCSR. The default profile still refuses them. Malformed VEX encodings (L=1, vvvv other than 1111) do not decode as either instruction and are refused. Refs #1093.

AI-assisted. The change is one shared-lowerer branch plus the fixture, test, docs and CMake wiring.

Verification

Run on Linux (llvm-ml-19 and lld-link-19 build the fixture DLL, the repo venv runs the Python):

  • default-profile refusal: 26 MXCSR instructions refused one at a time (8 LDMXCSR, 6 STMXCSR, 7 VLDMXCSR, 5 VSTMXCSR).
  • malformed VEX: 4 encodings (L=1 and vvvv=1110, load and store) refused by region and lower; the same bytes with the payload byte set to 0xF8 lower.
  • all 9 mutation variants (2 existing, 7 new) emit the translated C++ with their replacements.
  • Negative control: with tools/ffx_version_query.py from origin/main the new check fails with unsupported query operation ... vldmxcsr dword ptr [rcx]; with this change it passes.
  • python3 -B tests/docs_links_check.py: passed.

Not run here (needs Windows MSVC and ML64): ctest --preset dev --no-tests=error -R '^cpu_aot_mxcsr(_vex_native)?$' -V, the translated-readback checks (mxcsr_vex_round, the two mixed exports, leak, refused words, fault), the seven new controls' violations, the /O2 walk and the native AVX comparison. The CI Windows jobs are the first run of these.

Evidence and follow-up

  • The fixture is source-built (tests/cpu/mxcsr.asm); the four malformed encodings are written as bytes and are never executed.
  • The translated VEX and mixed exports are checked against fixed per-mode expectations and the native legacy mxcsr_round, so that check needs no AVX. cpu_aot_mxcsr_vex_native compares the native VEX exports and skips with 77 without AVX.
  • New controls: vexnoload, vexfixed, vexunmasked, mixvldload, mixvstread, mixvstentry, mixvldrestore; each must break a rule in its own export.
  • Docs: docs/experiments.md host-MXCSR paragraph updated. Not covered: VEX.256.

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.
**@⁠tedin7** on GitHub · 2026-11-24 01:35 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1130) `tedin7:x2w-cpu-host-mxcsr-vex` → `main` · +403 −62 · 6 files · 1 commits · closed without merging ## Change Lowers the VEX.128 MXCSR forms `VLDMXCSR` and `VSTMXCSR` (L=0, vvvv=1111, 32-bit memory operand) under the opt-in host-MXCSR profile, with the same checks and refusal statuses as `LDMXCSR` and `STMXCSR`. The default profile still refuses them. Malformed VEX encodings (L=1, vvvv other than 1111) do not decode as either instruction and are refused. Refs #1093. AI-assisted. The change is one shared-lowerer branch plus the fixture, test, docs and CMake wiring. ## Verification Run on Linux (llvm-ml-19 and lld-link-19 build the fixture DLL, the repo venv runs the Python): - default-profile refusal: 26 MXCSR instructions refused one at a time (8 LDMXCSR, 6 STMXCSR, 7 VLDMXCSR, 5 VSTMXCSR). - malformed VEX: 4 encodings (L=1 and vvvv=1110, load and store) refused by `region` and `lower`; the same bytes with the payload byte set to 0xF8 lower. - all 9 mutation variants (2 existing, 7 new) emit the translated C++ with their replacements. - Negative control: with `tools/ffx_version_query.py` from origin/main the new check fails with `unsupported query operation ... vldmxcsr dword ptr [rcx]`; with this change it passes. - `python3 -B tests/docs_links_check.py`: passed. Not run here (needs Windows MSVC and ML64): `ctest --preset dev --no-tests=error -R '^cpu_aot_mxcsr(_vex_native)?$' -V`, the translated-readback checks (`mxcsr_vex_round`, the two mixed exports, leak, refused words, fault), the seven new controls' violations, the /O2 walk and the native AVX comparison. The CI Windows jobs are the first run of these. ## Evidence and follow-up - The fixture is source-built (`tests/cpu/mxcsr.asm`); the four malformed encodings are written as bytes and are never executed. - The translated VEX and mixed exports are checked against fixed per-mode expectations and the native legacy `mxcsr_round`, so that check needs no AVX. `cpu_aot_mxcsr_vex_native` compares the native VEX exports and skips with 77 without AVX. - New controls: `vexnoload`, `vexfixed`, `vexunmasked`, `mixvldload`, `mixvstread`, `mixvstentry`, `mixvldrestore`; each must break a rule in its own export. - Docs: `docs/experiments.md` host-MXCSR paragraph updated. Not covered: VEX.256. ## 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.
VEX.128 VLDMXCSR and VSTMXCSR lower exactly like LDMXCSR and STMXCSR under the opt-in host-MXCSR profile and stay refused in the default one. Malformed VEX encodings (L=1, vvvv!=1111) are refused. The fixture covers all-VEX and mixed legacy/VEX exports; the translation needs no AVX and a separate test compares native VEX exports where AVX exists.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 22:44:00 +00:00
github-bot closed this pull request 2026-11-26 22:44:01 +00:00
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-24 02:08 UTC · original · edited 2026-11-24 02:15 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-24T02:15:20.772646Z 6510597 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-24 02:08 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1130#issuecomment-7119801083) · edited 2026-11-24 02:15 UTC <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"65105974185531ef1849734328ada45b1cf2cf79","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-24T02:15:20.772646Z">2026-11-24T02:15:20.772646Z</relative-time> | `6510597` | 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-24 02:17 UTC · original

Thanks for building this in parallel. The shared VLDMXCSR/VSTMXCSR lowering is implemented in #1134, which also landed separate native and fixed-reference tests. If you see a distinct case in this branch that still adds coverage, it can be reviewed as a test-only diff against current main.

**@⁠R0Y00** on GitHub · 2026-11-24 02:17 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1130#issuecomment-7119969718) Thanks for building this in parallel. The shared VLDMXCSR/VSTMXCSR lowering is implemented in #1134, which also landed separate native and fixed-reference tests. If you see a distinct case in this branch that still adds coverage, it can be reviewed as a test-only diff against current main.
Author
Owner

@⁠tedin7 on GitHub · 2026-11-24 03:27 UTC · original

Thank you for #1134. The shared lowering and its tests cover the same behavior as this branch, so I am closing this PR (AI-assisted).

The cases this branch had that #1134 does not pin are now a test-only change in #1181, as you suggested: the lowering itself refusing malformed VEX loads and stores (store forms included), an unmasked-exception control, and one control per MXCSR instruction of the mixed exports. Nothing in tools/ changes there.

**@⁠tedin7** on GitHub · 2026-11-24 03:27 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1130#issuecomment-7121115061) Thank you for #1134. The shared lowering and its tests cover the same behavior as this branch, so I am closing this PR (AI-assisted). The cases this branch had that #1134 does not pin are now a test-only change in #1181, as you suggested: the lowering itself refusing malformed VEX loads and stores (store forms included), an unmasked-exception control, and one control per MXCSR instruction of the mixed exports. Nothing in `tools/` changes there.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.