cpu: accept the 8087/287 x87 controls as FNOP in the x87 profile #1312

Merged
archielcqp-a11y merged 1 commit from upstream-pr/1319 into main 2026-11-24 08:05:54 +00:00
archielcqp-a11y commented 2026-11-24 07:51:28 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by archielcqp-a11y on 2026-11-24T07:51:28Z.


Change

The x87 leaf profile rejected fneni, fndisi and fnsetpm. The 80387 and later execute them as fnop, so the profile now treats them like fnop: no register stack change, and C0 to C3 undefined afterwards. feni and fdisi decode as wait and the no-wait form; ML64 assembles fsetpm as fnsetpm without a wait and has no fnsetpm spelling. Closes five unobserved rows of the x64 form-coverage gaps (feni, fneni, fdisi, fndisi, fsetpm).

Verification

Commit a970e1a on upstream 6c1b571, Windows 10 build 19045.

  • ctest --preset dev --no-tests=error -R '^cpu_aot_x87_examine$' -V: 816 cases over 5 exports matched the independent model in the native and translated DLLs, each returning with control word 0x027F and an empty stack. Mutated controls normal/unsigned/positive/legacy gave 5/136/7/34 mismatches; 6 sequences rejected.
  • ctest --no-tests=error -R '^(cpu_aot_|cpu_lower|docs_links|form_coverage)': 153/153 passed.
  • python tools/form_coverage.py <junit.xml> --records <build>/form_coverage --gaps x64_zen2: 68 → 63 rows; fnsetpm stays, because ML64 cannot spell it.

Evidence and follow-up

tests/cpu/x87_examine.asm gains a legacy_controls export (original source, MIT) that runs feni, fneni, fdisi, fndisi and fsetpm between an m80 load and store over the fixture's 34 values. The native run confirms on this processor that the five forms leave the value, the control word and the stack unchanged.

Negative controls: a fourth mutated translation, legacy, flips the sign of ST(0) at fnsetpm and gives 34 mismatches, one per legacy_controls case; translation rejects a reader of C0 after fneni or fnsetpm. docs/experiments.md documents the forms in the cpu_aot_x87_examine paragraph.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed.
  • I did not include game files, dumps, distribution links or secrets.

This change was AI-assisted.

🤖 Generated with Claude Code

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6577166911 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1319). Originally posted by [archielcqp-a11y](https://github.com/archielcqp-a11y) on 2026-11-24T07:51:28Z. --- ## Change The x87 leaf profile rejected `fneni`, `fndisi` and `fnsetpm`. The 80387 and later execute them as `fnop`, so the profile now treats them like `fnop`: no register stack change, and C0 to C3 undefined afterwards. `feni` and `fdisi` decode as `wait` and the no-wait form; ML64 assembles `fsetpm` as `fnsetpm` without a `wait` and has no `fnsetpm` spelling. Closes five `unobserved` rows of the x64 form-coverage gaps (`feni`, `fneni`, `fdisi`, `fndisi`, `fsetpm`). ## Verification Commit `a970e1a` on upstream `6c1b571`, Windows 10 build 19045. - `ctest --preset dev --no-tests=error -R '^cpu_aot_x87_examine$' -V`: 816 cases over 5 exports matched the independent model in the native and translated DLLs, each returning with control word 0x027F and an empty stack. Mutated controls normal/unsigned/positive/legacy gave 5/136/7/34 mismatches; 6 sequences rejected. - `ctest --no-tests=error -R '^(cpu_aot_|cpu_lower|docs_links|form_coverage)'`: 153/153 passed. - `python tools/form_coverage.py <junit.xml> --records <build>/form_coverage --gaps x64_zen2`: 68 → 63 rows; `fnsetpm` stays, because ML64 cannot spell it. ## Evidence and follow-up `tests/cpu/x87_examine.asm` gains a `legacy_controls` export (original source, MIT) that runs `feni`, `fneni`, `fdisi`, `fndisi` and `fsetpm` between an m80 load and store over the fixture's 34 values. The native run confirms on this processor that the five forms leave the value, the control word and the stack unchanged. Negative controls: a fourth mutated translation, `legacy`, flips the sign of ST(0) at `fnsetpm` and gives 34 mismatches, one per `legacy_controls` case; translation rejects a reader of C0 after `fneni` or `fnsetpm`. `docs/experiments.md` documents the forms in the `cpu_aot_x87_examine` paragraph. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated README/docs when a capability or build requirement changed. - [x] I did not include game files, dumps, distribution links or secrets. This change was AI-assisted. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
upstream-sync closed this pull request 2026-11-24 09:04:28 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!1312
No description provided.