Skip to content

Latest commit

 

History

History
196 lines (173 loc) · 8.21 KB

readme.md

File metadata and controls

196 lines (173 loc) · 8.21 KB

WASM Instructions

Numeric

These instructions pertain to the 4 "main" numeric data types: i32, i64, f32, and f64

Vector / SIMD

These instructions pertain to v128 values, and their various formats.

  • const (declare constant vector)
  • splat (create vector with identical lanes)
  • Memory

  • Lane Operations

  • Comparisons

    • eq (equals)
    • ne (not equals)
    • lt (less than)
    • gt (greater than)
    • le (less than or equals)
    • ge (greater than or equals)
  • Integer Arithmetic

    • add (lane-wise addition)
    • sub (lane-wise subtraction)
    • mul (lane-wise multiplication)
    • dot (lane-wise dot product)
    • neg (lane-wise negation)
  • Extended Integer Arithmetic

    • extmul (extended multiplication)
    • extadd (extended pairwise addition)
  • Saturating Integer Arithmetic

    • add_sat (saturating addition)
    • sub_sat (saturating subtraction)
    • q15mulr_sat (saturating Q-format rounding multiplication)
    • min (select lane-wise minimum)
    • max (select lane-wise maximum)
    • avgr (lane-wise rounding average)
    • abs (lane-wise absolute value)
  • Bitwise Operations

    • not (bitwise not)
    • and (bitwise and)
    • andnot (bitwise and-not)
    • or (bitwise or)
    • xor (bitwise xor)
    • shl (lane-wise shift left)
    • shr (lane-wise shift right)
    • bitselect (bitwise select)
    • bitmask (bitmask extraction)
    • popcnt (lane-wise population count)
  • Boolean Horizontal Reductions

  • Floating-point Operations

    • neg (lane-wise negation)
    • abs (lane-wise absolute value)
    • min (NaN-propagating lane-wise select minimum)
    • max (NaN-propagating lane-wise select maximum)
    • pmin (lane-wise select psuedo-minimum)
    • pmax (lane-wise select psuedo-maximum)
  • Floating-point Arithmetic

    • add (addition)
    • sub (subtraction)
    • div (division)
    • mul (multiplication)
    • sqrt (square root)
    • ceil (ceiling / round up)
    • floor (floor / round down)
    • trunc (truncate / round toward zero)
    • nearest (round to nearest)
  • Conversions

    • convert (convert i32 to floating-point)
    • trunc_sat (convert floating-point to i32 with saturation)
    • demote (convert f64 to f32)
    • promote (convert f32 to f64)
    • narrow (integer narrowing)
    • extend (integer extension)

Reference

Parametric

  • drop (drop the top value from the stack)
  • select (conditionally select an operand)

Variable

  • local.get (push local variable to stack)
  • local.set (pop stack value and write to local variable)
  • local.tee (write top of stack to local variable without pop)
  • global.get (push global variable to stack)
  • global.set (pop stack value and write to global variable)

Table

Memory

Control