Lower equality, jbe/ja and 32-bit immediate operations in cpu_leaf_aot #129
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!129
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/129/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?
@PrivacyOnion on GitHub · 2026-11-21 16:41 UTC · original
PrivacyOnion:cpu-leaf-aot-comparisons→main· +137 −19 · 3 files · 1 commits · merged 2026-11-21 17:56 UTCChange
Extends
tools/cpu_leaf_aot.pyto support the remaining unsigned and equality short conditional branches (je0x74,jne0x75,jbe0x76andja0x77alongsidejb0x72andjae0x73), 32-bit immediate comparisonscmp eax, imm32(0x3d id), and 32-bit immediate arithmeticadd eax, imm32(0x05 id) /sub eax, imm32(0x2d id).tests/cpu/branches.pyadds positive translation checks for all six condition codes across bothimm8andimm32encodings and negative controls for unsupported condition opcodes and truncated 32-bit immediate instructions.Verification
Verified on Windows 11 with VS Build Tools 2022 17.14 (
MSVC 19.44.35228.0), Windows SDK10.0.26100.0, Python3.12:cpu_leaf_aot_branches: passed (263 native/translated matches and 263 inverted-branch differences; 5 below threshold, 258 at or above, plus extended encoding and negative rejection controls).Evidence and follow-up
All new test cases are self-contained x64 machine-code byte sequences checked in
tests/cpu/branches.py.@R0Y00 on GitHub · 2026-11-21 17:16 UTC · original
The added checks compare emitted C++ strings. Please execute a lifted fixture against the native result for equality and unsigned jbe/ja, with operands on both sides of the immediate and at equality; include a sign-extended imm8 case.
@PrivacyOnion on GitHub · 2026-11-21 17:48 UTC · original
Updated
tests/cpu/branch.asmandtests/cpu/branches.pysocpu_leaf_original,cpu_leaf_original_lifted, andcpu_leaf_inverted_liftedassemble, lift, compile, and execute:cmp eax, 5withjb/jaecmp eax, 15withje/jnecmp eax, 21withjne/jecmp eax, 32withjbe/jacmp eax, 300(3d 2c 01 00 00) withja/jbe,add eax, 512(05), andsub eax, 260(2d)cmp eax, -16(83 f8 f0, sign-extendedimm80xfffffff0u) withjbe/jatests/cpu/branches.pyverifies all 355 inputs against native execution and the inverted-branch control, and asserts that every threshold (5,15,21,32,300,0xfffffff0) is exercised with operands below (<), equal (==), and above (>) the immediate: