cpu: lower 32-bit and 64-bit ROL, ROR, SHLD, and SHRD instructions #287
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/291"
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 Vonsek on 2026-11-21T20:58:02Z.
Change
rol,ror,shld, andshrdwith both immediate andclcounts intools/ffx_version_query.py, preserving ZF/CF on zero masked counts while zero-extending 32-bit destinations.tests/cpu/rotates_shifts.asm,tests/cpu/rotates_shifts.def) and differential test (tests/cpu/rotates_shifts.py) wired intoCMakeLists.txtascpu_aot_rotates_shifts, verifying all 12 exports (values, 32-bit zero-extension, and ZF/CF flags) against both the native DLL and a reference model.rotates_shifts->cpu_aot_rotates_shiftsintools/form_coverage.py(+4 Integer mnemonics indocs/coverage/x64_zen2.tsv) and document the test indocs/experiments.md.Verification
Tested on Windows 11 (VS 2022 Build Tools 17.14, MSVC 19.44, ML64 14.44, Windows SDK 10.0.26100, Python 3.12):
cmake --build --preset dev --target cpu_rotates_shifts_liftedfailed with:cmake --build --preset dev --target cpu_rotates_shifts_liftedsucceeded.ctest --preset dev --no-tests=error -R "^(cpu_aot_rotates_shifts|cpu_aot_shift_count|cpu_aot_version_query|cpu_aot_address_size)$" -V: 4/4 passed (2244 rotate and double-precision shift cases (ROL, ROR, SHLD, SHRD) matched native and translated DLLs).python -B tests/form_coverage_check.py:form coverage checks passed.Evidence and follow-up
rol,ror,shld,shrd) todocs/coverage/x64_zen2.tsvcoverage.Checklist
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-21T22:11:54Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
302a100ℹ️ 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.
Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-21T23:01:02Z.
A coverage note from reading the diff at
d903b2c, without building it.The description says a zero masked count preserves ZF and CF. Two gaps:
shld eax, edx, 32(0F A4 D0 20, which iced decodes with an 8-bit immediate) aftercmp r10d, r10dwould cover it: ZF = 1 and CF = 0 must survive, and RAX should match what the CL cases already expect for a zero count, the zero-extended EAX.cmp r10d, 1. A lowering that forced those values on a zero masked count would still pass. A second seed,cmp r10d, r10d(ZF = 1, CF = 0), over the existing counts 0, 32 and 64 would separate the two.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by Vonsek on 2026-11-21T23:07:06Z.
Good catch — added
shld32_imm32(shld eax, edx, 32aftercmp r10d, r10d) plusrol32_cl_zfandshld32_cl_zf(seeded withZF=1, CF=0over counts 0, 32, and 64) totests/cpu/rotates_shifts.asmandtests/cpu/rotates_shifts.py.