cpu: lower AVX quadword move and byte-masked store #1011

Merged
Ammmae0x merged 4 commits from upstream-pr/1018 into main 2026-11-23 23:01:59 +00:00
Ammmae0x commented 2026-11-23 21:29:09 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Ammmae0x on 2026-11-23T21:29:09Z.


Change

Add a bounded leaf translator (tools/cpu_avx_fp_move_aot.py), MASM differential fixture (tests/cpu/avx_fp_move.asm, tests/cpu/avx_fp_move.def), verification suite (tests/cpu/avx_fp_move_check.py), CMake registration (cpu_aot_avx_fp_move with SKIP_RETURN_CODE 77), and documentation entry (docs/experiments.md) covering four newly covered x64 AVX mnemonics from docs/coverage/x64_zen2.tsv:

  • vaddsubps (xmm and ymm, register and flat m128/m256)
  • vaddsubpd (xmm and ymm, register and flat m128/m256)
  • vmovq (all five VEX.128 operand shapes: xmm, xmm; xmm, m64; m64, xmm; xmm, r64; r64, xmm)
  • vmaskmovdqu (VEX.128 conditional byte store to implicit [rdi], requiring nonvolatile rdi save/restore via a volatile scratch GPR around mov rdi, r8)

The translator models YMM0..YMM5 as portable Vec256 structs without /arch:AVX, zeroes YMM[255:128] on VEX.128 writes and YMM[255:64] on vmovq XMM writes, preserves x86 src1-first NaN precedence/quieting and real-indefinite QNaN semantics, preserves dead-read fault ordering at /O2 with std::atomic_signal_fence and volatile reads in load64/load128/load256, supports vmovups/vmovaps/vmovdqu/vmovdqa/vzeroupper/64-bit mov/ret transport glue, and rejects legacy SSE, EVEX, nonvolatile registers, non-r8 stores, prefixes, RIP-relative addressing, and trailing bytes after ret.

Verification

Verified on commit b7b6354 across both dev (Debug) and release (/O2) presets (0 errors, 0 warnings):

  • cmake --build --preset dev --clean-first --target cpu_avx_fp_move_original cpu_avx_fp_move_original_lifted cpu_avx_fp_move_altered cpu_avx_fp_move_altered_lifted cpu_avx_pcmpstr_original cpu_avx_pcmpstr_original_lifted cpu_avx_pcmpstr_altered cpu_avx_pcmpstr_altered_lifted cpu_sse_fp_original cpu_sse_fp_original_lifted cpu_sse_fp_altered cpu_sse_fp_altered_lifted: 0 errors, 0 warnings
  • cmake --build --preset release --clean-first --target cpu_avx_fp_move_original cpu_avx_fp_move_original_lifted cpu_avx_fp_move_altered cpu_avx_fp_move_altered_lifted cpu_avx_pcmpstr_original cpu_avx_pcmpstr_original_lifted cpu_avx_pcmpstr_altered cpu_avx_pcmpstr_altered_lifted cpu_sse_fp_original cpu_sse_fp_original_lifted cpu_sse_fp_altered cpu_sse_fp_altered_lifted: 0 errors, 0 warnings
  • ctest --preset dev --no-tests=error -R "^(cpu_aot_avx_fp_move|cpu_aot_avx_pcmpstr|cpu_aot_sse_fp)$" -V: 3/3 Passed (cpu_aot_avx_fp_move: 257 native/lifted/reference cases across 20 exports, 5 ALTER_OP divergence controls, op_discarded_read/op_discarded_read64 dead-read fault ordering, 32-byte guard buffers, output mutation control, 7 alternate-encoding lift checks, 37 unit rejection controls, and 8 PE-patched DLL rejection controls; cpu_aot_avx_pcmpstr: 1274 cases / 22 exports; cpu_aot_sse_fp: 720 cases / 34 exports)
  • ctest --preset release --no-tests=error -R "^(cpu_aot_avx_fp_move|cpu_aot_avx_pcmpstr|cpu_aot_sse_fp)$" -V: 3/3 Passed with identical counts
  • .\out\pe-env\Scripts\python.exe -B tests/form_coverage_check.py: passed
  • .\out\pe-env\Scripts\python.exe -B tests/docs_links_check.py: passed (13 Markdown files, 217 links)
  • .\out\pe-env\Scripts\python.exe -B tests/bidi_controls_check.py: passed (847 tracked files)
  • tools/form_coverage.py on cpu_aot_avx_fp_move JUnit output: avx_fp_move.asm classified as pass (x64_zen2 11/948 covered, AVX 9/256)

