std/numeric
std/numeric
Section titled “std/numeric”std/wasm/numeric — arithmetic / compare / bitwise / unary instruction encoders for the WebAssembly Core 1.0 binary format. Spec: https://webassembly.github.io/spec/core/binary/instructions.html#numeric-instructions Fourth slice of Phase 1 of docs/TOOLCHAIN-SELF-HOSTING.md. After the leb128 / encode / inst slices, this one covers every wasm numeric opcode that fits the simple “opcode byte, no immediate” shape — which is all of arithmetic, comparison, bitwise / shift, and the four unary operators (clz / ctz / popcnt / eqz for integers; abs / neg / ceil / floor / trunc / nearest / sqrt for floats). Memory load/store (which carry alignment + offset immediates) and conversion / sign-extension (which are similarly bare-opcode but fall in a different spec section) are deferred to the next slice. Same shape as the rest of std/wasm: every encoder takes a u8[] and appends a single byte. The one-line shape — return buf.append(<opcode>); — is intentional: each function is individually trivial and the whole module reads as a printed opcode table.
inst_i32_clz
Section titled “inst_i32_clz”pub function inst_i32_clz(buf: u8[]): u8[]inst_i32_ctz
Section titled “inst_i32_ctz”pub function inst_i32_ctz(buf: u8[]): u8[]inst_i32_popcnt
Section titled “inst_i32_popcnt”pub function inst_i32_popcnt(buf: u8[]): u8[]inst_i32_eqz
Section titled “inst_i32_eqz”pub function inst_i32_eqz(buf: u8[]): u8[]inst_i32_eq
Section titled “inst_i32_eq”pub function inst_i32_eq(buf: u8[]): u8[]inst_i32_ne
Section titled “inst_i32_ne”pub function inst_i32_ne(buf: u8[]): u8[]inst_i32_lt_s
Section titled “inst_i32_lt_s”pub function inst_i32_lt_s(buf: u8[]): u8[]inst_i32_lt_u
Section titled “inst_i32_lt_u”pub function inst_i32_lt_u(buf: u8[]): u8[]inst_i32_gt_s
Section titled “inst_i32_gt_s”pub function inst_i32_gt_s(buf: u8[]): u8[]inst_i32_gt_u
Section titled “inst_i32_gt_u”pub function inst_i32_gt_u(buf: u8[]): u8[]inst_i32_le_s
Section titled “inst_i32_le_s”pub function inst_i32_le_s(buf: u8[]): u8[]inst_i32_le_u
Section titled “inst_i32_le_u”pub function inst_i32_le_u(buf: u8[]): u8[]inst_i32_ge_s
Section titled “inst_i32_ge_s”pub function inst_i32_ge_s(buf: u8[]): u8[]inst_i32_ge_u
Section titled “inst_i32_ge_u”pub function inst_i32_ge_u(buf: u8[]): u8[]inst_i32_add
Section titled “inst_i32_add”pub function inst_i32_add(buf: u8[]): u8[]inst_i32_sub
Section titled “inst_i32_sub”pub function inst_i32_sub(buf: u8[]): u8[]inst_i32_mul
Section titled “inst_i32_mul”pub function inst_i32_mul(buf: u8[]): u8[]inst_i32_div_s
Section titled “inst_i32_div_s”pub function inst_i32_div_s(buf: u8[]): u8[]inst_i32_div_u
Section titled “inst_i32_div_u”pub function inst_i32_div_u(buf: u8[]): u8[]inst_i32_rem_s
Section titled “inst_i32_rem_s”pub function inst_i32_rem_s(buf: u8[]): u8[]inst_i32_rem_u
Section titled “inst_i32_rem_u”pub function inst_i32_rem_u(buf: u8[]): u8[]inst_i32_and
Section titled “inst_i32_and”pub function inst_i32_and(buf: u8[]): u8[]inst_i32_or
Section titled “inst_i32_or”pub function inst_i32_or(buf: u8[]): u8[]inst_i32_xor
Section titled “inst_i32_xor”pub function inst_i32_xor(buf: u8[]): u8[]inst_i32_shl
Section titled “inst_i32_shl”pub function inst_i32_shl(buf: u8[]): u8[]inst_i32_shr_s
Section titled “inst_i32_shr_s”pub function inst_i32_shr_s(buf: u8[]): u8[]inst_i32_shr_u
Section titled “inst_i32_shr_u”pub function inst_i32_shr_u(buf: u8[]): u8[]inst_i32_rotl
Section titled “inst_i32_rotl”pub function inst_i32_rotl(buf: u8[]): u8[]inst_i32_rotr
Section titled “inst_i32_rotr”pub function inst_i32_rotr(buf: u8[]): u8[]inst_i64_clz
Section titled “inst_i64_clz”pub function inst_i64_clz(buf: u8[]): u8[]inst_i64_ctz
Section titled “inst_i64_ctz”pub function inst_i64_ctz(buf: u8[]): u8[]inst_i64_popcnt
Section titled “inst_i64_popcnt”pub function inst_i64_popcnt(buf: u8[]): u8[]inst_i64_eqz
Section titled “inst_i64_eqz”pub function inst_i64_eqz(buf: u8[]): u8[]inst_i64_eq
Section titled “inst_i64_eq”pub function inst_i64_eq(buf: u8[]): u8[]inst_i64_ne
Section titled “inst_i64_ne”pub function inst_i64_ne(buf: u8[]): u8[]inst_i64_lt_s
Section titled “inst_i64_lt_s”pub function inst_i64_lt_s(buf: u8[]): u8[]inst_i64_lt_u
Section titled “inst_i64_lt_u”pub function inst_i64_lt_u(buf: u8[]): u8[]inst_i64_gt_s
Section titled “inst_i64_gt_s”pub function inst_i64_gt_s(buf: u8[]): u8[]inst_i64_gt_u
Section titled “inst_i64_gt_u”pub function inst_i64_gt_u(buf: u8[]): u8[]inst_i64_le_s
Section titled “inst_i64_le_s”pub function inst_i64_le_s(buf: u8[]): u8[]inst_i64_le_u
Section titled “inst_i64_le_u”pub function inst_i64_le_u(buf: u8[]): u8[]inst_i64_ge_s
Section titled “inst_i64_ge_s”pub function inst_i64_ge_s(buf: u8[]): u8[]inst_i64_ge_u
Section titled “inst_i64_ge_u”pub function inst_i64_ge_u(buf: u8[]): u8[]inst_i64_add
Section titled “inst_i64_add”pub function inst_i64_add(buf: u8[]): u8[]inst_i64_sub
Section titled “inst_i64_sub”pub function inst_i64_sub(buf: u8[]): u8[]inst_i64_mul
Section titled “inst_i64_mul”pub function inst_i64_mul(buf: u8[]): u8[]inst_i64_div_s
Section titled “inst_i64_div_s”pub function inst_i64_div_s(buf: u8[]): u8[]inst_i64_div_u
Section titled “inst_i64_div_u”pub function inst_i64_div_u(buf: u8[]): u8[]inst_i64_rem_s
Section titled “inst_i64_rem_s”pub function inst_i64_rem_s(buf: u8[]): u8[]inst_i64_rem_u
Section titled “inst_i64_rem_u”pub function inst_i64_rem_u(buf: u8[]): u8[]inst_i64_and
Section titled “inst_i64_and”pub function inst_i64_and(buf: u8[]): u8[]inst_i64_or
Section titled “inst_i64_or”pub function inst_i64_or(buf: u8[]): u8[]inst_i64_xor
Section titled “inst_i64_xor”pub function inst_i64_xor(buf: u8[]): u8[]inst_i64_shl
Section titled “inst_i64_shl”pub function inst_i64_shl(buf: u8[]): u8[]inst_i64_shr_s
Section titled “inst_i64_shr_s”pub function inst_i64_shr_s(buf: u8[]): u8[]inst_i64_shr_u
Section titled “inst_i64_shr_u”pub function inst_i64_shr_u(buf: u8[]): u8[]inst_i64_rotl
Section titled “inst_i64_rotl”pub function inst_i64_rotl(buf: u8[]): u8[]inst_i64_rotr
Section titled “inst_i64_rotr”pub function inst_i64_rotr(buf: u8[]): u8[]inst_f32_eq
Section titled “inst_f32_eq”pub function inst_f32_eq(buf: u8[]): u8[]inst_f32_ne
Section titled “inst_f32_ne”pub function inst_f32_ne(buf: u8[]): u8[]inst_f32_lt
Section titled “inst_f32_lt”pub function inst_f32_lt(buf: u8[]): u8[]inst_f32_gt
Section titled “inst_f32_gt”pub function inst_f32_gt(buf: u8[]): u8[]inst_f32_le
Section titled “inst_f32_le”pub function inst_f32_le(buf: u8[]): u8[]inst_f32_ge
Section titled “inst_f32_ge”pub function inst_f32_ge(buf: u8[]): u8[]inst_f32_abs
Section titled “inst_f32_abs”pub function inst_f32_abs(buf: u8[]): u8[]inst_f32_neg
Section titled “inst_f32_neg”pub function inst_f32_neg(buf: u8[]): u8[]inst_f32_ceil
Section titled “inst_f32_ceil”pub function inst_f32_ceil(buf: u8[]): u8[]inst_f32_floor
Section titled “inst_f32_floor”pub function inst_f32_floor(buf: u8[]): u8[]inst_f32_trunc
Section titled “inst_f32_trunc”pub function inst_f32_trunc(buf: u8[]): u8[]inst_f32_nearest
Section titled “inst_f32_nearest”pub function inst_f32_nearest(buf: u8[]): u8[]inst_f32_sqrt
Section titled “inst_f32_sqrt”pub function inst_f32_sqrt(buf: u8[]): u8[]inst_f32_add
Section titled “inst_f32_add”pub function inst_f32_add(buf: u8[]): u8[]inst_f32_sub
Section titled “inst_f32_sub”pub function inst_f32_sub(buf: u8[]): u8[]inst_f32_mul
Section titled “inst_f32_mul”pub function inst_f32_mul(buf: u8[]): u8[]inst_f32_div
Section titled “inst_f32_div”pub function inst_f32_div(buf: u8[]): u8[]inst_f32_min
Section titled “inst_f32_min”pub function inst_f32_min(buf: u8[]): u8[]inst_f32_max
Section titled “inst_f32_max”pub function inst_f32_max(buf: u8[]): u8[]inst_f32_copysign
Section titled “inst_f32_copysign”pub function inst_f32_copysign(buf: u8[]): u8[]inst_f64_eq
Section titled “inst_f64_eq”pub function inst_f64_eq(buf: u8[]): u8[]inst_f64_ne
Section titled “inst_f64_ne”pub function inst_f64_ne(buf: u8[]): u8[]inst_f64_lt
Section titled “inst_f64_lt”pub function inst_f64_lt(buf: u8[]): u8[]inst_f64_gt
Section titled “inst_f64_gt”pub function inst_f64_gt(buf: u8[]): u8[]inst_f64_le
Section titled “inst_f64_le”pub function inst_f64_le(buf: u8[]): u8[]inst_f64_ge
Section titled “inst_f64_ge”pub function inst_f64_ge(buf: u8[]): u8[]inst_f64_abs
Section titled “inst_f64_abs”pub function inst_f64_abs(buf: u8[]): u8[]inst_f64_neg
Section titled “inst_f64_neg”pub function inst_f64_neg(buf: u8[]): u8[]inst_f64_ceil
Section titled “inst_f64_ceil”pub function inst_f64_ceil(buf: u8[]): u8[]inst_f64_floor
Section titled “inst_f64_floor”pub function inst_f64_floor(buf: u8[]): u8[]inst_f64_trunc
Section titled “inst_f64_trunc”pub function inst_f64_trunc(buf: u8[]): u8[]inst_f64_nearest
Section titled “inst_f64_nearest”pub function inst_f64_nearest(buf: u8[]): u8[]inst_f64_sqrt
Section titled “inst_f64_sqrt”pub function inst_f64_sqrt(buf: u8[]): u8[]inst_f64_add
Section titled “inst_f64_add”pub function inst_f64_add(buf: u8[]): u8[]inst_f64_sub
Section titled “inst_f64_sub”pub function inst_f64_sub(buf: u8[]): u8[]inst_f64_mul
Section titled “inst_f64_mul”pub function inst_f64_mul(buf: u8[]): u8[]inst_f64_div
Section titled “inst_f64_div”pub function inst_f64_div(buf: u8[]): u8[]inst_f64_min
Section titled “inst_f64_min”pub function inst_f64_min(buf: u8[]): u8[]inst_f64_max
Section titled “inst_f64_max”pub function inst_f64_max(buf: u8[]): u8[]inst_f64_copysign
Section titled “inst_f64_copysign”pub function inst_f64_copysign(buf: u8[]): u8[]