cpu: add AVX VEX FP compare AOT lifter and test suite #2663

Merged
Ammmae0x merged 3 commits from upstream-pr/2671 into main 2026-11-26 03:03:28 +00:00
Ammmae0x commented 2026-11-26 01:39:30 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Ammmae0x on 2026-11-26T01:39:30Z.


Change

Add a bounded AOT lifter ( ools/cpu_avx_cmp_aot.py) and source-built MASM/differential verification suite ( ests/cpu/avx_cmp_aot.{asm,def,_check.py}, CTest cpu_aot_avx_cmp) covering all 4 AVX VEX floating-point compare mnemonics across all 32 5-bit predicates (imm8 & 0x1F):

  • VCMPPS (VEX.128 and VEX.256, reg and flat [rcx|rdx|r8] mem-src)
  • VCMPPD (VEX.128 and VEX.256, reg and flat [rcx|rdx|r8] mem-src)
  • VCMPSS (VEX.128 scalar f32, preserving src1[127:32] and zeroing YMM[255:128])
  • VCMPSD (VEX.128 scalar f64, preserving src1[127:64] and zeroing YMM[255:128])
  • Bounded AVX transport glue (VMOVAPS/D/UPS/D/SS/SD, VZEROUPPER, terminal RET) with strict refusal of EVEX, legacy SSE compare/move forms, nonvolatile XMM6..15/YMM6..15, undefined vector reads, displaced/indexed/RIP-relative memory operands, non-[r8] stores, prefixes, and trailing/missing
    et.
  • Models all 32 predicates using baseline SSE2 scalar operations on volatile operand copies so /O2 cannot fast-math fold +0.0 == -0.0, +/-Inf, qNaN/sNaN, MXCSR DAZ, or quiet vs signaling MXCSR.IE behavior.

Verification

Verified on commit e4938fb4 (based on upstream/main 82c70807) on Windows x64 (MSVC, both dev Debug and
elease /O2):

  • ctest --preset dev -N -> 2165 total tests, cpu_aot_avx_cmp registered with SKIP_RETURN_CODE 77 and FORM_COVERAGE_RECORD.
  • cmake --build --preset dev --clean-first --target cpu_avx_cmp_aot_original cpu_avx_cmp_aot_original_lifted cpu_avx_cmp_aot_altered cpu_avx_cmp_aot_altered_lifted -> exit 0, 0 errors, 0 warnings.
  • ctest --preset dev --no-tests=error -R '^cpu_aot_avx_cmp$' -E 'cpu_native_archive_' -V -> 1/1 passed: 26 forms accepted, 34 refusal controls, 5 CLI negative checks, 1280 differential cases across 154 exports / 32 predicates / DAZ & MXCSR.IE modes, 5 ALTER_AVX_CMP altered controls diverged, FORM_COVERAGE_RECORD emitted 12 forms (
    et, vcmppd, vcmpps, vcmpsd, vcmpss, vmovapd, vmovaps, vmovsd, vmovss, vmovupd, vmovups, vzeroupper).
  • cmake --build --preset release --clean-first --target cpu_avx_cmp_aot_original cpu_avx_cmp_aot_original_lifted cpu_avx_cmp_aot_altered cpu_avx_cmp_aot_altered_lifted -> exit 0, 0 errors, 0 warnings.
  • ctest --preset release --no-tests=error -R '^cpu_aot_avx_cmp$' -E 'cpu_native_archive_' -V -> 1/1 passed (same 1280 cases + 5 altered controls + 12 forms under /O2).
  • out\pe-env\Scripts\python.exe -B tests\form_coverage_check.py, tests\docs_links_check.py, tests\bidi_controls_check.py -> all exit 0.
  • Spot-mutation negative controls (3/3 killed by tests/cpu/avx_cmp_aot_check.py): disabling EVEX rejection, disabling non-[r8] store guard, and truncating imm8 predicate mask to 4 bits.
  • Capability skip path: host checks CPUID.01H:ECX[27:28] + XGETBV[2:1] and exits 77 when AVX is unavailable; 0 capability skips on this host.

