cpu: add AVX packed-integer and bit-move leaf AOT translators #367

Merged
MarlomMedeiros merged 3 commits from upstream-pr/373 into main 2026-11-22 08:10:39 +00:00
MarlomMedeiros commented 2026-11-21 23:40:30 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by MarlomMedeiros on 2026-11-21T23:40:30Z.


Change

  • Add two leaf AOT translators covering 140 surviving AVX forms in docs/coverage/x64_zen2.tsv group AVX:
    • tools/cpu_avx_int_aot.py: 90 VEX.128 packed-integer forms: vpadd*/vpsub* arithmetic and saturating, vpcmp*, vpmul*/vpmadd*/vpmulhrsw, vpabs*, vpsign*, vpackss*/vpackusdw, vpmovsx*/vpmovzx*, vpunpck*, vpshuf*/vph*, vpblend*/vpblendvb, vpalignr, vmpsadbw, vpsadbw, vphminposuw, vpmovmskb, vpextr*/vpinsr* GPR bridge, vzeroall/vzeroupper
    • tools/cpu_avx_move_aot.py: 50 bit-move forms across XMM/YMM: vmov* aligned/unaligned/NT/scalar/half, vshufps/vshufpd/vunpck*, vblend*/vblendv*, vperm*/vpermil*, vinsert*/vextract*, vbroadcast*, vand*/vandn*/vor*/vxor*, vmaskmov* masked load/store
  • Carve out 33 forms to cpu_vex_aot.py (PR #325): 28 packed-integer + 5 move forms reject as unsupported so each form has exactly one translator; vmovdqu/vzeroupper remain implemented as transport glue.
  • Add source-built MASM differential fixtures tests/cpu/avx_int_regs.{asm,def} + avx_int_regs_check.py and tests/cpu/avx_move_regs.{asm,def} + avx_move_regs_check.py, CTest cpu_aot_avx_int_regs/cpu_aot_avx_move_regs, coverage mapping in tools/form_coverage.py/tests/form_coverage_check.py, and documentation in docs/experiments.md.
  • Refs #314. Complements #325.

Verification

  • Built and tested on Windows 11 x64 (Ryzen 7 5800X3D, MSVC 19.52):
    • ctest --preset dev --no-tests=error -R 'cpu_aot_avx_(int|move)_regs' : 2/2 passed (1,568 packed-integer + 2,314 move native/lifted/reference cases matched bit-for-bit across 119 + 142 exports, plus 16 guard-page fault-suppression cases)
    • ctest --preset dev --no-tests=error -R '^cpu_' -E '_hardware$' : 43/43 passed
    • .\out\pe-env\Scripts\python.exe -B tests/form_coverage_check.py : form coverage checks passed (AVX group 7 -> 146/256, total x64 Zen 2 55 -> 194/948)
    • .\out\pe-env\Scripts\python.exe -B tests/bidi_controls_check.py : passed
  • Negative controls: 110 + 78 unit rejection cases (33 carved forms, VEX.L=1 integer, register-domain memory operands, out-of-scope, EVEX/ABI/addressing violations), 11 + 11 PE-patched DLL rejections, 13 alternate-encoding accept checks (r64/W1 GPR bridge forms MASM does not emit), ALTER_IMM divergence and output-mutation controls.

Evidence and follow-up

  • The 33 carved forms stay reserved for the cpu_vex_aot.py work in PR #325; each is rejected by both new tools with unit + PE-patched controls so no coverage row is double-claimed.
  • Not covered: memory operands on the 28 register-only move forms, AVX FP arithmetic/compare/convert/test, string-compare and MXCSR forms, control flow or calls mixed with AVX state, nonvolatile XMM6..XMM15 prologues, title CPU execution.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6535883407 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/373). Originally posted by [MarlomMedeiros](https://github.com/MarlomMedeiros) on 2026-11-21T23:40:30Z. --- ## Change - Add two leaf AOT translators covering 140 surviving AVX forms in `docs/coverage/x64_zen2.tsv` group `AVX`: - `tools/cpu_avx_int_aot.py`: 90 VEX.128 packed-integer forms: `vpadd*`/`vpsub*` arithmetic and saturating, `vpcmp*`, `vpmul*`/`vpmadd*`/`vpmulhrsw`, `vpabs*`, `vpsign*`, `vpackss*`/`vpackusdw`, `vpmovsx*`/`vpmovzx*`, `vpunpck*`, `vpshuf*`/`vph*`, `vpblend*`/`vpblendvb`, `vpalignr`, `vmpsadbw`, `vpsadbw`, `vphminposuw`, `vpmovmskb`, `vpextr*`/`vpinsr*` GPR bridge, `vzeroall`/`vzeroupper` - `tools/cpu_avx_move_aot.py`: 50 bit-move forms across XMM/YMM: `vmov*` aligned/unaligned/NT/scalar/half, `vshufps`/`vshufpd`/`vunpck*`, `vblend*`/`vblendv*`, `vperm*`/`vpermil*`, `vinsert*`/`vextract*`, `vbroadcast*`, `vand*`/`vandn*`/`vor*`/`vxor*`, `vmaskmov*` masked load/store - Carve out 33 forms to `cpu_vex_aot.py` (PR #325): 28 packed-integer + 5 move forms reject as unsupported so each form has exactly one translator; `vmovdqu`/`vzeroupper` remain implemented as transport glue. - Add source-built MASM differential fixtures `tests/cpu/avx_int_regs.{asm,def}` + `avx_int_regs_check.py` and `tests/cpu/avx_move_regs.{asm,def}` + `avx_move_regs_check.py`, CTest `cpu_aot_avx_int_regs`/`cpu_aot_avx_move_regs`, coverage mapping in `tools/form_coverage.py`/`tests/form_coverage_check.py`, and documentation in `docs/experiments.md`. - Refs #314. Complements #325. ## Verification - Built and tested on Windows 11 x64 (Ryzen 7 5800X3D, MSVC 19.52): - `ctest --preset dev --no-tests=error -R 'cpu_aot_avx_(int|move)_regs'` : 2/2 passed (1,568 packed-integer + 2,314 move native/lifted/reference cases matched bit-for-bit across 119 + 142 exports, plus 16 guard-page fault-suppression cases) - `ctest --preset dev --no-tests=error -R '^cpu_' -E '_hardware$'` : 43/43 passed - `.\out\pe-env\Scripts\python.exe -B tests/form_coverage_check.py` : form coverage checks passed (AVX group 7 -> 146/256, total x64 Zen 2 55 -> 194/948) - `.\out\pe-env\Scripts\python.exe -B tests/bidi_controls_check.py` : passed - Negative controls: 110 + 78 unit rejection cases (33 carved forms, VEX.L=1 integer, register-domain memory operands, out-of-scope, EVEX/ABI/addressing violations), 11 + 11 PE-patched DLL rejections, 13 alternate-encoding accept checks (r64/W1 GPR bridge forms MASM does not emit), ALTER_IMM divergence and output-mutation controls. ## Evidence and follow-up - The 33 carved forms stay reserved for the `cpu_vex_aot.py` work in PR #325; each is rejected by both new tools with unit + PE-patched controls so no coverage row is double-claimed. - Not covered: memory operands on the 28 register-only move forms, AVX FP arithmetic/compare/convert/test, string-compare and MXCSR forms, control flow or calls mixed with AVX state, nonvolatile `XMM6`..`XMM15` prologues, title CPU execution.
upstream-sync closed this pull request 2026-11-24 06:42:41 +00:00
copilot-pull-request-reviewer[bot commented 2026-11-24 06:42:42 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by copilot-pull-request-reviewer[bot] on 2026-11-21T23:40:39Z.

Review: COMMENTED


Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6008895343 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/373#pullrequestreview-6008895343). Originally posted by [copilot-pull-request-reviewer[bot]](https://github.com/copilot-pull-request-reviewer%5Bbot%5D) on 2026-11-21T23:40:39Z. **Review:** COMMENTED --- Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
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!367
No description provided.