cpu: lower 32-bit and 64-bit ROL, ROR, SHLD, and SHRD instructions #291
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!291
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/291/head"
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?
@Vonsek on GitHub · 2026-11-21 20:58 UTC · original
Vonsek:ag/cpu-lower-rotates-shifts→main· +514 −0 · 7 files · 3 commits · merged 2026-11-22 02:38 UTCChange
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
@chatgpt-codex-connector[bot] on GitHub · 2026-11-21 22:11 UTC · original · edited 2026-11-21 22:16 UTC
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.
@Leyukaka on GitHub · 2026-11-21 23:01 UTC · original
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.
@Vonsek on GitHub · 2026-11-21 23:07 UTC · original
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.