Evidence and follow-up

  • Source-built MASM fixture tests/cpu/avx_cmp_aot.asm and module definition tests/cpu/avx_cmp_aot.def are original repository files under MIT License (no external dumps or binaries).
  • Header line 1 declares ; coverage: record cpu_aot_avx_cmp for automated x64 form coverage tracking.

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:6617553638 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2671). Originally posted by [Ammmae0x](https://github.com/Ammmae0x) on 2026-11-26T01:39:30Z. --- ## Change Add a bounded AOT lifter ( ools/cpu_avx_cmp_aot.py) and source-built MASM/differential verification suite ( ests/cpu/avx_cmp_aot.{asm,def,_check.py}, CTest cpu_aot_avx_cmp) covering all 4 AVX VEX floating-point compare mnemonics across all 32 5-bit predicates (imm8 & 0x1F): - VCMPPS (VEX.128 and VEX.256, reg and flat [rcx|rdx|r8] mem-src) - VCMPPD (VEX.128 and VEX.256, reg and flat [rcx|rdx|r8] mem-src) - VCMPSS (VEX.128 scalar f32, preserving src1[127:32] and zeroing YMM[255:128]) - VCMPSD (VEX.128 scalar f64, preserving src1[127:64] and zeroing YMM[255:128]) - Bounded AVX transport glue (VMOVAPS/D/UPS/D/SS/SD, VZEROUPPER, terminal RET) with strict refusal of EVEX, legacy SSE compare/move forms, nonvolatile XMM6..15/YMM6..15, undefined vector reads, displaced/indexed/RIP-relative memory operands, non-[r8] stores, prefixes, and trailing/missing et. - Models all 32 predicates using baseline SSE2 scalar operations on volatile operand copies so /O2 cannot fast-math fold +0.0 == -0.0, +/-Inf, qNaN/sNaN, MXCSR DAZ, or quiet vs signaling MXCSR.IE behavior. ## Verification Verified on commit `e4938fb4` (based on `upstream/main` `82c70807`) on Windows x64 (MSVC, both dev Debug and elease /O2): - `ctest --preset dev -N` -> 2165 total tests, `cpu_aot_avx_cmp` registered with `SKIP_RETURN_CODE 77` and `FORM_COVERAGE_RECORD`. - `cmake --build --preset dev --clean-first --target cpu_avx_cmp_aot_original cpu_avx_cmp_aot_original_lifted cpu_avx_cmp_aot_altered cpu_avx_cmp_aot_altered_lifted` -> exit 0, 0 errors, 0 warnings. - `ctest --preset dev --no-tests=error -R '^cpu_aot_avx_cmp$' -E 'cpu_native_archive_' -V` -> 1/1 passed: 26 forms accepted, 34 refusal controls, 5 CLI negative checks, 1280 differential cases across 154 exports / 32 predicates / DAZ & MXCSR.IE modes, 5 ALTER_AVX_CMP altered controls diverged, FORM_COVERAGE_RECORD emitted 12 forms ( et, vcmppd, vcmpps, vcmpsd, vcmpss, vmovapd, vmovaps, vmovsd, vmovss, vmovupd, vmovups, vzeroupper). - `cmake --build --preset release --clean-first --target cpu_avx_cmp_aot_original cpu_avx_cmp_aot_original_lifted cpu_avx_cmp_aot_altered cpu_avx_cmp_aot_altered_lifted` -> exit 0, 0 errors, 0 warnings. - `ctest --preset release --no-tests=error -R '^cpu_aot_avx_cmp$' -E 'cpu_native_archive_' -V` -> 1/1 passed (same 1280 cases + 5 altered controls + 12 forms under /O2). - `out\pe-env\Scripts\python.exe -B tests\form_coverage_check.py`, `tests\docs_links_check.py`, `tests\bidi_controls_check.py` -> all exit 0. - Spot-mutation negative controls (3/3 killed by `tests/cpu/avx_cmp_aot_check.py`): disabling EVEX rejection, disabling non-[r8] store guard, and truncating imm8 predicate mask to 4 bits. - Capability skip path: host checks CPUID.01H:ECX[27:28] + XGETBV[2:1] and exits 77 when AVX is unavailable; 0 capability skips on this host. ## Evidence and follow-up - Source-built MASM fixture `tests/cpu/avx_cmp_aot.asm` and module definition `tests/cpu/avx_cmp_aot.def` are original repository files under MIT License (no external dumps or binaries). - Header line 1 declares `; coverage: record cpu_aot_avx_cmp` for automated x64 form coverage tracking. ## 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.
tedin7 commented 2026-11-26 03:03:08 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T03:00:40Z.

Review: COMMENTED


Review of head 440c70d0 (main merged in; the PR's own diff is unchanged). Comment review.

What I checked:

  • All 32 predicates in the scalar ss/sd helpers against the VCMP predicate table (EQ_OQ..TRUE_US). Operand swaps for NGE/NGT/GE/GT and the quiet vs signaling split look right.
  • The new CTest is a real differential (1280 cases, DAZ and MXCSR.IE modes) plus ALTER_AVX_CMP controls that must diverge, so it guards the behavior.
  • No other open or merged PR covers VEX compare AOT (the older #973 is closed).
  • git diff --check, docs_links_check, bidi_controls_check: clean.
  • Windows Server 2025 WARP, dev and release, ctest -R avx_cmp: 1/1 passed on each.

No findings. Sound. Merge waits for the required CI on this head.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6067968714 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2671#pullrequestreview-6067968714). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-26T03:00:40Z. **Review:** COMMENTED --- Review of head 440c70d0 (main merged in; the PR's own diff is unchanged). Comment review. What I checked: - All 32 predicates in the scalar ss/sd helpers against the VCMP predicate table (EQ_OQ..TRUE_US). Operand swaps for NGE/NGT/GE/GT and the quiet vs signaling split look right. - The new CTest is a real differential (1280 cases, DAZ and MXCSR.IE modes) plus ALTER_AVX_CMP controls that must diverge, so it guards the behavior. - No other open or merged PR covers VEX compare AOT (the older #973 is closed). - `git diff --check`, docs_links_check, bidi_controls_check: clean. - Windows Server 2025 WARP, dev and release, `ctest -R avx_cmp`: 1/1 passed on each. No findings. Sound. Merge waits for the required CI on this head. AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-26 03:03:26 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T03:00:41Z.


Win2025 WARP receipt for head 440c70d0 after updating with main.

Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit 440c70d036c4f84fe99963e535a0048995736a4d:

  • Debug (--preset dev):
    • Build (cmake --build --preset dev --target cpu_avx_cmp_aot_altered cpu_avx_cmp_aot_altered_lifted cpu_avx_cmp_aot_original cpu_avx_cmp_aot_original_lifted -- -j 2): 2.50s (configure 3.25s)
    • Test (ctest --preset dev -R 'avx_cmp' --parallel 2 --no-tests=error --output-on-failure): 1/1 passed (4.00s: cpu_aot_avx_cmp 3.77s)
  • Release /O2 (--preset release):
    • Build (cmake --build --preset release --target cpu_avx_cmp_aot_altered cpu_avx_cmp_aot_altered_lifted cpu_avx_cmp_aot_original cpu_avx_cmp_aot_original_lifted -- -j 2): 4.01s (configure 0.00s)
    • Test (ctest --preset release -R 'avx_cmp' --parallel 2 --no-tests=error --output-on-failure): 1/1 passed (3.92s: cpu_aot_avx_cmp 3.72s)
  • sccache: 52/69 hits; wall 21.2s

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7181314940 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2671#issuecomment-7181314940). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-26T03:00:41Z. --- Win2025 WARP receipt for head 440c70d0 after updating with main. Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit `440c70d036c4f84fe99963e535a0048995736a4d`: - **Debug (`--preset dev`)**: - Build (`cmake --build --preset dev --target cpu_avx_cmp_aot_altered cpu_avx_cmp_aot_altered_lifted cpu_avx_cmp_aot_original cpu_avx_cmp_aot_original_lifted -- -j 2`): `2.50s` (configure `3.25s`) - Test (`ctest --preset dev -R 'avx_cmp' --parallel 2 --no-tests=error --output-on-failure`): **1/1 passed** (`4.00s`: `cpu_aot_avx_cmp` `3.77s`) - **Release `/O2` (`--preset release`)**: - Build (`cmake --build --preset release --target cpu_avx_cmp_aot_altered cpu_avx_cmp_aot_altered_lifted cpu_avx_cmp_aot_original cpu_avx_cmp_aot_original_lifted -- -j 2`): `4.01s` (configure `0.00s`) - Test (`ctest --preset release -R 'avx_cmp' --parallel 2 --no-tests=error --output-on-failure`): **1/1 passed** (`3.92s`: `cpu_aot_avx_cmp` `3.72s`) - `sccache`: 52/69 hits; wall `21.2s` AI-assisted; commands listed were executed locally.
upstream-sync closed this pull request 2026-11-26 04:04:14 +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!2663
No description provided.