Pin x87 status-word AX tracking across joins, EAX reads and direct calls #1003
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1010"
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 Leyukaka on 2026-11-23T21:10:38Z.
Change
This closes three gaps in the test coverage of the status-word tracking in
tools/x87_lower.py. Each gap is shown by a small mutation of the lowering that still passes the whole^cpu_suite onmain. Onlytests/cpu/x87_status.pyand one paragraph ofdocs/experiments.mdchange; the lowering does not.and ah, 45hbeforemov [rdx], ah(reads AX bits 0x8200)fnstsw ax, thenmov al, 0andtest eax, eax(reads AX bits 0x8200)RAX holds unknown status-word bits 0x82ff at call)The first probe is the only case in the
^cpu_suite that pins the AX join; the existing join case pins only the condition bits. The second also pins that an AL write makes only the low byte known. All three are translation-only byte sequences, like the existing probes. The translation now rejects 35 sequences instead of 32, and the docs list the three new ones.Verification
On
12574172(based onmainatace6a3c), Windows 11 build 26300, MSVC 14.44.35207, Python 3.14:The test passes and prints
rejected 35 sequences outside the profile: .... The docs check passes.Each mutation was applied to
tools/x87_lower.pyone at a time and the project was rebuilt. Withmainat commit3174eb3, the^cpu_suite passed under all three mutations (tools/x87_lower.pyandtests/cpu/x87_status.pyare unchanged between the branch base and currentmain); with this branch,cpu_aot_x87_statusfails under each of them. With the unmutated lowering everything passes.The three edits to
tools/x87_lower.py:self.ax & other.ax->self.ax | other.axread |= bits->read |= bits & (0x00FF if used.register == R.EAX else 0xFFFF)if flow in (FlowControl.RETURN, FlowControl.CALL, FlowControl.INDIRECT_CALL, FlowControl.INDIRECT_BRANCH):-> withoutFlowControl.CALLEvidence and follow-up
No new fixture file: the three probes are hand-written byte sequences inside
tests/cpu/x87_status.py, translated only, like the existing probes. No follow-up is needed.Checklist
AI-assisted.