Wado
<!-- Auto-generated by: wado doc -f markdown core:simd --> <!-- Do not edit this file directly. -->

core:simd

Type-safe wrappers over the WebAssembly 128-bit SIMD instruction set. All types are newtypes of the primitive v128 and can be freely reinterpreted via as cast.

Types

Category Types
Signed integer i8x16, i16x8, i32x4, i64x2
Unsigned integer u8x16, u16x8, u32x4, u64x2
Floating-point f32x4, f64x2

Construction

Lane Access

Operators

All types support +, -, *, &, |, ^, ~, <<, >>, and unary -. Floating-point types additionally support /. Integer types do not support /.

Comparison Methods

All types provide eq, ne, lt, gt, le, ge. These return a mask vector (all-1s or all-0s per lane), not bool. Floating-point comparisons return the corresponding integer mask type (f32x4 -> i32x4).

Signed Integer Types (i8x16, i16x8, i32x4, i64x2)

Common methods: abs, all_true, bitmask, bitselect.

i8x16 specific: swizzle, add_sat_s/u, sub_sat_s/u, min_s/u, max_s/u, avgr_u, narrow_i16x8_s/u, popcnt, any_true, andnot.

i16x8 specific: add_sat_s/u, sub_sat_s/u, min_s/u, max_s/u, avgr_u, narrow_i32x4_s/u, extend_low/high_i8x16_s/u, extmul_low/high_i8x16_s/u, extadd_pairwise_i8x16_s/u, q15mulr_sat_s.

i32x4 specific: min_s/u, max_s/u, dot_i16x8_s, extend_low/high_i16x8_s/u, extmul_low/high_i16x8_s/u, extadd_pairwise_i16x8_s/u, trunc_sat_f32x4_s/u, trunc_sat_f64x2_s/u_zero.

i64x2 specific: extend_low/high_i32x4_s/u, extmul_low/high_i32x4_s/u.

Unsigned Integer Types (u8x16, u16x8, u32x4, u64x2)

u8x16: abs, add_sat, sub_sat, min, max, avgr, all_true, bitmask, popcnt, bitselect.

u16x8: abs, add_sat, sub_sat, min, max, avgr, all_true, bitmask, bitselect.

u32x4: min, max, all_true, bitmask, bitselect.

u64x2: all_true, bitmask, bitselect.

Floating-Point Types (f32x4, f64x2)

sqrt, abs, min, max, ceil, floor, trunc, nearest, pmin, pmax, bitselect.

f32x4 specific: convert_i32x4_s/u, demote_f64x2_zero.

f64x2 specific: convert_low_i32x4_s/u, promote_low_f32x4.

Relaxed SIMD

Relaxed SIMD operations trade strict determinism for performance. Edge-case behavior (NaN, out-of-range) is implementation-defined but consistent within a runtime. Methods use the relaxed_ prefix.

Synopsis

let a: i32x4 = [10, 2, 30, 4];
let b: i32x4 = [1, 20, 3, 40];
let mins = a.min_s(&b);
assert mins.extract_lane(0) == 1;
assert mins.extract_lane(3) == 4;

Types

pub type i8x16 = v128

pub type i16x8 = v128

pub type i32x4 = v128

pub type i64x2 = v128

pub type u8x16 = v128

pub type u16x8 = v128

pub type u32x4 = v128

pub type u64x2 = v128

pub type f32x4 = v128

pub type f64x2 = v128

Structs

pub struct I8x16Builder

Fields are private.

impl SequenceLiteralBuilder for I8x16Builder

fn new_literal(capacity: i32) -> I8x16Builder
fn push_literal(&mut self, value: i32)
fn build(&self) -> i8x16

pub struct I16x8Builder

Fields are private.

impl SequenceLiteralBuilder for I16x8Builder

fn new_literal(capacity: i32) -> I16x8Builder
fn push_literal(&mut self, value: i32)
fn build(&self) -> i16x8

pub struct I32x4Builder

Fields are private.

impl SequenceLiteralBuilder for I32x4Builder

fn new_literal(capacity: i32) -> I32x4Builder
fn push_literal(&mut self, value: i32)
fn build(&self) -> i32x4

pub struct I64x2Builder

Fields are private.

impl SequenceLiteralBuilder for I64x2Builder

fn new_literal(capacity: i32) -> I64x2Builder
fn push_literal(&mut self, value: i64)
fn build(&self) -> i64x2

pub struct U8x16Builder

Fields are private.

impl SequenceLiteralBuilder for U8x16Builder

fn new_literal(capacity: i32) -> U8x16Builder
fn push_literal(&mut self, value: i32)
fn build(&self) -> u8x16

pub struct U16x8Builder

Fields are private.

impl SequenceLiteralBuilder for U16x8Builder

fn new_literal(capacity: i32) -> U16x8Builder
fn push_literal(&mut self, value: i32)
fn build(&self) -> u16x8

pub struct U32x4Builder

Fields are private.

impl SequenceLiteralBuilder for U32x4Builder

fn new_literal(capacity: i32) -> U32x4Builder
fn push_literal(&mut self, value: i32)
fn build(&self) -> u32x4

pub struct U64x2Builder

Fields are private.

impl SequenceLiteralBuilder for U64x2Builder

fn new_literal(capacity: i32) -> U64x2Builder
fn push_literal(&mut self, value: i64)
fn build(&self) -> u64x2

pub struct F32x4Builder

Fields are private.

impl SequenceLiteralBuilder for F32x4Builder

fn new_literal(capacity: i32) -> F32x4Builder
fn push_literal(&mut self, value: f32)
fn build(&self) -> f32x4

pub struct F64x2Builder

Fields are private.

impl SequenceLiteralBuilder for F64x2Builder

fn new_literal(capacity: i32) -> F64x2Builder
fn push_literal(&mut self, value: f64)
fn build(&self) -> f64x2