cpu: cover AVX2 broadcast, variable-shift and alias controls #700

Merged
Ammmae0x merged 1 commit from upstream-pr/706 into main 2026-11-22 21:53:55 +00:00
Ammmae0x commented 2026-11-22 21:30:54 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Ammmae0x on 2026-11-22T21:30:54Z.


Change

Expand the cpu_aot_avx2_shifts MASM fixture, export list, differential runner, and rejection controls to cover previously untested forms of the existing AVX2 integer broadcast and variable per-lane shift lowering (tools/ffx_version_query.py), without modifying the translator:

  • tests/cpu/avx2_shifts.asm, tests/cpu/avx2_shifts.def: expand from 10 to 44 exports covering 128-bit and 256-bit vpbroadcastb/vpbroadcastw/vpbroadcastd/vpbroadcastq (memory, register, and dst == src alias), 128-bit and 256-bit vpsllvd/vpsrlvd/vpsravd/vpsllvq/vpsrlvq (register op2, memory op2, dst == src1, dst == src2, and dst == src1 == src2 aliasing), and upper-128 zeroing checks with preloaded YMM0.
  • tests/cpu/avx2_shifts.py: test all 44 exports across 101 differential cases against the native DLL and reference model (including boundary shift counts 0, 1, 7, 15, 31, 32, 33, 0xffffffff for dwords and 0, 1, 7, 32, 63, 64, 65, 0xffffffffffffffff for qwords) and 14 deterministic rejection controls (EVEX broadcast/non-broadcast/GPR-source/512-bit ZMM forms, untracked op0/op1/op2 registers, FS segment prefix, and EIP-relative memory operands).
  • docs/experiments.md: update the cpu_aot_avx2_shifts summary to 44 exports and document the expanded coverage.

Verification

Tested on commit b49216fb3a001606ff24c2967d74e4e8f7184e19 (Windows NT 10.0.26100.0, MSVC 19.50.35727 x64, MASM 14.50.35727.0):

  • .\tools\dev.ps1; cmake --preset dev; cmake --build --preset dev --target cpu_avx2_shifts cpu_avx2_shifts_lifted: built with 0 errors and 0 warnings.
  • ctest --preset dev --no-tests=error -R '^cpu_aot_avx2_shifts$' -V: 1 passed, 0 skipped, 0 failed (101 AVX2 broadcast and variable-shift vector cases matched native and translated DLLs).
  • ctest --preset dev --no-tests=error -R '^cpu_aot_' --output-on-failure: 85 passed, 0 skipped, 0 failed.
  • .\tools\dev.ps1; cmake --preset release; cmake --build --preset release --target cpu_avx2_shifts cpu_avx2_shifts_lifted: built with 0 errors and 0 warnings.
  • ctest --preset release --no-tests=error -R '^cpu_aot_avx2_shifts$' -V: 1 passed, 0 skipped, 0 failed (101 AVX2 broadcast and variable-shift vector cases matched native and translated DLLs).
  • ctest --preset release --no-tests=error -R '^cpu_aot_' --output-on-failure: 85 passed, 0 skipped, 0 failed.
  • .\out\pe-env\Scripts\python.exe -B tests/form_coverage_check.py: passed (form coverage checks passed).
  • .\out\pe-env\Scripts\python.exe -B tests/docs_links_check.py: passed (Checked 10 Markdown files and 128 links.).
  • .\out\pe-env\Scripts\python.exe -B tests/bidi_controls_check.py: passed (Checked 586 tracked source, script and build/CI files: no bidirectional controls.).

Not run locally: ziglang-dependent PE intake tests (optional ziglang omitted from out/pe-env); does not affect cpu_aot_* or AVX2 shift fixtures.

Evidence and follow-up

