cpu: lower overflow and parity conditions #325
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/330"
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 Joacoorandom on 2026-11-21T22:21:32Z.
Change
The integer jump-table translator rejects overflow and parity consumers even when their producer is supported. Add
JO/JNO/JP/JNP,SETO/SETNO/SETP/SETNPandCMOVO/CMOVNO/CMOVP/CMOVNPafterCMP,SUB,ADD,TEST,AND,OR,XOR,INCandDEC.Compute overflow at the producer's 8/16/32/64-bit width and parity from only the low result byte. Save ADD operands before they are overwritten, preserving its existing zero/sign conditions. The current straight-line, register and unsupported-producer restrictions remain in force.
This touches
cpu_switch_aot.Lifter.condition, ADD flag snapshots and the generated C++ prelude. It has no prerequisite PR; other CPU instruction changes such as #291 and #321 touch the same translator.Record the actual decoded instruction mnemonics from the flag-conditions fixture only after its native/AOT/reference comparison succeeds. Coverage now recognizes these macro-generated forms, clears stale records and does not mark missing, failed or skipped evidence as covered. CPU records are kept separate from shader records.
Verification
Commits
3f77ffdand0b2e8b3, based on upstream1606f7b. Rebuilt and reran the selected native tests after rebasing. Native Windows 11 build 26300.9974, x64 MSVC/ML64 19.44.35230, Windows SDK 10.0.26100.0, Python 3.12.8.From a configured x64 developer environment with requirements-dev.txt installed:
All six selected CTests passed. The new test passed 294,600 native/AOT/independent-reference comparisons across 160 exports, including guarded writes and 32/64-bit conditional moves. Substituting a variable-count shift for the flag producer is rejected. Existing jump-table, address-size, entry-order and narrow-return regressions passed, including their negative controls.
Linux checks also passed:
The complete root/GPU suite was not run locally.
Evidence and follow-up
The MASM fixtures and Python arithmetic reference are original source under the repository's MIT license. Both operand registers are overwritten before consumers, so correct results require saved flag inputs. Boundary values, every low byte and deterministic random inputs exercise parity and signed overflow; extra ADD cases check existing zero/sign conditions.
The baseline translator from
b53bfb0rejects the firstSETOfixture; this change translates all 160 exports. The old SETO rejection becomes a positive regression. Rejections for high-byte registers, unsupported flag producers, 16-bit CMOV and flags crossing joins are retained.README and the jump-table experiment notes describe the capability and reproduction commands.
AI-assisted implementation and tests, published with the account owner's approval.
Checklist