cpu: observe SAR sign fill and the CF a zero-count shift keeps #352
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!352
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/352/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?
@Leyukaka on GitHub · 2026-11-21 23:06 UTC · original
Leyukaka:shift-flag-controls→main· +34 −2 · 3 files · 1 commits · merged 2026-11-21 23:25 UTCChange
This closes two gaps in the immediate-shift lowering of
lower()intools/ffx_version_query.py. Each was a mutation of the lowering that passed everycpu_test onmain. Only thecpu_aot_shift_countfixture and its test change.lower()ran an immediatesarwith a nonzero count.sar_zerois the zero-count control, and the other nonzero shifts thatlower()handles in fixtures areshl.narrow.asmandswitch.asmusesarbycl, buttools/cpu_switch_aot.pylowers those itself. The newsar_threeexport runssar eax, 3on the existing values. For example,0x80000000must give0xf0000000.flags_zeroobserves only ZF throughsete. The newcarry_zeroexport runscmp ecx, edx; shl eax, 0and reads CF throughjae, on five pairs on each side of the compare.Verification
On
35e6d0a(branch onbc24dfd), Windows 11 build 26300.9974, MSVC 14.44.35207, Python 3.14:The full suite passes 146 of 146 tests.
Each mutation was applied to
tools/ffx_version_query.py, followed by a rebuild and the wholecpu_family:mainlhs = f"int{bits}_t(a)" if op == M.SAR else "a"becomeslhs = "a"cpu_test passescpu_aot_shift_countfailscarry = false;cpu_test passescpu_aot_shift_countfailsEvidence and follow-up
The fixture keeps its conventions:
sar_threeis a unary export likeshl_three, andcarry_zerotakes the same three arguments asflags_zero; its R8 only feeds the shifted EAX that the export discards. No open PR touchestests/cpu/shift_count.*.Checklist
AI-assisted.