cpu: lower 256-bit packed integer min and max in the AVX translator #1276
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1283"
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 tedin7 on 2026-11-24T06:44:04Z.
What
tools/cpu_avx_int_aot.pyaccepts the VEX.256 (AVX2) register forms ofvpmaxsb/sw/sd/ub/uw/udandvpminsb/sw/sd/ub/uw/ud. Each 128-bit half is computed on its own through the existingwide128path and all 256 destination bits are written. Two new helpers,op_vpmaxswandop_vpminsw, are added because the 128-bit word forms belong tocpu_vex_aot.pyand stay rejected here.L=1integer forms, EVEX and nonvolatile or never-written registers keep their existing refusals.tests/cpu/avx_int_ymm_minmax.asm/.def(15 exports: the 12 forms, two aliasing cases, a 256-bit write followed by a 128-bit write) andtests/cpu/avx_int_ymm_minmax_check.py, with CMake exports and aform_coverage.pyentry. Same structure as the add/subtract/compare PR.vpmaxsdrefusal control fromavx_int_regs_check.py(it now describes a supported form) and replaced the same use inavx_int_ymm_addsub_check.pywithvpmulld.docs/experiments.md: one paragraph for the new forms.Why
The translator lowered the XMM min/max forms but refused every YMM one. The new check compares native and translated output against an independent model over the lane-width edges (0, 1, 0x7f, 0x80, 0xff, 0x7fff, 0x8000, 0xffff, INT32 min/max, UINT32 max) with different lower and upper halves. Negative controls: upper-half-ignored model, flipped signedness, opposite pick and other widths must all differ; a memory-operand form is refused.
Tested
Windows (not run here):
Linux (run here, AVX2 host): the same instruction sequences assembled with GNU as, the translator run on them, the lifted C++ built with g++ and run against the native code: 12 forms accepted, 9 translator rejection controls passed, 3450 native/lifted/model cases matched, 64 negative controls caught. Changing the translated
vpmaxsdto the unsigned helper, andvpminuwto the signed helper, in the lifted C++ made the check fail. Also run:tests/docs_links_check.py,tests/bidi_controls_check.py,tests/form_coverage_check.py, py_compile, and the translator part of the add/subtract check.MSVC/ML64 was NOT run locally. The PE build,
avx_int_regs_check.pyend to end and the Windows ctest run have not been exercised.Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T06:50:44Z.
Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207) at
ccd18f16:tests/form_coverage_check.py— PASS (39.25s)--preset dev): 63/63 PASS (cpu_aot_avx_int_ymm_minmax,cpu_aot_avx_int_ymm_addsub,cpu_aot_avx_int_regs, plus 60 downstream WARP tests)/O2(--preset release): 63/63 PASS (cpu_aot_avx_int_ymm_minmax0.24s,cpu_aot_avx_int_ymm_addsub0.27s,cpu_aot_avx_int_regs0.33s, plus 60 downstream WARP tests)Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T06:50:56Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
ccd18f1ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.