Evidence and follow-up

All fixtures are original source-built MASM and Python tests submitted under the MIT License (tests/cpu/avx_fp_move.asm, tests/cpu/avx_fp_move.def, tests/cpu/avx_fp_move_check.py) with synthetic IEEE-754 binary32/binary64 edge cases, bit patterns, byte-mask boundary inputs (0x7f/0x80), and negative controls (ALTER_OP, dead-read fault ordering, single-bit output mutation, 37 unit rejections, and 8 PE-patched DLL rejections). Tests skip with return code 77 when the host lacks AVX/OSXSAVE. Non-default MXCSR modes, control flow, and nonvolatile XMM prologues remain out of scope.

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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6569207116 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1018). Originally posted by [Ammmae0x](https://github.com/Ammmae0x) on 2026-11-23T21:29:09Z. --- ## Change Add a bounded leaf translator (`tools/cpu_avx_fp_move_aot.py`), MASM differential fixture (`tests/cpu/avx_fp_move.asm`, `tests/cpu/avx_fp_move.def`), verification suite (`tests/cpu/avx_fp_move_check.py`), CMake registration (`cpu_aot_avx_fp_move` with `SKIP_RETURN_CODE 77`), and documentation entry (`docs/experiments.md`) covering four newly covered x64 `AVX` mnemonics from `docs/coverage/x64_zen2.tsv`: - `vaddsubps` (`xmm` and `ymm`, register and flat `m128`/`m256`) - `vaddsubpd` (`xmm` and `ymm`, register and flat `m128`/`m256`) - `vmovq` (all five `VEX.128` operand shapes: `xmm, xmm`; `xmm, m64`; `m64, xmm`; `xmm, r64`; `r64, xmm`) - `vmaskmovdqu` (`VEX.128` conditional byte store to implicit `[rdi]`, requiring nonvolatile `rdi` save/restore via a volatile scratch GPR around `mov rdi, r8`) The translator models `YMM0`..`YMM5` as portable `Vec256` structs without `/arch:AVX`, zeroes `YMM[255:128]` on `VEX.128` writes and `YMM[255:64]` on `vmovq` `XMM` writes, preserves x86 `src1`-first NaN precedence/quieting and real-indefinite QNaN semantics, preserves dead-read fault ordering at `/O2` with `std::atomic_signal_fence` and volatile reads in `load64`/`load128`/`load256`, supports `vmovups`/`vmovaps`/`vmovdqu`/`vmovdqa`/`vzeroupper`/64-bit `mov`/`ret` transport glue, and rejects legacy SSE, EVEX, nonvolatile registers, non-`r8` stores, prefixes, RIP-relative addressing, and trailing bytes after `ret`. ## Verification Verified on commit `b7b6354` across both `dev` (Debug) and `release` (`/O2`) presets (0 errors, 0 warnings): - `cmake --build --preset dev --clean-first --target cpu_avx_fp_move_original cpu_avx_fp_move_original_lifted cpu_avx_fp_move_altered cpu_avx_fp_move_altered_lifted cpu_avx_pcmpstr_original cpu_avx_pcmpstr_original_lifted cpu_avx_pcmpstr_altered cpu_avx_pcmpstr_altered_lifted cpu_sse_fp_original cpu_sse_fp_original_lifted cpu_sse_fp_altered cpu_sse_fp_altered_lifted`: 0 errors, 0 warnings - `cmake --build --preset release --clean-first --target cpu_avx_fp_move_original cpu_avx_fp_move_original_lifted cpu_avx_fp_move_altered cpu_avx_fp_move_altered_lifted cpu_avx_pcmpstr_original cpu_avx_pcmpstr_original_lifted cpu_avx_pcmpstr_altered cpu_avx_pcmpstr_altered_lifted cpu_sse_fp_original cpu_sse_fp_original_lifted cpu_sse_fp_altered cpu_sse_fp_altered_lifted`: 0 errors, 0 warnings - `ctest --preset dev --no-tests=error -R "^(cpu_aot_avx_fp_move|cpu_aot_avx_pcmpstr|cpu_aot_sse_fp)$" -V`: 3/3 Passed (`cpu_aot_avx_fp_move`: 257 native/lifted/reference cases across 20 exports, 5 `ALTER_OP` divergence controls, `op_discarded_read`/`op_discarded_read64` dead-read fault ordering, 32-byte guard buffers, output mutation control, 7 alternate-encoding lift checks, 37 unit rejection controls, and 8 PE-patched DLL rejection controls; `cpu_aot_avx_pcmpstr`: 1274 cases / 22 exports; `cpu_aot_sse_fp`: 720 cases / 34 exports) - `ctest --preset release --no-tests=error -R "^(cpu_aot_avx_fp_move|cpu_aot_avx_pcmpstr|cpu_aot_sse_fp)$" -V`: 3/3 Passed with identical counts - `.\out\pe-env\Scripts\python.exe -B tests/form_coverage_check.py`: passed - `.\out\pe-env\Scripts\python.exe -B tests/docs_links_check.py`: passed (13 Markdown files, 217 links) - `.\out\pe-env\Scripts\python.exe -B tests/bidi_controls_check.py`: passed (847 tracked files) - `tools/form_coverage.py` on `cpu_aot_avx_fp_move` JUnit output: `avx_fp_move.asm` classified as `pass` (`x64_zen2` 11/948 covered, `AVX` 9/256) ## Evidence and follow-up All fixtures are original source-built MASM and Python tests submitted under the MIT License (`tests/cpu/avx_fp_move.asm`, `tests/cpu/avx_fp_move.def`, `tests/cpu/avx_fp_move_check.py`) with synthetic IEEE-754 binary32/binary64 edge cases, bit patterns, byte-mask boundary inputs (`0x7f`/`0x80`), and negative controls (`ALTER_OP`, dead-read fault ordering, single-bit output mutation, 37 unit rejections, and 8 PE-patched DLL rejections). Tests skip with return code 77 when the host lacks AVX/OSXSAVE. Non-default MXCSR modes, control flow, and nonvolatile XMM prologues remain out of scope. ## 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.
upstream-sync closed this pull request 2026-11-24 06:45:52 +00:00
R0Y00 commented 2026-11-24 06:49:43 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T21:33:29Z.


This overlaps #1015's vaddsubps and vaddsubpd, which use the shared lowerer and have an independent Release comparison across seven MXCSR modes. Please split this contribution around the remaining move and store cases. Compare each vmovq encoding against the existing shared branch first, so we can extend only the missing operand forms rather than add a second FP translator. Keep the useful dead-read and alternate-encoding controls.

I reproduced a separate definedness error on b7b63548 with mov rax,rcx; mov rax,rdi; vmovq xmm0,rax; vmovups [r8],xmm0; ret. The generated body stores RCX because the symbolic save of RDI leaves the former RAX value defined. The incoming RDI is outside this ABI. Mark the scratch register unavailable to ordinary consumers after an RDI save, while retaining it for restoration, and add this rejection control. For vmaskmovdqu, keep the byte masks and compare a synthetic page-edge case natively before promising behavior when part of the vector points outside writable memory.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7114618221 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1018#issuecomment-7114618221). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-23T21:33:29Z. --- This overlaps #1015's `vaddsubps` and `vaddsubpd`, which use the shared lowerer and have an independent Release comparison across seven MXCSR modes. Please split this contribution around the remaining move and store cases. Compare each `vmovq` encoding against the existing shared branch first, so we can extend only the missing operand forms rather than add a second FP translator. Keep the useful dead-read and alternate-encoding controls. I reproduced a separate definedness error on `b7b63548` with `mov rax,rcx; mov rax,rdi; vmovq xmm0,rax; vmovups [r8],xmm0; ret`. The generated body stores RCX because the symbolic save of RDI leaves the former RAX value defined. The incoming RDI is outside this ABI. Mark the scratch register unavailable to ordinary consumers after an RDI save, while retaining it for restoration, and add this rejection control. For `vmaskmovdqu`, keep the byte masks and compare a synthetic page-edge case natively before promising behavior when part of the vector points outside writable memory.
Ammmae0x commented 2026-11-24 06:49:45 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Ammmae0x on 2026-11-23T22:00:05Z.


Updated PR #1018 in commit ff4b71b (merged upstream/main cleanly and retitled to cpu: lower AVX quadword move and byte-masked store):

  1. Split off vaddsubps/vaddsubpd: Removed vaddsubps, vaddsubpd, and all FP arithmetic (fp_arith, ADDSUB_SPECS, _FPFormat, and the op_vaddsub* exports) from tools/cpu_avx_fp_move_aot.py, tests/cpu/avx_fp_move.*, CMakeLists.txt, and docs/experiments.md (since #1015 landed in upstream/main). Added out_of_scope_vaddsubps to verify it stays rejected here.
  2. Compared vmovq encodings against existing translators: Checked tools/cpu_avx_move_aot.py (which explicitly carves out and rejects all vmovq encodings as verified by tests/cpu/avx_move_regs_check.py and tests/form_coverage_check.py) and tools/ffx_version_query.py (which only lowers m64 load/store forms under has_wide without xmm<-xmm, xmm<-r64, r64<-xmm, or rdi save/restore). Kept all four VEX.128 vmovq Code variants (VEX_VMOVQ_XMM_XMMM64, VEX_VMOVQ_XMMM64_XMM, VEX_VMOVQ_XMM_RM64, VEX_VMOVQ_RM64_XMM) across all five operand shapes alongside vmaskmovdqu, the op_discarded_read/op_discarded_read64 dead-read controls, and 8 alternate-encoding checks (including vmovq_6e_m64).
  3. Fixed the RDI-save definedness bug: On mov <scratch>, rdi, defined_gpr.discard(dst_gpr) now marks the scratch GPR unavailable to ordinary consumers while keeping it in caller_rdi_holders for mov rdi, <scratch> restoration, and read_gpr explicitly rejects reads from a saved-rdi scratch register (GPR <reg> holds saved rdi). Added rdi_save_clobbers_prior_def (the exact mov rax, rcx; mov rax, rdi; vmovq xmm0, rax; vmovups [r8], xmm0; ret sequence), rdi_save_post_restore_still_unavail, and pe_rdi_save_leak.
  4. Verified vmaskmovdqu page-edge behavior natively: Tested op_vmaskmovdqu natively with VirtualAlloc + PAGE_NOACCESS and PAGE_READONLY guard pages right after partial vectors (k = 16, 15, 8, 7, 1, 0): native hardware faults whenever any byte of [rdi..rdi+15] is outside writable memory even when all mask MSBs are clear (0x7F), and on unaligned page-crossing k=15 writes may commit a writable 8-byte prefix before faulting. Kept byte masks in op_vmaskmovdqu, added pre-write dst[0]/dst[15] endpoint probes so the lifted helper matches the fault boundary while leaving writable prefix bytes unmodified, and added 68 native/lifted page-edge checks.

Verification on ff4b71b:

  • cmake --build --preset dev --clean-first --target cpu_avx_fp_move_original cpu_avx_fp_move_original_lifted cpu_avx_fp_move_altered cpu_avx_fp_move_altered_lifted cpu_avx_move_regs_original cpu_avx_move_regs_original_lifted cpu_avx_move_regs_altered cpu_avx_move_regs_altered_lifted (0 errors, 0 warnings)
  • cmake --build --preset release --clean-first --target cpu_avx_fp_move_original cpu_avx_fp_move_original_lifted cpu_avx_fp_move_altered cpu_avx_fp_move_altered_lifted cpu_avx_move_regs_original cpu_avx_move_regs_original_lifted cpu_avx_move_regs_altered cpu_avx_move_regs_altered_lifted (0 errors, 0 warnings)
  • ctest --preset dev --no-tests=error -R "^(cpu_aot_avx_fp_move|cpu_aot_avx_move_regs)$" -V and release: both passed 2/2 (cpu_aot_avx_fp_move: 134 differential cases across 7 exports, 68 native/lifted page-edge checks, 3 ALTER_OP controls diverging on 14/12/30 cases, dead-read fault ordering, output-mutation control, 8 alternate-encoding lift checks, 38 unit rejection controls, and 9 PE-patched DLL rejection controls).
  • .\out\pe-env\Scripts\python.exe -B tests/form_coverage_check.py, tests/docs_links_check.py, tests/bidi_controls_check.py: all passed.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7115196480 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1018#issuecomment-7115196480). Originally posted by [Ammmae0x](https://github.com/Ammmae0x) on 2026-11-23T22:00:05Z. --- Updated PR #1018 in commit `ff4b71b` (merged `upstream/main` cleanly and retitled to `cpu: lower AVX quadword move and byte-masked store`): 1. **Split off `vaddsubps`/`vaddsubpd`**: Removed `vaddsubps`, `vaddsubpd`, and all FP arithmetic (`fp_arith`, `ADDSUB_SPECS`, `_FPFormat`, and the `op_vaddsub*` exports) from `tools/cpu_avx_fp_move_aot.py`, `tests/cpu/avx_fp_move.*`, `CMakeLists.txt`, and `docs/experiments.md` (since #1015 landed in `upstream/main`). Added `out_of_scope_vaddsubps` to verify it stays rejected here. 2. **Compared `vmovq` encodings against existing translators**: Checked `tools/cpu_avx_move_aot.py` (which explicitly carves out and rejects all `vmovq` encodings as verified by `tests/cpu/avx_move_regs_check.py` and `tests/form_coverage_check.py`) and `tools/ffx_version_query.py` (which only lowers `m64` load/store forms under `has_wide` without `xmm<-xmm`, `xmm<-r64`, `r64<-xmm`, or `rdi` save/restore). Kept all four `VEX.128` `vmovq` `Code` variants (`VEX_VMOVQ_XMM_XMMM64`, `VEX_VMOVQ_XMMM64_XMM`, `VEX_VMOVQ_XMM_RM64`, `VEX_VMOVQ_RM64_XMM`) across all five operand shapes alongside `vmaskmovdqu`, the `op_discarded_read`/`op_discarded_read64` dead-read controls, and 8 alternate-encoding checks (including `vmovq_6e_m64`). 3. **Fixed the `RDI`-save definedness bug**: On `mov <scratch>, rdi`, `defined_gpr.discard(dst_gpr)` now marks the scratch GPR unavailable to ordinary consumers while keeping it in `caller_rdi_holders` for `mov rdi, <scratch>` restoration, and `read_gpr` explicitly rejects reads from a saved-`rdi` scratch register (`GPR <reg> holds saved rdi`). Added `rdi_save_clobbers_prior_def` (the exact `mov rax, rcx; mov rax, rdi; vmovq xmm0, rax; vmovups [r8], xmm0; ret` sequence), `rdi_save_post_restore_still_unavail`, and `pe_rdi_save_leak`. 4. **Verified `vmaskmovdqu` page-edge behavior natively**: Tested `op_vmaskmovdqu` natively with `VirtualAlloc` + `PAGE_NOACCESS` and `PAGE_READONLY` guard pages right after partial vectors (`k = 16, 15, 8, 7, 1, 0`): native hardware faults whenever any byte of `[rdi..rdi+15]` is outside writable memory even when all mask MSBs are clear (`0x7F`), and on unaligned page-crossing `k=15` writes may commit a writable 8-byte prefix before faulting. Kept byte masks in `op_vmaskmovdqu`, added pre-write `dst[0]`/`dst[15]` endpoint probes so the lifted helper matches the fault boundary while leaving writable prefix bytes unmodified, and added 68 native/lifted page-edge checks. **Verification on `ff4b71b`:** - `cmake --build --preset dev --clean-first --target cpu_avx_fp_move_original cpu_avx_fp_move_original_lifted cpu_avx_fp_move_altered cpu_avx_fp_move_altered_lifted cpu_avx_move_regs_original cpu_avx_move_regs_original_lifted cpu_avx_move_regs_altered cpu_avx_move_regs_altered_lifted` (0 errors, 0 warnings) - `cmake --build --preset release --clean-first --target cpu_avx_fp_move_original cpu_avx_fp_move_original_lifted cpu_avx_fp_move_altered cpu_avx_fp_move_altered_lifted cpu_avx_move_regs_original cpu_avx_move_regs_original_lifted cpu_avx_move_regs_altered cpu_avx_move_regs_altered_lifted` (0 errors, 0 warnings) - `ctest --preset dev --no-tests=error -R "^(cpu_aot_avx_fp_move|cpu_aot_avx_move_regs)$" -V` and `release`: both passed 2/2 (`cpu_aot_avx_fp_move`: 134 differential cases across 7 exports, 68 native/lifted page-edge checks, 3 `ALTER_OP` controls diverging on 14/12/30 cases, dead-read fault ordering, output-mutation control, 8 alternate-encoding lift checks, 38 unit rejection controls, and 9 PE-patched DLL rejection controls). - `.\out\pe-env\Scripts\python.exe -B tests/form_coverage_check.py`, `tests/docs_links_check.py`, `tests/bidi_controls_check.py`: all passed. AI-assisted.
R0Y00 commented 2026-11-24 06:49:46 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T22:05:02Z.


The new RDI-save test addresses the stale-value issue and the separated move scope is useful. The masked-store helper still reads and writes both endpoints even for an all-zero mask. Those writes are absent from the guest instruction and can overwrite another observer's update. The test also accepts modified prefix bytes from native execution while requiring an untouched prefix from the lifted version. That is a measured difference in partial-fault behavior. Intel documents all-zero-mask faulting as implementation-dependent.

Please keep the page-edge probe as a native observation. For a portable first slice, require the entire 16-byte destination to be writable ordinary memory and touch only selected bytes. Keep the page-abutting writable case, zero mask, and sparse mask checks. If the profile needs to promise native page-edge faults and partial progress, use a separately verified native-instruction path and compare the fault type, access direction and committed bytes. The VMOVQ forms can also proceed independently. Intel SDM, MASKMOVDQU

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7115302872 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1018#issuecomment-7115302872). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-23T22:05:02Z. --- The new RDI-save test addresses the stale-value issue and the separated move scope is useful. The masked-store helper still reads and writes both endpoints even for an all-zero mask. Those writes are absent from the guest instruction and can overwrite another observer's update. The test also accepts modified prefix bytes from native execution while requiring an untouched prefix from the lifted version. That is a measured difference in partial-fault behavior. Intel documents all-zero-mask faulting as implementation-dependent. Please keep the page-edge probe as a native observation. For a portable first slice, require the entire 16-byte destination to be writable ordinary memory and touch only selected bytes. Keep the page-abutting writable case, zero mask, and sparse mask checks. If the profile needs to promise native page-edge faults and partial progress, use a separately verified native-instruction path and compare the fault type, access direction and committed bytes. The VMOVQ forms can also proceed independently. [Intel SDM, MASKMOVDQU](https://cdrdv2-public.intel.com/835752/253667-sdm-vol-2b.pdf)
Ammmae0x commented 2026-11-24 06:49:47 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Ammmae0x on 2026-11-23T22:14:55Z.


Updated PR #1018 in commit 5e3ae8f (tools/cpu_avx_fp_move_aot.py, tests/cpu/avx_fp_move_check.py, docs/experiments.md):

  • Portable op_vmaskmovdqu semantics: Removed the dst[0]/dst[15] endpoint read/write probes so the lifted helper touches only bytes selected by (mask[i] & 0x80) != 0 and never reads or writes unselected bytes (matching an all-zero mask with zero memory accesses).
  • Precondition & native observation split: Documented the portable first-slice precondition that the entire 16-byte destination [rdi..rdi+15] must be writable ordinary memory, while moving k < 16 VirtualAlloc + PAGE_NOACCESS/PAGE_READONLY page-edge probing to a native-only observation (30 cases) and keeping both native and lifted differential checks on k = 16 page-abutting writable vectors (12 cases across full, all-zero, and sparse masks).

Verification on 5e3ae8f:

  • cmake --build --preset dev --clean-first --target cpu_avx_fp_move_original cpu_avx_fp_move_original_lifted cpu_avx_fp_move_altered cpu_avx_fp_move_altered_lifted (0 errors, 0 warnings)
  • cmake --build --preset release --clean-first --target cpu_avx_fp_move_original cpu_avx_fp_move_original_lifted cpu_avx_fp_move_altered cpu_avx_fp_move_altered_lifted (0 errors, 0 warnings)
  • ctest --preset dev --no-tests=error -R "^cpu_aot_avx_fp_move$" -V and release: passed 1/1 on both (134 differential cases across 7 exports, 12 k=16 page-abutting checks, 30 native-only k<16 page-edge fault observations, 3 ALTER_OP controls diverging on 14/12/30 cases, dead-read fault ordering, output-mutation control, 8 alternate-encoding lift checks, 38 unit rejection controls, and 9 PE-patched DLL rejection controls).
  • .\out\pe-env\Scripts\python.exe -B tests/form_coverage_check.py, tests/docs_links_check.py (13 files, 224 links), and tests/bidi_controls_check.py (867 files): all passed.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7115514109 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1018#issuecomment-7115514109). Originally posted by [Ammmae0x](https://github.com/Ammmae0x) on 2026-11-23T22:14:55Z. --- Updated PR #1018 in commit `5e3ae8f` (`tools/cpu_avx_fp_move_aot.py`, `tests/cpu/avx_fp_move_check.py`, `docs/experiments.md`): - **Portable `op_vmaskmovdqu` semantics**: Removed the `dst[0]`/`dst[15]` endpoint read/write probes so the lifted helper touches only bytes selected by `(mask[i] & 0x80) != 0` and never reads or writes unselected bytes (matching an all-zero mask with zero memory accesses). - **Precondition & native observation split**: Documented the portable first-slice precondition that the entire 16-byte destination `[rdi..rdi+15]` must be writable ordinary memory, while moving `k < 16` `VirtualAlloc` + `PAGE_NOACCESS`/`PAGE_READONLY` page-edge probing to a native-only observation (`30` cases) and keeping both native and lifted differential checks on `k = 16` page-abutting writable vectors (`12` cases across full, all-zero, and sparse masks). **Verification on `5e3ae8f`:** - `cmake --build --preset dev --clean-first --target cpu_avx_fp_move_original cpu_avx_fp_move_original_lifted cpu_avx_fp_move_altered cpu_avx_fp_move_altered_lifted` (0 errors, 0 warnings) - `cmake --build --preset release --clean-first --target cpu_avx_fp_move_original cpu_avx_fp_move_original_lifted cpu_avx_fp_move_altered cpu_avx_fp_move_altered_lifted` (0 errors, 0 warnings) - `ctest --preset dev --no-tests=error -R "^cpu_aot_avx_fp_move$" -V` and `release`: passed 1/1 on both (`134` differential cases across `7` exports, `12` `k=16` page-abutting checks, `30` native-only `k<16` page-edge fault observations, `3` `ALTER_OP` controls diverging on `14`/`12`/`30` cases, dead-read fault ordering, output-mutation control, `8` alternate-encoding lift checks, `38` unit rejection controls, and `9` PE-patched DLL rejection controls). - `.\out\pe-env\Scripts\python.exe -B tests/form_coverage_check.py`, `tests/docs_links_check.py` (13 files, 224 links), and `tests/bidi_controls_check.py` (867 files): all passed. AI-assisted.
R0Y00 commented 2026-11-24 06:49:47 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T22:22:46Z.


The selected-byte helper addresses the endpoint access problem. In 9db7a26 I kept the native page-edge cases and made them record the fault status and written prefix. A selected byte in the protected page still requires an access violation, and bytes in the writable prefix must be unchanged or contain their selected value. This also permits hardware-specific success when only writable bytes are selected. Release cpu_aot_avx_fp_move passed locally: 134 differential cases, 12 page-abutting native/lifted cases and 30 separate native page-edge observations. The lifted contract remains a fully writable ordinary 16-byte range.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7115678131 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1018#issuecomment-7115678131). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-23T22:22:46Z. --- The selected-byte helper addresses the endpoint access problem. In 9db7a26 I kept the native page-edge cases and made them record the fault status and written prefix. A selected byte in the protected page still requires an access violation, and bytes in the writable prefix must be unchanged or contain their selected value. This also permits hardware-specific success when only writable bytes are selected. Release `cpu_aot_avx_fp_move` passed locally: 134 differential cases, 12 page-abutting native/lifted cases and 30 separate native page-edge observations. The lifted contract remains a fully writable ordinary 16-byte range.
R0Y00 commented 2026-11-24 06:49:49 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T22:42:57Z.


The new AVX checks passed in CI. The /O2 job failed because the existing native package-ordinal startup child timed out at 30 seconds, outside this PR's AVX path. I restarted the failed job on the same head, 9db7a26. The PR stays open until both Windows jobs are green.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7116094344 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1018#issuecomment-7116094344). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-23T22:42:57Z. --- The new AVX checks passed in CI. The /O2 job failed because the existing native package-ordinal startup child timed out at 30 seconds, outside this PR's AVX path. I restarted the failed job on the same head, 9db7a26. The PR stays open until both Windows jobs are green.
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!1011
No description provided.