Keep MXCSR in line with FPCR where FPCR changes instead of checking it in every FP op

The FP helpers compared c->fpcr with a cached copy before every operation to resync MXCSR lazily. MXCSR now
follows FPCR.FZ at once: MSR FPCR calls rt_fpcr_sync, and so do rt_call (thread, fiber and host entry into guest
code), fiber resume (FIBER_FLAG_FLOAT_SWITCH fibers keep their own MXCSR) and the differential test harness per
case. op and vop only test FPCR.RMode for the slow path, and their redo check is one ordered-not-equal compare of
|r| with the smallest normal, the same NaN-or-smallest-normal set as before.

Hot guest code shrinks by about a quarter (132 functions holding half the guest cycles, 1.4.3); fight frame time
moves 1-3%, inside the run-to-run spread. lift, simd, func, atomic and flags_check pass on 1.4.3; simd.py fails
without the harness sync.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Valiantsin DzerakhandClaude Opus 5.5 committed 2026-10-28 12:25:25 +03:00
1 parent adc1cbce69
commit 2fe6a6d4c1
7 files changed
+30 -29

No files matched your search

+1
View File
@@ -136,6 +136,7 @@ int main(int argc, char **argv) {
c.sp = in.sp;
c.nzcv = in.nzcv;
c.fpcr = in.fpcr;
rt_fpcr_sync(&c);
memcpy(c.v, in.v, sizeof c.v);
c.excl_addr = ~0ull;
g_stubs = (int)in.stubs;