cpu: accept FFREE of a statically empty register in the x87 profile #1412
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1419"
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 legacy-code-archaeologist on 2026-11-24T11:08:57Z.
Refs #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
upstream-sync referenced this pull request2026-11-25 15:01:50 +00:00