mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-27 00:30:52 +01:00
[PR #1408] x64_recomp: handle 16-bit operand-size override (66) in push and pop (X64-RECOMP-PUSH-POP-16) #1438
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#1438
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/1408
Author: @IlyassRS3
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:fix/x64-recomp-push-pop-16📝 Commits (1)
c6d1639x64_recomp: handle 16-bit operand-size override (66) in push and pop📊 Changes
2 files changed (+189 additions, -4 deletions)
View changed files
➕
tests/test_x64_recomp_push_pop_16.py(+173 -0)📝
tools/x64_recomp.py(+16 -4)📄 Description
Item ID:
X64-RECOMP-PUSH-POP-16Summary
Fixes 16-bit operand-size override (
66prefix withoutREX.W) in_emit_pushpopintools/x64_recomp.py:push(66 50..57,66 41 50..57,66 68 iw,66 6A ib,66 FF /6): loads 2 bytes (or sign-extendedimm8masked to 16 bits) and emitsstr_pre(T0, rsp, -2, size=2)(STRH W0, [X23, #-2]!) instead of always decrementingRSPby 8 and writing 8 bytes.pop(66 58..5F,66 41 58..5F,66 8F /0): emitsldr_post(T0, rsp, 2, size=2)(LDRH W0, [X23], #2), inserts only the low 16 bits viabfi(..., 0, 16)for register destinations (preserving upper 48 bits), and stores exactly 2 bytes viastr(..., size=2)for memory destinations (after the post-increment ofRSP, matching Intel SDM forpop word ptr [rsp+disp]).66+REX.Wprecedence (66 48 50,66 48 58):REX.Woverrides66, preserving full 64-bitpush/pop(±8).Tests & Verification
upstream/main(3a0af1f15):python3 -m compileall -q make_game.py tools tests— OKpython3 -I scripts/check_no_game_data.py tools/x64_recomp.py tests/test_x64_recomp_push_pop_16.py— OKpython3 -I tests/test_x64_recomp_push_pop_16.py -v— 1 static OK (2 exec skip cleanly without#1174runner)python3 -I tests/test_x64_recomp.py— 6 static OK (26 exec skipped)python3 -I tests/test_text_write_line_endings.py— 3/3 OKpython3 -I tests/test_ci_registration.py— 16/16 OKtests/test_x64_recomp_push_pop_16.pyon unpatchedupstream/main+#1174): 2 failures, 1 error.upstream/main3a0af1f15with#1174+ all 20 other openx64_recompPR branches):tests/test_x64_recomp_push_pop_16.py: 3/3 OK (0 skipped) on native Apple M5 arm64tests/test_x64_recomp_*.pysuites combined: 148/148 OK (0 skipped)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.