cpu: lift ROL and ROR in cpu_switch_aot.py #778
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/784"
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-23T03:09:19Z.
Change
Add
ROLandRORlifting intools/cpu_switch_aot.pyvia a sharedrotate_bits<T>helper inPRELUDE, register thecpu_switch_rotatesMASM fixture andcpu_aot_switch_rotatesCTest inCMakeLists.txt, and document the behavior and reproduction commands indocs/experiments.md.tools/cpu_switch_aot.py:ROTATES = {M.ROL: "true", M.ROR: "false"}androtate_bits<T>(T value, word count, bool left)inPRELUDE, maskingcounttobits - 1(withshift == 0returningvalueunchanged to avoid undefined shifts) and preserving x64 32-bit zero-extension and 8-/16-bit upper-byte preservation viaself.write(...).ROLandRORout ofFLAG_NEUTRALandFLAG_PRODUCERS, and rejectsets_flags=Truewithunsupported flag producer.tests/cpu/switch_rotates.asm,tests/cpu/switch_rotates.def,tests/cpu/switch_rotates_check.py:1/imm8/CLcounts, count0, counts>= width * 8, upper-byte preservation, singleload_always<T>memory read per instruction, a narrow 1-byte return, and 12 rejection controls (10 whole-PE controls + 2 directLifter().lower(..., sets_flags=True)checks).CMakeLists.txt,docs/experiments.md:cpu_switch_rotatesandcpu_aot_switch_rotatesand document the measured fixture counts and commands.Verification
Commit tested:
d5cc461(clean rebuild and test runs on Windows x64, VS 2026 / MSVC 14.50).& .\tools\dev.ps1):cmake --preset dev-> configured cleanlycmake --preset release-> configured cleanlycpu_switch_rotates,cpu_switch_rotates_lifted,cpu_register_probe:cmake --build --preset dev --target cpu_switch_rotates cpu_switch_rotates_lifted cpu_register_probe(after clearingcpu_switch_rotates*build outputs) -> 0 errors, 0 warningscmake --build --preset release --target cpu_switch_rotates cpu_switch_rotates_lifted cpu_register_probe(after clearingcpu_switch_rotates*build outputs) -> 0 errors, 0 warningsdevandreleasepresets):ctest --preset dev --no-tests=error -R "^cpu_aot_(switch_.*|sse_.*)$" -V-> 3/3 passed (cpu_aot_switch_strings,cpu_aot_switch_addr32,cpu_aot_switch_rotates: 8,363 differential comparisons + 12 rejection controls passed, 0 skipped)ctest --preset release --no-tests=error -R "^cpu_aot_(switch_.*|sse_.*)$" -V-> 3/3 passed (8,363 differential comparisons + 12 rejection controls passed, 0 skipped)ctest --preset dev --no-tests=error -R "^cpu_aot_(switch_|sse)"-> 9/9 passedctest --preset release --no-tests=error -R "^cpu_aot_(switch_|sse)"-> 9/9 passedctest --preset dev --no-tests=error -R "rotate|flag_conditions"-> 4/4 passed (cpu_aot_flag_conditions,cpu_aot_switch_rotates,cpu_aot_carry_rotates,cpu_aot_rotates_shifts)ctest --preset release --no-tests=error -R "rotate|flag_conditions"-> 4/4 passed.\out\pe-env\Scripts\python.exe -B tests/form_coverage_check.py->form coverage checks passed.\out\pe-env\Scripts\python.exe -B tests/docs_links_check.py->Checked 13 Markdown files and 146 links..\out\pe-env\Scripts\python.exe -B tests/bidi_controls_check.py->Checked 631 tracked source, script and build/CI files: no bidirectional controls.Evidence and follow-up
tests/cpu/switch_rotates.asmis an original source-owned MASM fixture in this repository (MIT License), annotated with; coverage: source cpu_aot_switch_rotates.CF/OFonROL/ROR) andRCL/RCRremain out of scope forcpu_switch_aot.py; any flag consumer (Jcc,SETcc,CMOVcc) reading flags across or fromROL/RORis rejected.Checklist
AI-assisted.