Pin x87 fist, fisttp and m16 integer-arithmetic stack-top selection at depth two #1035
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!1035
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1035/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-23 22:20 UTC · original
Leyukaka:x87i-controls→main· +33 −4 · 7 files · 4 commits · merged 2026-11-23 22:43 UTCChange
This closes three gaps in the test coverage of
tools/x87_lower.py. Each gap is shown by a small mutation of the lowering that still passes the whole^cpu_suite onmainatca52bbc. The lowering does not change; the native fixture DLLs stay the reference.x87_integers:fistthenfisttpwith two values on the stack (ST(0) = 2.75, ST(1) = -1.25)fistreading slot 0 instead of the stack topfisttpreading slot 0 instead of the stack topx87_iarith:fisubwith an m16 operand and two values on the stackThe existing exports run
fist,fisttpand the m16 integer-arithmetic forms only at depth 1, where slot 0 is the top, so none of them can tell the two apart. Both exports are added to theSEQUENCESof the generator scripts; the.asmand.deffiles are the regenerated output.docs/experiments.mdis updated to the measured counts (19 exports and 11127 cases; 16 exports and 28513 cases, also in the summary table and its total, 55,809).Verification
On
b6a59ad1(based onmainatee04692), Windows 11, MSVC 14.44.35207, Python 3.14:Both tests pass and print
11127 cases over 19 exports (output block and guards) matched the reference in native and translated DLLsand28513 cases over 16 exports ....Each mutation was applied to
tools/x87_lower.pyone at a time and the project was rebuilt. Withmainatca52bbc, the whole^cpu_suite passed under all three; with this branch,cpu_aot_x87_integersorcpu_aot_x87_iarithfails under each. With the unmutated lowering everything passes.The three edits to
tools/x87_lower.py:fiststore,x87_slot[{top}]->x87_slot[{0 if op == M.FIST else top}]M.FISTTPx87_slot[{top}]->x87_slot[{0 if bits == 16 else top}]Evidence and follow-up
The two exports are generated from
SEQUENCESintests/cpu/x87_integers.pyandtests/cpu/x87_iarith.py; the committed.asmand.defmatch theasmmode output byte for byte. No follow-up is needed.Checklist
AI-assisted.