cpu: lower xsaveopt and xsaveopt64 in the XSAVE state translator #1320

Merged
tedin7 merged 2 commits from upstream-pr/1327 into main 2026-11-24 08:36:52 +00:00
tedin7 commented 2026-11-24 08:10:43 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T08:10:43Z.


Change

Lower xsaveopt and xsaveopt64 in the bounded XSAVE state translator (tools/cpu_xsave_aot.py), a direct follow-up of the xsavec lowering. They keep the standard format and apply the init optimization only: a component that is not in use is not written and its XSTATE_BV bit is cleared, XSTATE_BV = (old & ~RFBM) | (XINUSE & RFBM), and MXCSR/MXCSR_MASK are stored whenever RFBM selects SSE or AVX. SSE counts as in use while MXCSR differs from 0x1F80, so a restored non-default MXCSR keeps its XMM slot. Alignment and request-mask faults are raised before the first store, so a rejected call leaves memory intact. The modified optimization (XMODIFIED) is not modeled: the lifted code writes every component that is in use, which is a superset of what a CPU may write.

AI-assisted. No issue is claimed. 6 files because the fixture needs its export list in four places (asm, def, CMake, checker) next to the translator and the docs entry.

Verification

Run on Linux (llvm-ml-19 + lld-link-19 for the fixture, MinGW -O0/-O2 for the lifted C++, Wine on a host CPU with XSAVEOPT; the Python checks drive the DLLs through a small Wine caller because the repo harness needs Windows ctypes):

  • Native fixture vs lifted vs Python reference: 170 differential cases over 17 defined exports (50 new xsaveopt cases = 5 exports x 10 XSTATE_BV/MXCSR images) matched; ALTER_OP (standard xsave64 in place of xsaveopt64, request mask 7 in place of 2) diverged on 9/10 and 7/10 images.
  • Layout readback against an independent SDM oracle (not the Python model): 50 cases check XSTATE_BV, the MXCSR words and that every byte outside the components in use is still the sentinel, for lifted and native.
  • 18 comparator mutation controls fail as required: flipped FCW, ST0, XMM0, YMM_HI0 and XSTATE_BV bytes (lifted and native), xsave in place of xsaveopt, XSTATE_BV without the RFBM mask, a reference that ignores non-default MXCSR (fails at byte 160), live bytes in a component the reference leaves out, a host that omits live XMM.
  • 4 mutated lifted implementations are each killed by the layout readback: all components written, XSTATE_BV without & RFBM, no MXCSR liveness, MXCSR stored only for SSE.
  • 30 misaligned-output checks (native and lifted, +16/+8/+1), 10 invalid-MXCSR restores, 5 valid dynamic masks and 5 unsupported masks: #GP and the output buffer intact.
  • 7 alternate-encoding lift checks, 39 unit rejection controls (the old xsaveopt rejection is replaced by default-profile and non-r8 store rejections) and 10 PE-patched rejection controls pass.
  • Fails on current main: tools/cpu_xsave_aot.py there stops with unsupported XSAVE-family instruction ... xsaveopt64 [r8] on the new fixture.
  • git diff --check, tests/docs_links_check.py, tests/bidi_controls_check.py pass.

Not run here: the MSVC build and the repo harness on Windows. Outside --preset pr; to run on Windows (Debug and /O2): ctest --preset dev -R '^cpu_aot_xsave_state$'.

Evidence and follow-up

