cpu: lower x87 in the shared lifter with an exact extended-precision model #400
Open
opened 2026-11-22 00:33:27 +00:00 by denn0x
·
11 comments
No Branch/Tag specified
main
codex/indirect-large-backed-views
codex/word3-preflight-check
codex/vertex-table-two-records
codex/live-index-alias
codex/copied-vertex-buffer-srv
codex/windows-stage-test-output
codex/preserve-live-srv-retirement
codex/share-render-target-tracking
codex/sgd5-negative-offset-fixture
coverage-dashboard
codex/mesh-loose-root
codex/mesh86-cache-padding
codex/xmem-scatter-preflight
codex/mesh-depth-ps
codex/indirect-dispatch-refresh
codex/compute-container-index
codex/startup-compute-formatted-load
codex/compute-indirect-producer
codex/compute-atomic-soffset
codex/mesh-dual-handoff
codex/startup-run-sh-watcher-control
codex/queue31-page-alias
codex/indexed-indirect-compute-root
codex/typed-buffer-view-metadata
codex/translated-indexed-address-alias
codex/fixed-mesh-create-result
codex/xmem-section-lease
codex/startup-slot86-mesh-cache
codex/restore-mesh-barrier-iteration
codex/translated-indirect-upload-index
codex/xapu-completion-opt-in
codex/translated-indexed-rect
codex/translated-indexed-indirect
codex/startup-mesh-lds-integration
codex/startup-console-ms24
codex/startup-slot57-mesh-request
codex/indirect-copy-provenance
codex/present-color-producer-trace
codex/compute-dispatch-binding-trace
codex/translated-indirect-table-buffers
codex/indirect-copy-provenance-base
codex/mix-half-literal-source
codex/translated-indirect-draw
codex/xmem-scatter-diagnostics
codex/slot148-recording-upload
codex/slot70-loading-art-verified
codex/command-list-upload-arena
codex/recover-failed-command-list
codex/startup-heap-timing-notes
codex/align-audio-input-timeline
codex/synthetic-depth-export-control
codex/startup-texture1d-on-windows
codex/1629-packed-position-fixture
codex/cpu-srv-refresh
codex/stream-root-srv-draw
codex/audio-mixer-timer
codex/startup-reload-published-shader
codex/priority-integrate-1284
codex/guest-sixteen-page-record
codex/aot-placed-dxr-batch
codex/guest-directory-selection
codex/gamesave-enumerate-read
codex/readme-archive-to-pixels
codex/pe-placed-view-draw
codex/archive-directory-gpu
codex/slot133-dxr-build
codex/materialize-placed-vertex-view
codex/dstorage-directory-offsets
codex/xg-nine-bc-copy
codex/xg-slot10-bc64-arrays
codex/dxr-guest-address-readback
codex/gpu-va-high-bits
codex/clarify-diagnostic-startup-scope
codex/xg-six-levels
codex/typed-derived-blend
codex/english-legal-text-progress
codex/address-bc-4ks
codex/dstorage-bounded-file-read
codex/wide-srv-offsets-menu
codex/startup-memory-srv
codex/bound-view-tail
codex/language-selector-readback
codex/setup-menu-progress
codex/cpu-plane-refresh
codex/startup-ubyte-vertex
codex/presenter-window-selection
codex/startup-uniform-buffer-lane
codex/intro-loop-timing
codex/static-clzero-loops
codex/document-rtx-intro
codex/startup-insertq
codex/nv12-startup-texture
codex/stream-stage-draw
codex/startup-null-uav-format
codex/startup-draw-capture
codex/shorten-windows-checks
codex/dstorage-rfc1950
codex/startup-dump-fence
codex/pr1135-review-base
codex/startup-stream-requests
codex/startup-chroma-view
codex/readme-graphics-pipeline-streams
codex/static-crt-free-tls
codex/arc-140t-rtx-5080-laptop-gpu-reports
codex/main-startup-progress-entry
codex/signed-dxil-catalogue
codex/reloc-free-preferred-base
codex/quad-dpp-bit-mask
codex/raw-srv-bounds
codex/rx9070-31044-hardware-report
codex/gpu-page-source-provenance
codex/runtime-placeholder-interior
codex/gpu-copy-queue-tile-order
codex/pe-pin-external-providers
codex/xmem-placeholder-reservations
codex/xmem-shared-physical-pages
codex/pe-package-startup
codex/xmem-tools-memory-query
codex/cpu-stack-output-import
codex/pe-load-security-cookie
codex/record-three-bvh-retests
codex/cpu-rbp-frame-anchor
codex/xmem-default-startup
codex/record-rtx-3050-ti-9597
codex/docs-readme-start-here
codex/check-compute-mad24-truncation
codex/docs-discord-community
codex/bound-rcx-branch-mutants
codex/rtx5060ti-bvh-62114
codex/837-neutral-readme-disclaimer
codex/record-rtx-3070-ti
codex/title-neutral-public-wording
codex/exe-shadow-frame-submissions
codex/exe-shadow-runtime-chain
codex/readme-polish
codex/gpu-coverage-nov23
codex/spirv-minlod
codex/shadow-shim-device
codex/exe-two-shadow-frames
codex/shim-dispatch-cleanup
codex/fix-spirv-cache-probe
codex/sampler-use
codex/ballot-bit-extract
codex/packed-fma-release
codex/cpu-packed-fma-o2
codex/publish-coverage-dashboard
codex/mesh-cbv-binding-order
codex/spirv-window-fixture
codex/ps-e32-float-uint
codex/ps-cbuffer-reads
codex/fixed-profile-rescan
codex/shim-compute-integration
codex/readme-visible-coverage
codex/readme-research-navigation
codex/integrate-pr-256
codex/indexed-mesh
codex/sampled-coverage
codex/first-ms
codex/dual-ps
codex/ps-attribute
codex/compute-first
codex/ps-export
codex/readme-research-status
codex/ps-layout
codex/blast-window
codex/chart-caption
codex/reviewer-roles
codex/blast-aot
codex/archive-program
codex/crc-stream-program
codex/exe-image-data-chain
codex/local-cpu-fixture-coverage
codex/exe-bound-frame-chain
codex/exe-mapped-comparison
codex/contribution-dependencies
codex/exe-entry-aot
codex/bink-frame-heap-integration
docs/hardware-seven-reports
codex/bink-custom-heap
codex/bink-heap-callers
codex/discussions-entry-points
codex/gpu-community-batch-64
codex/ffx-scratch-writers
codex/generic-project-documentation
codex/ffx-dispatch-rcas
codex/four-windows-gpu-reports
codex/title-neutral-project-wording
codex/community-coverage-provenance
codex/rcas-packed-texels
codex/community-gpu-retests
codex/community-build-and-gpu-reports
codex/ffx-provider-loop
codex/ffx-recurrent-views
codex/ffx-recurrent-resource
codex/amd-wave64-reports
codex/ffx-backend-slots
codex/upscaler-device-init
codex/ffx-context-lifecycle
codex/ffx-version-query
codex/ffx-provider-contract
codex/typed-object-callback
codex/cpu-ordinal-import
codex/chained-cpu-ranges
codex/cpu-import-call
codex/cpu-direct-call
codex/cpu-leaf-aot
codex/community-project-status
codex/script-state-path-replay
codex/script-state-evidence
codex/bc7-resident-tail
codex/bcpack-mip-tail
codex/bc7-texture-draw
codex/asset-ranges
codex/pixel-constants
codex/pixel-aot
codex/pre-exe-workloads
codex/root-signature-device-coverage
engineering/packed-bvh-leaves
engineering/bvh-build-and-update
engineering/intake-root-roundtrip
community/gpu-check-release
community/english-contributor-entry
gpu-check-v0.1.0
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
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#400
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 denn0x on 2026-11-22T00:33:27Z.
Problem
docs/coverage/x64_zen2.tsvlists 100 x87 forms. No fixture covers any of them, andlower()intools/ffx_version_query.pyrejects every x87 instruction. No open PR or issue touches x87; I checked the diffs of the opencpu:PRs for x87 mnemonics.Proposal
I'd like to take x87 in the shared lifter, as a short series. The first PR covers one behavior: the register stack, loads and stores, and the four basic operations.
Model.
doublecannot stand in: even at 53-bit precision control, results beyond the double exponent range or in its subnormal range differ, andfld m80and constants such asfldpicarry 64-bit significands into later operations.0x027F(53-bit precision, round to nearest, all exceptions masked), tag word0xFFFF(empty stack) and status word 0. The docs record that assumption.First PR.
fld/fst/fstpfor m32, m64, m80 andst(i);fild/fist/fistp/fisttp;fxch,fld1,fldzand the other load-constant forms;fchs,fabs;fadd/fsub/fsubr/fmul/fdiv/fdivrwith theirpandiforms;fcomi/fcomip/fucomi/fucomipinto ZF and CF, and the CF/ZF forms offcmovcc.fistfollow the Intel SDM and are checked against the native result.fnstsw,fstsw,fcom,ftst,fxam,fnstenv,fsave;fldcwandfninit;fsin,fcos,fptan,fpatan,f2xm1,fyl2x, ...), whose results are not bit-reproducible from a specification;fcmovu/fcmovnu, which need PF.Later PRs, once the first is reviewed: a dynamic control word (
fldcw,fnstcw,fninit,frndintunder each rounding mode), then the status-word forms with their condition codes.Shared interface:
lower()andCPU_FIXTURES, which #287, #289, #291, #326, #328, #331, #335 and others also extend. The x87 branch is new code at its own anchor. The header is separate fromINTEGER_HEADER, so non-x87 callers are unchanged.Alternatives
doubleorlong double. MSVC'slong doubleisdouble, so it is inexact for the reasons above.Verification
A source-built MASM fixture with native and lifted DLLs is compared on every result word, the stack depth and ZF/CF. Its cases include:
Negative controls are mutations of the generated C++, and each must mismatch:
doublearithmetic core;Translation must reject
fnstsw,fldcwandfsin.AI-assisted (Claude Code).
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-22T00:57:05Z.
Please go ahead with a first PR for an opt-in x87 leaf-function profile in the shared
lower(). One register-add form is enough to exercise the distinction between register precision, arithmetic precision and store precision.0x027F, TOP 0, eight empty slots and cleared status at entry. Have the native MASM wrapper save the caller’s x87 environment, establish this state for each comparison, then restore the caller’s environment. The ctypes observation is evidence for that particular call. Track TOP and slot occupancy, require a provably empty stack on every normal exit, and reject unknown initial depth, stack overflow or underflow, control-word changes, unmodeled state observations and live x87 state across calls.FLD m32/m64/m80,FSTP m32/m64/m80and one register form ofFADDP. Emit the integer-based extended-precision helpers only for functions using this profile. Preserve the sign, 15-bit exponent and all 64 significand bits including the explicit integer bit on loads and copies. Round the add to 53 significand bits, nearest-even, with the extended exponent range. Round again as required by the store format and preserve signed zero.Multiplication, division, conversions, constants, comparisons and stack faults can each follow with their own evidence. When adding comparisons, account for every observable flag or reject consumers of unmodeled flags, including PF. This first PR can proceed as a bounded community experiment.
Imported from R0Y00/Xbox2Windows. Originally posted by denn0x on 2026-11-22T01:22:16Z.
Opened #422 for the first step: the opt-in
lower(..., x87=True)profile withfld/fstpm32/m64/m80 andfaddp st(i), st. It follows the entry/exit contract above, with static stack depths and the listed rejections, and is checked with identical input bytes through a native harness that saves and restores the caller's environment. All 80-bit encodings are accepted as operands, and special-value semantics are implemented and checked rather than restricted to canonical finite values. One rule was measured rather than taken from Table 4-7: with equal NaN significands, the positive NaN wins in either operand order. The PR body has the command, the 8085-case result, six controls and the rejection list. Multiplication and division, conversions, constants, comparisons (with PF) and stack faults will follow as separate PRs.AI-assisted (Claude Code).
Imported from R0Y00/Xbox2Windows. Originally posted by denn0x on 2026-11-22T05:34:19Z.
Status. The series has landed through #462 (
frndint), and #465 (fxtract) is open. Three more are ready and will open in order as each one merges:fscale;fcmovcc;fiadd,fisub,fisubr,fimul,fidivandfidivrwith m16 and m32 operands.With those, the first-PR list of this issue is covered except
fcmovuandfcmovnu, which need PF.Next: the dynamic control word, the first of the later steps above. I'd like your decisions on two points (3 and 4) before writing it.
Measured natively on the Ryzen 7 7700 with a probe:
fldcw X, thenfnstcw, then 1/3 computed and stored as m80.fnstcwreturns(X & 0x1F3F) | 0x0040. Bit 6 reads as 1, bits 7 and 13 to 15 read as 0, and bit 12 (the obsolete infinity control) is kept.fldcw 0x0000) faults on the next inexact result, as expected.Proposal.
Accepted forms:
fldcw m16,fnstcw m16andfstcw m16(wait; fnstcw).fninitandfnclexalso clear the status word, so they wait for the status-word step.Model: the lowered function keeps a local
uint16_t x87_cw, initialised to0x027F. Every rounding site reads PC and RC from it:fsqrt,fscaleandfrndint;fistandfistp(fisttpalways truncates);Exact operations do not change.
Words the model cannot follow: a loaded word with any exception unmasked (bits 0 to 5 not all set), or with PC 01. Lowered code cannot fault as native does, so I propose a
__fastfailat thatfldcw, tested in a child process. Alternatively PC 01 could be modelled as 64 bits, but that holds only for the measured part. Which do you prefer?Exit: a function must still return with
0x027F, as the profile requires today. Translation cannot check this statically, because the word comes from memory, so I'd add a run-time check at each return that fails in the same way. Is a run-time contract check acceptable here, or would you rather reject functions whosefldcwoperand is not the slot an earlierfnstcwin the same function wrote?Verification:
fnstcw; or 0C00h; fldcw; fistp; fldcw);fnstcwafter every reserved-bit pattern above.Controls: RC ignored, PC ignored,
fistpignoring RC, the constant loads ignoring RC, andfnstcwreturning the raw word.Shared interface: only
tools/x87_lower.pyandtools/x87_soft.h. The helpers gain a control-word argument, so the generated code changes throughout the x87 profile, but no other caller oflower()changes.AI-assisted (Claude Code).
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-22T05:37:46Z.
For the first dynamic-control-word profile, accept words with all six exceptions masked and PC=00, 10 or 11. Please retain the Ryzen PC=01 result as a hardware observation. An unsupported FLDCW must give the host a distinguishable profile-rejection status and leave the host running. A separate checked entry can return that status while preserving the fixed-profile ABI. If this revision has no error channel, restrict it to statically proven supported control words. With a checked entry, verify restoration to 0x027F at every normal return; branches and different save slots are fine. Please cover an unrestored return, an unmasked exception and reserved PC, and check which guest writes remain visible before each rejection. Fixed-control-word contributions can proceed independently.
Imported from R0Y00/Xbox2Windows. Originally posted by denn0x on 2026-11-22T06:51:59Z.
Status. The checked entry for the dynamic control word is written and tested. It follows the decision above. It will open after #476, the integer-operand arithmetic and
fnstcw/fstcw/wait, which come first in that order. The branch iscpu/lower-x87-fldcwon my fork if you want an early look. Fork CI run 44995141203 passed at its head,0c82e82.Entry.
lower(..., x87=x87_lower.Checked(reject))is a separate entry, and the fixed profile keeps its ABI. All 110 generatedcpu_x87_*.cppfiles of the earlier tests are byte-identical.Accepted words.
fldcwaccepts words with all six exceptions masked and precision control 00, 10 or 11. It keeps the word asfnstcwreads it back. Every rounding site follows it:fsqrt, which also follow the precision control;fscaleandfrndint;fistandfistp;Rejection statuses. The lowered function leaves through the caller's
rejectstatement with a distinct status, and the host keeps running:0x027FReturn check. It runs at every return, so a branch with two returns restoring from different slots is covered. A function that loads the word must not contain a call, an indirect branch or an external edge.
Fixture.
cpu_aot_x87_fldcwhas 15 exports and 15944 cases on the Ryzen 7 7700. The translation matched the model in every case, including the status, the output block with its guards, and the result word, which is written only on success. The exports include the MSVC truncation idiom, and one export makes guest stores before, between and after twofldcw. Each rejection keeps exactly the stores made before it.Statuses observed:
Native runs. 14994 native cases matched. The 570 unmasked cases run only translated, because natively they would trap. The 380 PC=01 cases ran natively as an observation, and all of them matched a 64-bit model on this part. Ten negative controls each mismatch; they include no return check, the check on only one of two returns, and a rejection that records its status but runs on.
One change to existing tests. Passing the word into the helpers also gave
x87_divandx87_sqrtthe round bit below the 64-bit result. Before, they had only the sticky bit, which is enough at 53 bits. This changes only thepc64mutation counts of the div, sqrt and integer-operand tests. Every real case and every other control count is unchanged. That helper change is its own commit. I can open it as a separate PR ahead of the checked entry if you prefer to review the numerics apart.Next: the status word. This is the last step listed in the issue. I'd like your call on its scope before I write it:
Forms:
fcom,fcompandfcompp, and thefucomforms, with m32, m64 andst(i);ficomandficomp;ftstandfxam;fnstsw ax,fstsw axandfnstsw m16;sahfin the integer lowering, which would define CF and ZF from C0 and C3. PF stays unmodelled, sojp,fcmovuand the other PF readers stay rejected.Condition codes and TOP: C0 to C3 come from the last compare or
fxam. TOP is the static depth, so it is known at translation time.Sticky exception flags (IE, DE, ZE, OE, UE, PE and SF), which
fnstswalso exposes. There are two options:fnstsw axfollowed bytest ah, imm8withimm8within C0 to C3, or bysahf. That leaves (a) for a second PR, which would also enablefnstsw m16andfnclex.My preference is (a) in one PR, because (b) needs a consumer analysis that (a) would later delete.
fninit: this would come with the status word. In the checked entry it would setx87_cw = 0x037F, which is 64-bit precision, so a return without a restore stops with status 3. It would be rejected unless the stack is empty.AI-assisted (Claude Code).
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-22T07:08:44Z.
For the first status-word PR, please take option (b). Accept
FNSTSW AXwhen static analysis can prove that every reachable consumer observes only defined condition bits. Track C0/C2/C3 according to the instruction that produced them. Mark architecturally undefined bits unknown, and carry a preserved bit forward only when its previous definition is known.For
SAHF, the mapping is CF ← C0, PF ← C2, ZF ← C3. Follow flag uses along every successor, includingJPandJNP. Apply the same check to other AX, AH and flag consumers. A useful negative control is a branch where one successor only tests a known bit and the other exposes an unknown bit. Include a native comparison that distinguishes ordered and unordered inputs through PF.TOP is the three-bit physical stack index. From a known entry TOP, each push decrements it and each pop increments it modulo eight. Track slot tags separately from logical depth if the stack has holes. Memory-form status stores, observable sticky exception flags and
FNINITstate reset can each follow with their own semantics and native regression cases.Imported from R0Y00/Xbox2Windows. Originally posted by denn0x on 2026-11-22T10:46:43Z.
Status. #534 and #535 have merged. #548 (PF after
fcomi, withfcmovuandfcmovnu) is open.ftst/ficom/ficompand thenfxamfollow it, in that order.Next:
fpremandfprem1. Before proposing a scope I measured both instructions on the Ryzen 7 7700 (AMD64 Family 25 Model 97 Stepping 2), with ctypes calling machine code against an exactFractionmodel:fpremtruncates the quotient q andfprem1rounds it to nearest-even. C0, C3 and C1 are bits 2, 1 and 0 of |q|, and C2 is 0. A zero remainder takes the sign ofst(0). Nothing mismatched across random pairs from D = -66 to 70, denormal and pseudo-denormal divisors at D = 62 to 65, denormal results, exact multiples, ties and their neighbours, andfprem1withst(0)between half ofst(1)andst(1). Neither precision nor rounding control has any effect under any of the twelve masked control words.st(1)too.st(0)or a zerost(1)). The value follows the arithmetic NaN rules, the same asfadd. The SDM gives no status bits for this case. Here C0 and C3 keep their previous values and C1 and C2 are cleared.Proposal. This follows the
fldcwprecedent: add it to the checked entry only, and keep rejecting both instructions in the fixed profile.fnstsw, because only the status bits are unspecified. Withoutfnstswthe NaN value is kept.fprem; fnstsw ax; sahf; jp backis accepted, and depth and flags converge over the back edge. In an accepted run C2 is always 0, so the back edge is translated but never taken. The native loop, by contrast, does reduce partially and iterate. Its final value is the full remainder, whatever N is, because each partial step subtracts an even multiple ofst(1). So the fixture can compare it on any host.This is written and passes locally. The branch is
cpu/lower-x87-fprem, stacked onfxam.cpu_aot_x87_fpremhas 11 exports and 36952 cases: 27623 ok, 4104 partial and 5225 NaN in the translation. Native C2 is 1 in exactly the single-step cases rejected as partial, and the native result is a NaN in exactly the cases the model gives a NaN. Eight mutated controls each mismatch. I will open it afterfxam, unless you want a different scope.Request. If you have an Intel machine, could you run the probe below? It prints the D where C2 flips, the N values that fit, and the status bits after three NaN results with C3, C0, or C1 and C2 set beforehand. If Intel matches, a follow-up could model the partial step and the NaN-result bits instead of rejecting them.
fprem_vendor_probe.py (Windows x64, Python 3, standard library only)
Its output on the Ryzen 7 7700, for comparison:
AI-assisted (Claude Code).
Imported from R0Y00/Xbox2Windows. Originally posted by denn0x on 2026-11-23T16:39:07Z.
Status. #893 (
fpremandfprem1) has merged. #904 is open. It addsfninitandfinitto the checked entry, the last item of the dynamic-control-word step: they load0x037F, clear C0 to C3 and empty the stack, and the function must restore0x027Fbefore it returns.Next, if it is in scope:
fbstpandfbld. Neither appears in the plan above, so I'd like to check before opening it. The branch is written and passes locally.fbstp m80, both profiles. Rounds ST(0) to an integer by the rounding control and stores 18 packed BCD digits with the sign of ST(0). A NaN, an infinity, an unsupported encoding or a rounded magnitude of 10^18 or more stores the packed BCD indefinite, as the SDM specifies for the masked invalid operation.fbld m80, checked entry only. Loads the digits exactly, with the sign from bit 7 of byte 9. The SDM leaves the result undefined when a digit is above 9, so that case leaves with a new status 6 (bcddigit) instead of a guessed value. The fixed profile rejectsfbld.cpu_aot_x87_bcd: 9 exports (3 in the fixed profile), about 22000 cases against an exact model, and nine mutated-translation controls. Nativefbldwith a digit above 9 would be recorded only as a hardware observation.fbstpcurrently stands for "outside the profile" incpu_aot_x87_movesandcpu_aot_x87_integers. Those cases would usefnstenvandfnsaveinstead, which stay outside it.Is this OK as the next PR after #904, or would you rather keep BCD out of the profile?
AI-assisted (Claude Code).
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T16:51:12Z.
The BCD pair fits as one focused follow-up after #904. Keep FBSTP output and guards byte-exact, including signed zero, rounding boundaries, the 18-digit limit and the masked-invalid encoding. For checked FBLD, reject an invalid digit through the existing status channel before storing a result; name and document the added status without changing existing codes. Record native observations for invalid input separately. Confirm the fixed entry still rejects FBLD and the replacement environment-op rejection tests still run in both Windows configurations.
Imported from R0Y00/Xbox2Windows. Originally posted by denn0x on 2026-11-23T17:11:14Z.
Status. #904 merged, and #916 (
fbstp/fbld) is open as the follow-up agreed above. After #916, the x87 forms indocs/coverage/x64_zen2.tsvthat the profile still rejects fall into four groups:f2xm1,fsin,fcos,fsincos,fptan,fpatan,fyl2x,fyl2xp1.ffree,ffreep,fincstp,fdecstp, and the environment and state formsfnstenv,fldenv,fnsave,frstor, plus their wait forms. Several rejection tests also rely on them staying outside the profile. I don't plan to take these without a design discussion.fstpnce(D9 D8+i), the undocumented alias offstp st(i), which is rejected deliberately.fneni,fndisiandfnsetpm(DB E0, DB E1, DB E4), and their wait formsfeni,fdisiandfsetpm.The last group is the only one that fits the current profile. I measured it natively on the Ryzen 7 7700 (
AMD64 Family 25 Model 97 Stepping 2). The method was anfnstenvsnapshot, thenfldenvof the same bytes, the instruction, and a secondfnstenv:fcomless0x027F0x31000x1FFFfcomequal0x027F0x70000x0FFFfxamof -1 (C1 set)0x027F0x36000x0FFF0x0C7F0x0C7F0x70000x0FFFThat is the same as
fnopin every row. The proposal would accept the three as no-ops in both profiles and treat them likefnopfor the condition codes. The current SDM does not document these encodings; older x87 references describe them as no-ops after the 80287. The wait forms would then follow fromwaitalready being accepted. There would be a small differential fixture with a "mutate intofninit" control.These are coverage-only: compilers do not emit them. If you'd rather close the x87 series after #916, I'll leave them out.
AI-assisted (Claude Code).
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T03:23:22Z.
Claiming one more step of the status-word work:
FNSTSW m16(andFSTSW m16, which decodes as WAIT and FNSTSW m16) intools/x87_lower.py, with its checks intests/cpu/x87_fldcw.pyand a paragraph indocs/experiments.md.fnstsw word ptr [mem](DD /7). Memory cannot carry "unknown" bits, so the store is accepted only where the status-word dataflow knows all 16 bits (C0 to C3, the exception flags, SF, ES and B; TOP is the static depth). Today that is straight afterfninitin the checked entry (every bit 0). Anywhere else it is rejected with the unknown bits named, and the fixed profile rejects it.fnstsw axbehaves as before.llvm-ml-19,lld-link-19, MinGW and Wine for the native-versus-translated comparison. I have no Windows/MSVC machine, so the MSVC and ML64 run is left to CI and I will say so in the PR.AI-assisted.