The FP fast paths of the lifted code check FPCR.RMode inside the result compare and pass vector slow-path operands through the Cpu

The result check of every scalar and vector FP op compares |r| against a per-thread threshold in the Cpu (fp_th_s,
fp_th_d): the smallest normal in round-to-nearest, NaN under a directed RMode, so a directed mode sends every result
to the redo path and the separate load and test of c->fpcr per op goes. rt_fpcr_threshold sets it; rt_fpcr_sync
calls it on every host, and the Cpu inits and the fiber switch's fpcr copy call it too.

The vector slow path FN(vredo) takes its operands from c->fp_arg instead of three stack copies per call site, which
takes ___chkstk_ms out of the large lifted functions (275 call sites in main to 5). It reruns only the lanes that
failed the check. A NaN result in round-to-nearest goes from redo straight to fix with the FZ-flushed operands. The
static FP helpers use preserve_most, so their cold call sites do not spill the caller-saved registers.

Results are bit-identical to the old headers (equivalence harness of build/v143-genko/static2, 200M cases).
On the 42 hottest 1.4.3 functions: instructions -8.2%, bytes -8.8%, hot-path instructions -4.3%.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Valiantsin DzerakhandClaude Opus 5.5 committed 2026-11-15 00:31:00 +03:00
1 parent 94eb3d4628
commit 5c48f62fca
8 files changed
+89 -12

No files matched your search

+1
View File
@@ -643,6 +643,7 @@ static void check_got(void) {
hostfn_seal();
Cpu *c = plat_aligned_alloc(sizeof(Cpu), 64);
memset(c, 0, sizeof *c);
rt_fpcr_threshold(c);
uint8_t *stack = mem_kernel_alloc(0x10000, 16);
c->sp = (uint64_t)(uintptr_t)stack + 0x10000;
c->excl_addr = ~0ull;