All fixtures are original MASM source in tests/cpu/avx2_shifts.asm compiled natively with ml64 and translated via tools/ffx_version_query.py under the repository's MIT License. The 14 negative controls decode synthetic x64 byte sequences with iced-x86 and verify lower(...) raises ValueError with the expected diagnostic prefix. No capability skips occurred on this AVX2-capable host; non-AVX2 hosts retain the existing CPUID/XCR0 exit-77 skip path.

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:6548044512 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/706). Originally posted by [Ammmae0x](https://github.com/Ammmae0x) on 2026-11-22T21:30:54Z. --- ## Change Expand the `cpu_aot_avx2_shifts` MASM fixture, export list, differential runner, and rejection controls to cover previously untested forms of the existing AVX2 integer broadcast and variable per-lane shift lowering (`tools/ffx_version_query.py`), without modifying the translator: - `tests/cpu/avx2_shifts.asm`, `tests/cpu/avx2_shifts.def`: expand from 10 to 44 exports covering 128-bit and 256-bit `vpbroadcastb`/`vpbroadcastw`/`vpbroadcastd`/`vpbroadcastq` (memory, register, and `dst == src` alias), 128-bit and 256-bit `vpsllvd`/`vpsrlvd`/`vpsravd`/`vpsllvq`/`vpsrlvq` (register `op2`, memory `op2`, `dst == src1`, `dst == src2`, and `dst == src1 == src2` aliasing), and upper-128 zeroing checks with preloaded `YMM0`. - `tests/cpu/avx2_shifts.py`: test all 44 exports across 101 differential cases against the native DLL and reference model (including boundary shift counts `0`, `1`, `7`, `15`, `31`, `32`, `33`, `0xffffffff` for dwords and `0`, `1`, `7`, `32`, `63`, `64`, `65`, `0xffffffffffffffff` for qwords) and 14 deterministic rejection controls (EVEX broadcast/non-broadcast/GPR-source/512-bit ZMM forms, untracked `op0`/`op1`/`op2` registers, `FS` segment prefix, and `EIP`-relative memory operands). - `docs/experiments.md`: update the `cpu_aot_avx2_shifts` summary to 44 exports and document the expanded coverage. ## Verification Tested on commit `b49216fb3a001606ff24c2967d74e4e8f7184e19` (Windows NT 10.0.26100.0, MSVC 19.50.35727 x64, MASM 14.50.35727.0): - `.\tools\dev.ps1; cmake --preset dev; cmake --build --preset dev --target cpu_avx2_shifts cpu_avx2_shifts_lifted`: built with 0 errors and 0 warnings. - `ctest --preset dev --no-tests=error -R '^cpu_aot_avx2_shifts$' -V`: 1 passed, 0 skipped, 0 failed (`101 AVX2 broadcast and variable-shift vector cases matched native and translated DLLs`). - `ctest --preset dev --no-tests=error -R '^cpu_aot_' --output-on-failure`: 85 passed, 0 skipped, 0 failed. - `.\tools\dev.ps1; cmake --preset release; cmake --build --preset release --target cpu_avx2_shifts cpu_avx2_shifts_lifted`: built with 0 errors and 0 warnings. - `ctest --preset release --no-tests=error -R '^cpu_aot_avx2_shifts$' -V`: 1 passed, 0 skipped, 0 failed (`101 AVX2 broadcast and variable-shift vector cases matched native and translated DLLs`). - `ctest --preset release --no-tests=error -R '^cpu_aot_' --output-on-failure`: 85 passed, 0 skipped, 0 failed. - `.\out\pe-env\Scripts\python.exe -B tests/form_coverage_check.py`: passed (`form coverage checks passed`). - `.\out\pe-env\Scripts\python.exe -B tests/docs_links_check.py`: passed (`Checked 10 Markdown files and 128 links.`). - `.\out\pe-env\Scripts\python.exe -B tests/bidi_controls_check.py`: passed (`Checked 586 tracked source, script and build/CI files: no bidirectional controls.`). Not run locally: `ziglang`-dependent PE intake tests (optional `ziglang` omitted from `out/pe-env`); does not affect `cpu_aot_*` or AVX2 shift fixtures. ## Evidence and follow-up All fixtures are original MASM source in `tests/cpu/avx2_shifts.asm` compiled natively with `ml64` and translated via `tools/ffx_version_query.py` under the repository's MIT License. The 14 negative controls decode synthetic x64 byte sequences with `iced-x86` and verify `lower(...)` raises `ValueError` with the expected diagnostic prefix. No capability skips occurred on this AVX2-capable host; non-AVX2 hosts retain the existing CPUID/XCR0 exit-77 skip path. ## 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:44:26 +00:00
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!700
No description provided.