cpu: lift memory-source forms of the AVX logical ops #1369
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1376"
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-24T09:42:18Z.
What
tools/cpu_avx_move_aot.pylifts the memory-source forms ofvandpd,vandps,vandnpd,vandnps,vorpd,vorps,vxorpdandvxorps:(xmm, xmm, m128)and(ymm, ymm, m256)with the same flat[base + disp]operand the other memory forms accept (basercx,rdxorr8). No new addressing mode: index/scale, RIP-relative, 32-bit address-size bases, segment prefixes and EVEX stay refused with the existing messages.op(register source, memory).vandn*inverts the register operand, never the memory one. The memory is read with the existingload128/load256and combined by the existingLOGICAL_HELPERSon raw 64-bit words, so there is no NaN canonicalisation or float conversion. VEX.128 forms still zero bits 255:128.REGISTER_ONLY_AVX; the other 20 members are unchanged (vblend*,vextractf128,vinsertf128,vextractps,vinsertps,vperm2f128,vpermil*,vshuf*,vunpck*,vmovddup,vmovshdup,vmovsldup).tests/cpu/avx_move_mem.asm/.def(16 exports) andtests/cpu/avx_move_mem_check.py, wired ascpu_aot_avx_move_mem(original andALTER_MUTbuilds, exits 77 without AVX).tests/cpu/avx_move_regs_check.py: the eight logical memory encodings were the "register-only with memory" negative controls; they are removed, and the PE-patched controls now usevshufpsandvperm2f128memory forms, which stay register-only. Counts drop from 30 to 22 unit memory controls.tools/form_coverage.pymaps the new fixture to the new test.docs/experiments.mdis updated, including every sentence that listed the logical ops as register-only.Why
The leaf translator refused
vandps ymm0, ymm1, [rdx+disp]and the other seven ops with a memory source, so leaf functions that mask or merge straight from memory could not be lifted by it.Tested
Windows (not run locally: MSVC/ML64 is not available here). Please run:
Run on Linux:
llvm-ml-19(so the MASM syntax was accepted by an MASM-compatible assembler) and linked withlld-link-19, original andALTER_MUT; the realtranslate()produced the C++; that was built with MinGW g++ at -O0 and -O2 and run under Wine next to the native DLL by a throwaway loader. The realcheck_differentialran on those results: 4,864 cases over 16 exports (all 256 pairs of 16 bit patterns including quiet and signaling NaNs, negative zero, all-ones, all-zero and differing upper lanes, plus 48 random cases per export, pointers shifted by 0, 1, 7 and 16 bytes) matched native, lifted and an independent bytewise model in both builds. The altered build matched its altered model and diverged from the unaltered result on all six mutated exports.vandn*operands swapped and one that keeps the register source's upper half in the VEX.128 result both failed the check.rsp/rax/r9bases, segment prefix, undefined source, nonvolatile destination, memory forms of five still register-only ops,vaddpsmemory).avx_move_regs_check.pyrejection part passes on allvm-ml-19build (71 unit and 11 PE-patched controls), and the C++ translated from all 150 existingavx_move_regsexports is byte-identical before and after this change.py_compileon the touched Python,tests/form_coverage_check.py,tests/docs_links_check.py,tests/bidi_controls_check.pyandgit diff --checkpass.Not run: the MSVC/ML64 build and the Windows ctest runs above.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T09:44:48Z.
Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207) at commit
028efdfe35c12ef6bfb7f3cf1a8c54927320847e:tests/form_coverage_check.pyok (39.1s)--preset dev):cpu_avx_move_mem_*,cpu_avx_move_regs_*):3.49s(configure1.61s)ctest --preset dev -R '^(cpu_aot_avx_move_mem|cpu_aot_avx_move_regs)$' --parallel 4 --no-tests=error --output-on-failure): 2/2 passed (cpu_aot_avx_move_regs0.33s,cpu_aot_avx_move_mem0.51s)/O2(--preset release):cpu_avx_move_mem_*,cpu_avx_move_regs_*):1.39s(configure1.60s)ctest --preset release -R '^(cpu_aot_avx_move_mem|cpu_aot_avx_move_regs)$' --parallel 4 --no-tests=error --output-on-failure): 2/2 passed (cpu_aot_avx_move_regs0.30s,cpu_aot_avx_move_mem0.54s)Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T09:44:56Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
028efdfℹ️ 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.