Files
velzieandClaude Opus 5.5 ca91f7b87d tier-1: Stmt::X87, a fast path inline and the rest through a pure import
Stmt::X87 lowers to inline wasm for the common operands and, for the
rest, a call to the new gex.x87 import, which computes the operation
with gex_f80 -- the same algorithm, so either way the bits are the
hardware's. The import is pure (it neither reads nor writes cached guest
state), so the block does not flush or invalidate around it: it returns
the result and leaves the status-word bits at ctx::X87_TMP + 12.

Fast paths, under every rounding mode:
- Narrow (fst m32/m64): J set and an exponent whose result is normal and
  stays finite even if rounding carries; about twenty instructions.
- ToInt (fist/fisttp): zero, and 1 <= |v| < 2^(bits-1), rounded by RC or
  truncated, the indefinite with IE when rounding takes it out of range.

The import is wired through gex-abi (X87, with its signature), the
module's import section, both shims (native: a host function; browser:
gex_x87, and gex.mjs's import objects) and the cross-engine harness,
which declines it. X87Op::code for ToInt is now 0x100 | bits << 1 | trunc
(0x10 collided with the bit width on decoding).

shims/native/tests/x87.rs checks every operation lowers to a valid module
in a plain block and in a fused loop.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FFqjijkLKTTuaQutt3168C
2026-09-30 21:20:04 -04:00
..