cpu: lift 16/32/64-bit MOVBE load and store leaf functions to C++ #2681
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2689"
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-26T02:06:23Z.
Change
Add a dedicated bounded x64-to-C++ leaf lifter (
tools/cpu_movbe_aot.py) and source-built MASM/CTest differential suite (tests/cpu/movbe_aot.{asm,def,_check.py}, CTestcpu_aot_movbe_dedicated) covering all 6MOVBEload and store forms (MOVBE_R16_M16,MOVBE_R32_M32,MOVBE_R64_M64from flat[rcx|rdx|r8]or[rcx|rdx|r8 + 0..64];MOVBE_M16_R16,MOVBE_M32_R32,MOVBE_M64_R64strictly to[r8]or[r8 + 0..64]).MOVBEloads reverse 2 bytes and preserve destination bits[63:16](requiring a defined destination register); 32-bitMOVBEloads reverse 4 bytes and zero-extend bits[63:32]; 64-bit loads and all stores reverse byte order; all 6 forms leave RFLAGS (CF/ZF/SF/OF/PF) completely unmodified.load_always()/store_always()withatomic_signal_fenceand volatile observation so/O2preserves faulting memory reads (verified byop_movbe_discarded_read).[r8], negative or out-of-window displacements (> 64), indexed/scaled/RIP-relative memory operands, reg-regMOVBEencodings, nonvolatile/high-byte GPRs, writes to argument GPRs, undefined GPR/flag reads, VEX/EVEX/XOP encodings, prefixes, branches, and missing/trailing instructions afterret.cpu_aot_movbe_dedicatedwithSKIP_RETURN_CODE 77(CPUID.01H:ECX[22] MOVBE gate) andFORM_COVERAGE_RECORD(; coverage: record cpu_aot_movbe_dedicated).Verification
51b1c90d(based onupstream/mainb2564017)cmake --preset dev+cmake --build --preset dev --target cpu_movbe_aot_original cpu_movbe_aot_original_lifted cpu_movbe_aot_altered cpu_movbe_aot_altered_lifted-> 0 errors, 0 warningsctest --preset dev -N->Total Tests: 2178(cpu_aot_movbe_dedicatedregistered)ctest --preset dev --output-on-failure -R "^cpu_aot_movbe_dedicated$" -E "cpu_native_archive_"->1/1 Passed(1.27s);out\build\dev\form_coverage\cpu_aot_movbe_dedicated.txtrecorded 11 forms (includingmovbe)cmake --preset release+cmake --build --preset release --target cpu_movbe_aot_original cpu_movbe_aot_original_lifted cpu_movbe_aot_altered cpu_movbe_aot_altered_lifted-> 0 errors, 0 warningsctest --preset release --output-on-failure -R "^cpu_aot_movbe_dedicated$" -E "cpu_native_archive_"->1/1 Passed(1.35s);out\build\release\form_coverage\cpu_aot_movbe_dedicated.txtrecorded 11 formsout\pe-env\Scripts\python.exe -B tests\form_coverage_check.py->form coverage checks passed(exit 0)out\pe-env\Scripts\python.exe -B tests\docs_links_check.py->Self-test passed. Checked 19 Markdown files and 515 links.(exit 0)out\pe-env\Scripts\python.exe -B tests\bidi_controls_check.py->Self-test passed. Checked 1906 tracked source, script and build/CI files: no bidirectional controls.(exit 0)bswap16no-swap,update_gpr_width16-bit upper-bit clear, non-[r8]store guard).ALTER_MOVBEdiverging exports, 4 mutant models, 33 IR + 5 raw-byte + 11 PE-patched + CLI rejections, RFLAGS preservation across 3 flag patterns, and discarded NULL-read fault preservation under/O2.Evidence and follow-up
All assembly fixtures in
tests/cpu/movbe_aot.asmare source-built MASM x64 routines authored under the repository MIT license. Portable lifted, mutant, rejection, and/O2 /W4 /WXcompilation checks run unconditionally before the CPUID.01H:ECX[22] native differential gate (exit 77 on hosts without MOVBE).Checklist
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T03:12:22Z.
Review: COMMENTED
Review of head
5073b0ea(comment only).Checked:
tools/cpu_movbe_aot.py) and source-built MASM/CTest differential suitecpu_aot_movbe_dedicated. The siblingcpu_aot_movbe(shared lifter, #412) is untouched; no other open or merged PR covers this slice (gh pr list --state all --search MOVBE).ALTER_MOVBE) and reference-model quirks as negative controls, covers flag preservation and a discarded faulting read under /O2, and has rejection cases.foreach/endforeachbalanced,SKIP_RETURN_CODE 77andFORM_COVERAGE_RECORDset.Commands run:
git diff --check origin/main...HEAD: cleanpython3 tests/docs_links_check.py: passpython3 tests/bidi_controls_check.py: passx2w_pipe.py win2025 2689 --regex cpu_aot_movbe: dev 2/2 and release 2/2 passed (receipt follows in the next comment)Not run: the Python suite on Linux (it needs MASM and the Windows build).
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T03:12:23Z.
Win2025 WARP receipt for head
5073b0eaafter updating with main.Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
5073b0eaa94b4e01a4cf621f69852eac6a7480e5:--preset dev):cmake --build --preset dev --target cpu_movbe_aot_altered cpu_movbe_aot_altered_lifted cpu_movbe_aot_original cpu_movbe_aot_original_lifted -- -j 2):4.14s(configure5.06s)ctest --preset dev -R 'cpu_aot_movbe' --parallel 2 --no-tests=error --output-on-failure): 2/2 passed (2.19s:cpu_aot_movbe0.54s,cpu_aot_movbe_dedicated1.95s)/O2(--preset release):cmake --build --preset release --target cpu_movbe_aot_altered cpu_movbe_aot_altered_lifted cpu_movbe_aot_original cpu_movbe_aot_original_lifted -- -j 2):4.98s(configure4.05s)ctest --preset release -R 'cpu_aot_movbe' --parallel 2 --no-tests=error --output-on-failure): 2/2 passed (2.23s:cpu_aot_movbe0.41s,cpu_aot_movbe_dedicated1.97s)sccache: 30/41 hits; wall32.6sAI-assisted; commands listed were executed locally.