The fixture is source-built MASM (tests/cpu/xsave_state.asm), no external binaries. A native probe on the host CPU (xrstor64 of one buffer, xsave64 and xsaveopt64 into others, all 7 RFBM values x 8 XSTATE_BV x 2 MXCSR x 2 payloads) matched the layout above, with two host-specific facts the comparator tolerates: standard-format saves there did not report XSTATE_BV[1] for a non-default MXCSR with zero XMM (the lifted store keeps it, as xsavec does), and a zero-valued component restored with its bit set was reported as not in use (the fixtures use non-zero payloads). xsaveopt64 to the same buffer that was just restored omitted the restored x87 area (modified optimization), so the fixtures restore from rcx and save to r8. Existing note: xsave with RFBM = 4 does not store MXCSR here while the host does; left untouched, follow-up. Remaining follow-ups: xsaves, xrstors, compacted xrstor.

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.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6577449358 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1327). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T08:10:43Z. --- ## Change Lower `xsaveopt` and `xsaveopt64` in the bounded XSAVE state translator (`tools/cpu_xsave_aot.py`), a direct follow-up of the `xsavec` lowering. They keep the standard format and apply the init optimization only: a component that is not in use is not written and its `XSTATE_BV` bit is cleared, `XSTATE_BV = (old & ~RFBM) | (XINUSE & RFBM)`, and `MXCSR`/`MXCSR_MASK` are stored whenever `RFBM` selects SSE or AVX. SSE counts as in use while `MXCSR` differs from `0x1F80`, so a restored non-default `MXCSR` keeps its XMM slot. Alignment and request-mask faults are raised before the first store, so a rejected call leaves memory intact. The modified optimization (`XMODIFIED`) is not modeled: the lifted code writes every component that is in use, which is a superset of what a CPU may write. AI-assisted. No issue is claimed. 6 files because the fixture needs its export list in four places (asm, def, CMake, checker) next to the translator and the docs entry. ## Verification Run on Linux (llvm-ml-19 + lld-link-19 for the fixture, MinGW `-O0`/`-O2` for the lifted C++, Wine on a host CPU with XSAVEOPT; the Python checks drive the DLLs through a small Wine caller because the repo harness needs Windows ctypes): - Native fixture vs lifted vs Python reference: 170 differential cases over 17 defined exports (50 new xsaveopt cases = 5 exports x 10 XSTATE_BV/MXCSR images) matched; `ALTER_OP` (standard `xsave64` in place of `xsaveopt64`, request mask 7 in place of 2) diverged on 9/10 and 7/10 images. - Layout readback against an independent SDM oracle (not the Python model): 50 cases check `XSTATE_BV`, the `MXCSR` words and that every byte outside the components in use is still the sentinel, for lifted and native. - 18 comparator mutation controls fail as required: flipped `FCW`, `ST0`, `XMM0`, `YMM_HI0` and `XSTATE_BV` bytes (lifted and native), `xsave` in place of `xsaveopt`, `XSTATE_BV` without the `RFBM` mask, a reference that ignores non-default `MXCSR` (fails at byte 160), live bytes in a component the reference leaves out, a host that omits live XMM. - 4 mutated lifted implementations are each killed by the layout readback: all components written, `XSTATE_BV` without `& RFBM`, no `MXCSR` liveness, `MXCSR` stored only for SSE. - 30 misaligned-output checks (native and lifted, +16/+8/+1), 10 invalid-`MXCSR` restores, 5 valid dynamic masks and 5 unsupported masks: #GP and the output buffer intact. - 7 alternate-encoding lift checks, 39 unit rejection controls (the old `xsaveopt` rejection is replaced by default-profile and non-`r8` store rejections) and 10 PE-patched rejection controls pass. - Fails on current main: `tools/cpu_xsave_aot.py` there stops with `unsupported XSAVE-family instruction ... xsaveopt64 [r8]` on the new fixture. - `git diff --check`, `tests/docs_links_check.py`, `tests/bidi_controls_check.py` pass. Not run here: the MSVC build and the repo harness on Windows. Outside `--preset pr`; to run on Windows (Debug and `/O2`): `ctest --preset dev -R '^cpu_aot_xsave_state$'`. ## Evidence and follow-up The fixture is source-built MASM (`tests/cpu/xsave_state.asm`), no external binaries. A native probe on the host CPU (xrstor64 of one buffer, xsave64 and xsaveopt64 into others, all 7 RFBM values x 8 XSTATE_BV x 2 MXCSR x 2 payloads) matched the layout above, with two host-specific facts the comparator tolerates: standard-format saves there did not report `XSTATE_BV[1]` for a non-default `MXCSR` with zero XMM (the lifted store keeps it, as xsavec does), and a zero-valued component restored with its bit set was reported as not in use (the fixtures use non-zero payloads). `xsaveopt64` to the same buffer that was just restored omitted the restored x87 area (modified optimization), so the fixtures restore from `rcx` and save to `r8`. Existing note: `xsave` with `RFBM = 4` does not store `MXCSR` here while the host does; left untouched, follow-up. Remaining follow-ups: `xsaves`, `xrstors`, compacted `xrstor`. ## 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.
upstream-sync closed this pull request 2026-11-24 09:04:32 +00:00
chatgpt-codex-connector[bot commented 2026-11-24 09:04:32 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T08:18:15Z.

Review: COMMENTED


💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0ecae4ec19

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6035798314 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1327#pullrequestreview-6035798314). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T08:18:15Z. **Review:** COMMENTED --- <!-- codex-review-receipt:v1 --> ### 💡 Codex Review Here are some automated review suggestions for this pull request. **Reviewed commit:** `0ecae4ec19` <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". If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". </details>
tedin7 commented 2026-11-24 09:04:32 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T08:31:21Z.

Review: COMMENTED


No description provided.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6035950800 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1327#pullrequestreview-6035950800). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T08:31:21Z. **Review:** COMMENTED --- _No description provided._
tedin7 commented 2026-11-24 09:04:43 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T08:12:22Z.


Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207) at 0ecae4ec:

  • Debug (--preset dev): ctest --preset dev -R "^cpu_aot_xsave_state$" — 1/1 PASS (0.33s, build 3.56s)
  • Release /O2 (--preset release): ctest --preset release -R "^cpu_aot_xsave_state$" — 1/1 PASS (0.35s, build 1.10s)
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7125852201 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1327#issuecomment-7125852201). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T08:12:22Z. --- Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207) at `0ecae4ec`: - Debug (`--preset dev`): `ctest --preset dev -R "^cpu_aot_xsave_state$"` — **1/1 PASS** (`0.33s`, build `3.56s`) - Release `/O2` (`--preset release`): `ctest --preset release -R "^cpu_aot_xsave_state$"` — **1/1 PASS** (`0.35s`, build `1.10s`)
tedin7 commented 2026-11-24 09:04:45 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T08:31:23Z.


