Pin AVX integer palignr wrap, pmaddwd overflow, wide-source pmovsx, vzeroupper and blend-mask checks #985
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/992"
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 Leyukaka on 2026-11-23T20:13:53Z.
Change
This closes five gaps in the test coverage of
tools/cpu_avx_int_aot.py. Each is a small mutation of the translator that passescpu_aot_avx_int_regsonmain. The translator does not change; the native fixture DLL and the Python reference model remain the two references.op_palignr_255:vpalignrwith imm80FFh(all zero)op_pmaddwdwith words 0 and 1 of both operands at -32768 (dword 0 is0x80000000)0x7fffffffop_pmovsxbq_wide_src:vpmovsxbq xmm0, xmm1after a 32-byte load ofymm1op_zeroupper_ymm2:vzeroupperwithymm2live, then a 32-byte store ofymm2vzeroupperclearing onlyymm0andymm1undef_blend_mask:vpblendvbwith defined data sources and an undefined mask registerxmm3:undefined vector register ymm3The three new exports are in
tests/cpu/avx_int_regs.{asm,def}and in the CMake export list, and are checked like the others against both the native DLL and the reference model. With them the check runs 1,728 differential cases across 132 exports and 111 unit rejection controls (19 EVEX/ABI/state).docs/experiments.mdis updated to those counts; it said 119 exports and 1,568 cases, which were already behindmain(129 and 1,688).Verification
On
9ecdc94(based onmainatb3311bf), Windows 11 build 26300, MSVC 14.44.35207, Python 3.14:The test passes and prints
1728 native/lifted/reference AVX packed-integer cases across 132 exports matched bit-for-bit; ...and111 unit rejection controls (25 VEX.L=1 integer, 25 register-domain memory, 32 carved-out, 10 out-of-scope, 19 EVEX/ABI/state) and 11 PE-patched rejection controls passed. The docs check passes.Each mutation was applied to
tools/cpu_avx_int_aot.pyone at a time, the project was rebuilt so the translation was regenerated, andcpu_aot_avx_int_regswas run with themainand the branch versions ofavx_int_regs_check.py, both against the branch build (the new exports are only called by the branch version). With the unmutated translator both pass. Withmain's check, the test passed under all five mutations; with this branch's check it fails under each of them.The five edits to
tools/cpu_avx_int_aot.py:const unsigned idx = i + static_cast<unsigned>(imm8);->const std::uint8_t idx = static_cast<std::uint8_t>(i + imm8);set_lane32(out, i, p0 + p1);->const std::int64_t sum = static_cast<std::int64_t>(s32(p0)) + s32(p1); set_lane32(out, i, sum > 0x7fffffffll ? 0x7fffffffu : static_cast<std::uint32_t>(sum));op_vpmovsxbq, the trailing0ull, 0ull->a.q[2], a.q[3]for idx in sorted(defined_vec):->for idx in sorted(defined_vec & {0, 1}):in thevzeroupperloweringif idx not in defined_vec:->if idx not in defined_vec and op_index != 3:Checklist
AI-assisted.