Add f32/f64 support
Floats live in the existing 8-byte stack slots as raw bits and are computed with scalar SSE ops via xmm0/xmm1. Adds consts, loads/stores, comparisons (NaN-correct), abs/neg/copysign, ceil/floor/trunc/nearest (roundss/sd), sqrt, add/sub/mul/div, wasm-semantics min/max (NaN propagating, -0 < +0), int<->float conversions (incl. unsigned 64-bit), demote/promote, reinterpret, and float globals. Trapping truncation traps on NaN (new 'invalid conversion to integer' message) and on out-of-range values. Adds examples/float.wat (52 self-checks) and examples/fptrap.wat. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4c4fa91dc9
commit
f0d996cee9
7 files changed
+438
-44
No files matched your search
+9
-6
@@ -29,9 +29,12 @@ can build the example.
|
||||
|
||||
## Supported subset
|
||||
|
||||
i32 and i64; locals, params, calls, block/loop/if/else/br/br_if/return, select/drop,
|
||||
integer arithmetic/comparison/shift/rotate (i64 add/sub/mul/div/rem/and/or/xor/shifts/
|
||||
comparisons, wrap/extend, sign-extension ops), one fixed-size linear memory (i32/i64 loads/stores incl. narrow
|
||||
forms, with bounds checks, `memory.size`; `memory.grow` always returns -1), i32/i64 globals, active data
|
||||
segments. Not supported: clz/ctz/popcnt, floats, tables/`call_indirect`, `br_table`, start function,
|
||||
non-function imports. Input is assumed valid (`wasm-tools validate` it first).
|
||||
i32, i64, f32 and f64; locals, params, calls, block/loop/if/else/br/br_if/return,
|
||||
select/drop, integer arithmetic/comparison/shift/rotate, sign-extension ops, float
|
||||
arithmetic/comparison/min/max/copysign/rounding/sqrt (SSE scalar ops; rounding needs SSE4.1),
|
||||
all int/float conversions (`trunc` traps on NaN and out-of-range; no `trunc_sat`),
|
||||
reinterpret, one fixed-size linear memory (all i32/i64/f32/f64 loads/stores incl. narrow
|
||||
forms, with bounds checks, `memory.size`; `memory.grow` always returns -1), globals of any
|
||||
numeric type, active data segments. Values live in 8-byte stack slots; floats are kept as
|
||||
raw bits. Not supported: clz/ctz/popcnt, v128/reference types, tables/`call_indirect`,
|
||||
`br_table`, start function, non-function imports. Input is assumed valid (`wasm-tools validate` it first).
|
||||
Reference in new issue
Block a user