cpu: lower 16 VEX.256 AVX2 cross-lane extend and dword/qword unpack forms #2606
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2614"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by Ammmae0x on 2026-11-25T23:21:59Z.
Change
Lower 16 register-only VEX.256 (L=1, AVX2) packed-integer forms in
tools/cpu_avx_int_aot.pyand add MASM differential/refusal/mutation coverage intests/cpu/avx_int_ymm_widen_unpack.{asm,def,_check.py}(registered ascpu_aot_avx_int_ymm_widen_unpackinCMakeLists.txtwithSKIP_RETURN_CODE 77andFORM_COVERAGE_RECORD):VPMOVSX{BW,BD,BQ,WD,WQ,DQ}andVPMOVZX{BW,BD,BQ,WD,WQ,DQ}(modeling exact Intel SDM cross-lane slicing, ignored upper XMM/YMM bytes, stale destination overwrite, aliaseddst == src, and VEX.256->128 upper-half zeroing).VPUNPCK{L,H}{DQ,QDQ}viawide128.VPUNPCK{L,H}{BW,WD}).tests/cpu/avx_int_regs_check.pyandtests/cpu/avx_int_ymm_abs_sign_shuf_check.pyto replace newly lowered forms in their VEX.256 refusal lists with genuinely unlowered VEX.256 shift forms (vpsrld/vpsllq/vpsrlq).AI-assisted.
Verification
Tested on commit
905ffec8(rebased onupstream/main) with MSVC 19.50 + ML64 14.50 andout\pe-env\Scripts\python.exe -B:ctest --preset dev -N: Total Tests: 2082 (no dropped tests).cmake --build --preset dev --target cpu_avx_int_regs_original cpu_avx_int_regs_original_lifted cpu_avx_int_regs_altered cpu_avx_int_regs_altered_lifted cpu_avx_int_ymm_abs_sign_shuf cpu_avx_int_ymm_abs_sign_shuf_lifted cpu_avx_int_ymm_widen_unpack_original cpu_avx_int_ymm_widen_unpack_original_lifted cpu_avx_int_ymm_widen_unpack_altered cpu_avx_int_ymm_widen_unpack_altered_lifted: 0 errors, 0 warnings.ctest --preset dev --output-on-failure --no-tests=error -R "^(cpu_aot_avx_int_regs|cpu_aot_avx_int_ymm_abs_sign_shuf|cpu_aot_avx_int_ymm_widen_unpack)$" -E "cpu_native_archive_" -V: 3/3 passed (cpu_aot_avx_int_ymm_widen_unpack: 16 forms accepted, 31 rejection controls, 4,536 native/lifted/reference cases across 24 exports matched bit for bit, 13 mutant + 16 altered-build controls caught; 0 capability skips on AVX2 host).cmake --build --preset release --target ...(/O2): 0 errors, 0 warnings; same targeted CTest inrelease: 3/3 passed.FORM_COVERAGE_RECORDwritten in bothdevandreleasecontaining all 16 mnemonics plusret,vmovdqu,vzeroupper.tools/cpu_avx_int_aot.py(wide_extend,VPUNPCKLDQcode, memory-operand guard, EVEX guard); 4/4 mutations killed bycheck_translator()and restored cleanly.out\pe-env\Scripts\python.exe -B tests\form_coverage_check.py: passed (exit 0).out\pe-env\Scripts\python.exe -B tests\docs_links_check.py: passed (exit 0).out\pe-env\Scripts\python.exe -B tests\bidi_controls_check.py: passed (exit 0).Evidence and follow-up
All fixtures in
tests/cpu/avx_int_ymm_widen_unpack.{asm,def}are source-built synthetic MASM routines (MIT License). Native execution is CPUID AVX2 gated (exit 77 on non-AVX2 hosts). Remaining unlowered VEX.256 integer shifts, multiplies, blends, and aligns remain follow-ups.Checklist
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T23:30:10Z.
Review: COMMENTED
Review of head
905ffec8(comment only).Result: no blocking findings in the code.
Checked:
tools/cpu_avx_int_aot.py: the 12 YMM extend forms and the 4 YMMvpunpck{l,h}{dq,qdq}forms are added toWIDE_*tables and toALLOWED_CODES. Thelift_codebranch for extends reads the XMM source and writes a YMM destination, so the upper half is written and not left stale. Operand/ABI refusals (memory operands, nonvolatile YMM6-15, EVEX, unloweredvpunpck{l,h}{bw,wd}) are unchanged.extend_*helpers replace the twelve old 128-bit helpers. I compared them by hand: the counts (8/4/2 for XMM, 16/8/4 for YMM) and the sign/zero rules match the previous per-form code, so the 128-bit forms keep their behaviour.avx_int_regs_check.py,avx_int_ymm_abs_sign_shuf_check.py) are updated to forms that are still unlowered (vpsrld,vpsllq,vpsrlq). New test is registered withSKIP_RETURN_CODE 77. No other open or merged PR lowers these forms.Commands run (Linux, exact head in a worktree):
git diff --check origin/main...HEAD: cleanpython3 tests/docs_links_check.py: okpython3 tests/bidi_controls_check.py: okiced_x86,pefileand MASM, which are not on Linux, so they and the mutation cases are run on Windows. The receipt will follow.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T23:30:51Z.
Win2025 WARP receipt for head
905ffec8.Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
905ffec8c6c424ac31d3018c9fbff210142f06c0:--preset dev):cmake --build --preset dev --target cpu_avx_int_regs_altered_lifted cpu_avx_int_regs_original_lifted cpu_avx_int_ymm_abs_sign_shuf_lifted cpu_avx_int_ymm_addsub_lifted cpu_avx_int_ymm_horizontal_altered_lifted cpu_avx_int_ymm_horizontal_original_lifted cpu_avx_int_ymm_minmax_lifted cpu_avx_int_ymm_mul_sad_altered_lifted cpu_avx_int_ymm_mul_sad_original_lifted cpu_avx_int_ymm_pack_altered_lifted cpu_avx_int_ymm_pack_original_lifted cpu_avx_int_ymm_sat_lifted cpu_avx_int_ymm_widen_unpack_altered cpu_avx_int_ymm_widen_unpack_altered_lifted cpu_avx_int_ymm_widen_unpack_original cpu_avx_int_ymm_widen_unpack_original_lifted -- -j 2):5.94s(configure1.82s)ctest --preset dev -R 'avx_int' --parallel 6 --no-tests=error --output-on-failure): 12/12 passed (1.32s:cpu_aot_avx_int_shifts_pack0.39s,cpu_aot_avx_int_ymm_mul_sad0.46s,cpu_aot_avx_int_ymm_pack0.48s,cpu_aot_avx_int_ymm_horizontal0.49s,cpu_aot_avx_int_ymm_abs_sign_shuf0.71s,cpu_aot_avx_int_ymm_sat0.71s,cpu_aot_avx_int_extend_hadd0.43s,cpu_aot_avx_int_minmax_mul0.42s,cpu_aot_avx_int_regs0.55s,cpu_aot_avx_int_ymm_minmax0.55s,cpu_aot_avx_int_ymm_addsub0.45s,cpu_aot_avx_int_ymm_widen_unpack0.46s)/O2(--preset release):cmake --build --preset release --target cpu_avx_int_regs_altered_lifted cpu_avx_int_regs_original_lifted cpu_avx_int_ymm_abs_sign_shuf_lifted cpu_avx_int_ymm_addsub_lifted cpu_avx_int_ymm_horizontal_altered_lifted cpu_avx_int_ymm_horizontal_original_lifted cpu_avx_int_ymm_minmax_lifted cpu_avx_int_ymm_mul_sad_altered_lifted cpu_avx_int_ymm_mul_sad_original_lifted cpu_avx_int_ymm_pack_altered_lifted cpu_avx_int_ymm_pack_original_lifted cpu_avx_int_ymm_sat_lifted cpu_avx_int_ymm_widen_unpack_altered cpu_avx_int_ymm_widen_unpack_altered_lifted cpu_avx_int_ymm_widen_unpack_original cpu_avx_int_ymm_widen_unpack_original_lifted -- -j 2):7.27s(configure1.90s)ctest --preset release -R 'avx_int' --parallel 6 --no-tests=error --output-on-failure): 12/12 passed (1.21s:cpu_aot_avx_int_ymm_mul_sad0.43s,cpu_aot_avx_int_ymm_addsub0.50s,cpu_aot_avx_int_ymm_sat0.54s,cpu_aot_avx_int_ymm_minmax0.53s,cpu_aot_avx_int_regs0.56s,cpu_aot_avx_int_ymm_abs_sign_shuf0.64s,cpu_aot_avx_int_extend_hadd0.36s,cpu_aot_avx_int_ymm_horizontal0.52s,cpu_aot_avx_int_minmax_mul0.44s,cpu_aot_avx_int_ymm_pack0.51s,cpu_aot_avx_int_shifts_pack0.42s,cpu_aot_avx_int_ymm_widen_unpack0.54s)sccache: 3/35 hits; wall23.4sAI-assisted; commands listed were executed locally.