mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-22 05:05:56 +00:00
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:
1 parent
adc1cbce69
commit
2fe6a6d4c1
7 files changed
+30
-29
No files matched your search
+1
-1
@@ -1940,6 +1940,7 @@ static void fiber_switch_to(RtThread *t, const Cpu *from, Fiber *to);
|
||||
// After a host fiber switch: release the context left behind, and finish an ExitThread issued on a fiber.
|
||||
static void fiber_resumed(void) {
|
||||
RtThread *t = tcur;
|
||||
rt_fpcr_sync(t->cur); // the host fiber resumes with its own MXCSR (FIBER_FLAG_FLOAT_SWITCH)
|
||||
if (t->leaving) {
|
||||
__atomic_store_n(&t->leaving->running, 0, __ATOMIC_RELEASE);
|
||||
t->leaving = NULL;
|
||||
@@ -1981,7 +1982,6 @@ static void fiber_switch_to(RtThread *t, const Cpu *from, Fiber *to) {
|
||||
dst->tpidr = from->tpidr;
|
||||
dst->tpidrro = from->tpidrro;
|
||||
dst->fpcr = from->fpcr;
|
||||
dst->fpcr_host = 0; // the target host fiber resumes with its own MXCSR; simd_fast resyncs it
|
||||
dst->fpsr = from->fpsr;
|
||||
dst->excl_addr = ~0ull;
|
||||
dst->thread = t;
|
||||
|
||||
Reference in new issue
Block a user