cpu: cover ten AVX integer translator semantics that no test observed #597

Merged
Leyukaka merged 1 commit from upstream-pr/603 into main 2026-11-22 15:33:48 +00:00
Leyukaka commented 2026-11-22 15:13:58 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-22T15:13:58Z.


Change

This closes ten coverage gaps in the VEX AVX packed-integer translator, tools/cpu_avx_int_aot.py. Each was a one-line mutation of the translator that passed every cpu_ test on main. Only the cpu_aot_avx_int_regs fixture, its check and its CMake export list change; the translator does not.

tests/cpu/avx_int_regs.asm gains ten exports. Each uses an immediate or register state that no existing export had:

  • op_palignr_69: a vpalignr count above 32;
  • op_mpsadbw_6: a vmpsadbw with block select 2;
  • op_pshuflw_1b: a vpshuflw selector with bit 4 set;
  • op_psllq_imm_129: a shift count of 81h;
  • op_pextrw_reg_2, op_pextrd_reg_2 and op_pinsrw_reg_3: lane indices that the existing exports never used;
  • op_pinsrb_reg_upper: a vpinsrb whose source has a nonzero upper half;
  • op_zeroupper_ymm1: vzeroupper observed through ymm1;
  • op_movdqu_load128: a VEX.128 load into a preloaded YMM register.

The check computes each expected value with its existing Python model and compares native, lifted and reference results over the existing input pairs.

Verification

On eebe999 (branch on 997518d), Windows 11 build 26300.9974, MSVC 14.44.35207, Python 3.14:

ctest --preset dev --no-tests=error -R '^cpu_aot_avx_int_regs$' -V
ctest --preset dev --no-tests=error -j 4

Both pass (278 of 278 for the full suite).

Each mutation was applied to tools/cpu_avx_int_aot.py one at a time, followed by a rebuild and the whole cpu_ family. On main, every cpu_ test passed for each one. A control that made vpalignr ignore its immediate was caught by cpu_aot_avx_int_regs, so the run does detect a broken translator. On this branch, each mutation fails cpu_aot_avx_int_regs:

Mutation Caught by
vzeroupper clears only ymm0 op_zeroupper_ymm1
vpinsrb keeps the source upper half op_pinsrb_reg_upper
vpextrd forces index bit 0 op_pextrd_reg_2
vpextrw forces index bit 2 op_pextrw_reg_2
vpinsrw drops index bit 0 op_pinsrw_reg_3
vpshuflw drops selector bit 4 op_pshuflw_1b
vmpsadbw aliases block select 2 to 3 op_mpsadbw_6
vpalignr masks the count to 6 bits op_palignr_69
shift immediates masked to 7 bits op_psllq_imm_129
a VEX.128 load leaves bits 255:128 set op_movdqu_load128

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. (No capability changed.)
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6544031635 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/603). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-22T15:13:58Z. --- ## Change This closes ten coverage gaps in the VEX AVX packed-integer translator, `tools/cpu_avx_int_aot.py`. Each was a one-line mutation of the translator that passed every `cpu_` test on `main`. Only the `cpu_aot_avx_int_regs` fixture, its check and its CMake export list change; the translator does not. `tests/cpu/avx_int_regs.asm` gains ten exports. Each uses an immediate or register state that no existing export had: - `op_palignr_69`: a `vpalignr` count above 32; - `op_mpsadbw_6`: a `vmpsadbw` with block select 2; - `op_pshuflw_1b`: a `vpshuflw` selector with bit 4 set; - `op_psllq_imm_129`: a shift count of `81h`; - `op_pextrw_reg_2`, `op_pextrd_reg_2` and `op_pinsrw_reg_3`: lane indices that the existing exports never used; - `op_pinsrb_reg_upper`: a `vpinsrb` whose source has a nonzero upper half; - `op_zeroupper_ymm1`: `vzeroupper` observed through ymm1; - `op_movdqu_load128`: a VEX.128 load into a preloaded YMM register. The check computes each expected value with its existing Python model and compares native, lifted and reference results over the existing input pairs. ## Verification On `eebe999` (branch on `997518d`), Windows 11 build 26300.9974, MSVC 14.44.35207, Python 3.14: ```text ctest --preset dev --no-tests=error -R '^cpu_aot_avx_int_regs$' -V ctest --preset dev --no-tests=error -j 4 ``` Both pass (278 of 278 for the full suite). Each mutation was applied to `tools/cpu_avx_int_aot.py` one at a time, followed by a rebuild and the whole `cpu_` family. On `main`, every `cpu_` test passed for each one. A control that made `vpalignr` ignore its immediate was caught by `cpu_aot_avx_int_regs`, so the run does detect a broken translator. On this branch, each mutation fails `cpu_aot_avx_int_regs`: | Mutation | Caught by | |---|---| | `vzeroupper` clears only ymm0 | `op_zeroupper_ymm1` | | `vpinsrb` keeps the source upper half | `op_pinsrb_reg_upper` | | `vpextrd` forces index bit 0 | `op_pextrd_reg_2` | | `vpextrw` forces index bit 2 | `op_pextrw_reg_2` | | `vpinsrw` drops index bit 0 | `op_pinsrw_reg_3` | | `vpshuflw` drops selector bit 4 | `op_pshuflw_1b` | | `vmpsadbw` aliases block select 2 to 3 | `op_mpsadbw_6` | | `vpalignr` masks the count to 6 bits | `op_palignr_69` | | shift immediates masked to 7 bits | `op_psllq_imm_129` | | a VEX.128 load leaves bits 255:128 set | `op_movdqu_load128` | ## 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. - [ ] I updated README/docs when a capability or build requirement changed. (No capability 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:43:53 +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!597
No description provided.