cpu: accept FFREE of a statically empty register in the x87 profile #1419
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!1419
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1419/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?
@legacy-code-archaeologist on GitHub · 2026-11-24 11:08 UTC · original
legacy-code-archaeologist:cpu/x87-ffree-empty→main· +81 −16 · 8 files · 1 commits · merged 2026-11-24 11:33 UTCRefs #1338
What
The x87 profile (
tools/x87_lower.py) now accepts FFREE ST(i) when ST(i) is statically known to be empty, that is wheniis at least the depth. This is the slice approved in #1338.Existing tests changed (please check)
tests/cpu/x87_add.pyandtests/cpu/x87_moves.pyeach had the rejection caseffree st(1)after onefld. ST(1) is empty at depth 1, so this PR accepts that sequence. Both cases now useffree st(0)on the occupied ST(0) and still expect a refusal, now with the "frees an occupied register" message.Evidence
cpu_aot_x87_examinegains the exportffree_empty:ffree st(0)andffree st(7)at depth 0.ffree st(1),st(4)andst(7)at depth 1.ffree st(7), then the final legal push to depth 8.fnstsw ax,and ah, 38h, store AH).The check fails in each of these cases:
ffree:ffree st(7)frees ST(0) instead. 34/884 mismatches.freetop: FFREE moves TOP as a pop does, so the status word at depth 1 reads TOP 0. 68/884 mismatches; the literal also matches the depth-1 status read offfreep_top.fld1; ftst; ffree st(1)(the same sequence without FFREE is accepted);ffree st(0)andffree st(1)on occupied registers.Windows 11 Pro 26100.9168, Intel i7-6820HQ, MSVC 19.52, commit
c6571ee9on153bb5f6:Result:
cpu_aot_x87_addandcpu_aot_x87_movespass.releasepreset gives the same result.Other runs:
ctest --preset dev -E '_hardware$': 630/630.-R '^cpu_aot_x87_': 21/21.tools/form_coverage.py --gaps x64_zen2no longer listsffree.🤖 Generated with Claude Code