AI-assisted fix for the MXCSR finding: MXCSR is now tracked separately from the SSE/AVX components, so vzeroupper no longer counts as defining it. A save that stores MXCSR is rejected (error names MXCSR) unless an xrstor selecting SSE or AVX loaded it, or --entry-state canonical is requested. xsave/xsavec accepted cases are unchanged. Regression cases are in tests/cpu/xsave_state_check.py. @codex review

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7126237407 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1327#issuecomment-7126237407). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T08:31:23Z. --- AI-assisted fix for the MXCSR finding: MXCSR is now tracked separately from the SSE/AVX components, so vzeroupper no longer counts as defining it. A save that stores MXCSR is rejected (error names MXCSR) unless an xrstor selecting SSE or AVX loaded it, or --entry-state canonical is requested. xsave/xsavec accepted cases are unchanged. Regression cases are in tests/cpu/xsave_state_check.py. @codex review
tedin7 commented 2026-11-24 09:04:45 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T08:34:11Z.


Re-verified after the MXCSR-tracking fix (23376f943d495eed02efd688cf9c3290c0875714) on Windows Server 2025 (Build 26100, MSVC 14.44.35207):

  • Debug (--preset dev): cpu_xsave_state_* build 3.11s; ctest --preset dev -R '^cpu_aot_xsave_state$' --no-tests=error --output-on-failure: 1/1 passed (0.32s)
  • Release /O2 (--preset release): cpu_xsave_state_* build 0.62s; ctest --preset release -R '^cpu_aot_xsave_state$' --no-tests=error --output-on-failure: 1/1 passed (0.31s)
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7126293954 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1327#issuecomment-7126293954). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T08:34:11Z. --- Re-verified after the MXCSR-tracking fix (`23376f943d495eed02efd688cf9c3290c0875714`) on Windows Server 2025 (Build 26100, MSVC 14.44.35207): - **Debug (`--preset dev`)**: `cpu_xsave_state_*` build `3.11s`; `ctest --preset dev -R '^cpu_aot_xsave_state$' --no-tests=error --output-on-failure`: **1/1 passed** (`0.32s`) - **Release `/O2` (`--preset release`)**: `cpu_xsave_state_*` build `0.62s`; `ctest --preset release -R '^cpu_aot_xsave_state$' --no-tests=error --output-on-failure`: **1/1 passed** (`0.31s`)
chatgpt-codex-connector[bot commented 2026-11-24 09:04:46 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T08:35:57Z.


Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 23376f943d

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7126330176 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1327#issuecomment-7126330176). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T08:35:57Z. --- <!-- codex-review-receipt:v1 --> Codex Review: Didn't find any major issues. Nice work! **Reviewed commit:** `23376f943d` <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". If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". </details>
chatgpt-codex-connector[bot commented 2026-11-24 09:04:46 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T08:12:38Z.


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-24T08:35:58.988325Z 23376f9 Manual request
ℹ️ 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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7125857609 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1327#issuecomment-7125857609). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T08:12:38Z. --- <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"23376f943d495eed02efd688cf9c3290c0875714","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-24T08:35:58.988325Z">2026-11-24T08:35:58.988325Z</relative-time> | `23376f9` | Manual request | <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>
chatgpt-codex-connector[bot commented 2026-11-24 09:04:49 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T08:18:15Z.

Code review location: tools/cpu_xsave_aot.py; line 833

@@ -790,9 +828,9 @@ def require_xsave_masks(ins):
             statements.append("return;")
             returned = True
 
-        elif ins.code in XSAVE_CODES or ins.code in XSAVEC_CODES:
-            is64 = {**XSAVE_CODES, **XSAVEC_CODES}[ins.code]
-            op_name = "op_xsavec" if ins.code in XSAVEC_CODES else "op_xsave"
+        elif ins.code in XSAVE_CODES or ins.code in XSAVEC_CODES or ins.code in XSAVEOPT_CODES:
+            is64 = {**XSAVE_CODES, **XSAVEC_CODES, **XSAVEOPT_CODES}[ins.code]
+            op_name = "op_xsavec" if ins.code in XSAVEC_CODES else "op_xsaveopt" if ins.code in XSAVEOPT_CODES else "op_xsave"

P2 Badge Track MXCSR definition for AVX-only XSAVEOPT

With the default defined profile, vzeroupper; mov eax, 4; xor edx, edx; xsaveopt64 [r8]; ret is accepted because vzeroupper marks AVX as defined, but no instruction defines MXCSR. op_xsaveopt nevertheless stores MXCSR for RFBM = 4, so it writes XState's default 0x1F80 instead of the incoming value. An isolated Linux/x86-64 native-versus-emitted-helper probe at both -O0 and -O2 produced 0x3F80 versus 0x1F80 at offset 24 for the same non-default entry state. Track MXCSR definition separately, including restores selecting SSE or AVX, or reject this case unless canonical entry was explicitly requested.

Useful? React with 👍 / 👎.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4677227988 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1327#discussion_r4677227988). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T08:18:15Z. **Code review location:** `tools/cpu_xsave_aot.py`; line 833 ~~~~diff @@ -790,9 +828,9 @@ def require_xsave_masks(ins): statements.append("return;") returned = True - elif ins.code in XSAVE_CODES or ins.code in XSAVEC_CODES: - is64 = {**XSAVE_CODES, **XSAVEC_CODES}[ins.code] - op_name = "op_xsavec" if ins.code in XSAVEC_CODES else "op_xsave" + elif ins.code in XSAVE_CODES or ins.code in XSAVEC_CODES or ins.code in XSAVEOPT_CODES: + is64 = {**XSAVE_CODES, **XSAVEC_CODES, **XSAVEOPT_CODES}[ins.code] + op_name = "op_xsavec" if ins.code in XSAVEC_CODES else "op_xsaveopt" if ins.code in XSAVEOPT_CODES else "op_xsave" ~~~~ --- **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Track MXCSR definition for AVX-only XSAVEOPT** With the default `defined` profile, `vzeroupper; mov eax, 4; xor edx, edx; xsaveopt64 [r8]; ret` is accepted because `vzeroupper` marks AVX as defined, but no instruction defines MXCSR. `op_xsaveopt` nevertheless stores MXCSR for `RFBM = 4`, so it writes `XState`'s default `0x1F80` instead of the incoming value. An isolated Linux/x86-64 native-versus-emitted-helper probe at both `-O0` and `-O2` produced `0x3F80` versus `0x1F80` at offset 24 for the same non-default entry state. Track MXCSR definition separately, including restores selecting SSE or AVX, or reject this case unless canonical entry was explicitly requested. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
tedin7 commented 2026-11-24 09:04:49 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T08:31:21Z.

Code review location: tools/cpu_xsave_aot.py; line 833

@@ -790,9 +828,9 @@ def require_xsave_masks(ins):
             statements.append("return;")
             returned = True
 
-        elif ins.code in XSAVE_CODES or ins.code in XSAVEC_CODES:
-            is64 = {**XSAVE_CODES, **XSAVEC_CODES}[ins.code]
-            op_name = "op_xsavec" if ins.code in XSAVEC_CODES else "op_xsave"
+        elif ins.code in XSAVE_CODES or ins.code in XSAVEC_CODES or ins.code in XSAVEOPT_CODES:
+            is64 = {**XSAVE_CODES, **XSAVEC_CODES, **XSAVEOPT_CODES}[ins.code]
+            op_name = "op_xsavec" if ins.code in XSAVEC_CODES else "op_xsaveopt" if ins.code in XSAVEOPT_CODES else "op_xsave"

Fixed in 23376f9.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4677349640 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1327#discussion_r4677349640). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T08:31:21Z. **Code review location:** `tools/cpu_xsave_aot.py`; line 833 ~~~~diff @@ -790,9 +828,9 @@ def require_xsave_masks(ins): statements.append("return;") returned = True - elif ins.code in XSAVE_CODES or ins.code in XSAVEC_CODES: - is64 = {**XSAVE_CODES, **XSAVEC_CODES}[ins.code] - op_name = "op_xsavec" if ins.code in XSAVEC_CODES else "op_xsave" + elif ins.code in XSAVE_CODES or ins.code in XSAVEC_CODES or ins.code in XSAVEOPT_CODES: + is64 = {**XSAVE_CODES, **XSAVEC_CODES, **XSAVEOPT_CODES}[ins.code] + op_name = "op_xsavec" if ins.code in XSAVEC_CODES else "op_xsaveopt" if ins.code in XSAVEOPT_CODES else "op_xsave" ~~~~ --- Fixed in 23376f9.
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!1320
No description provided.