On this page

i32 Instructions

A collection of the different i32 instructions you can use. Select the instruction to see more information.

i32 Math

Instruction Description
i32.const Push an i32 value onto the stack.
i32.add Adds two numbers together.
i32.sub Subtracts one number from another.
i32.mul Multiples two numbers together.
i32.div_s Divide a number by another (signed).
i32.div_u Divide a number by another (unsigned).
i32.rem_s Get the remainder after dividing a number by another (signed).
i32.rem_u Get the remainder after dividing a number by another (unsigned).

i32 Bitwise

Instruction Description
i32.and Perform bitwise AND operation between two values.
i32.or Perform bitwise OR operation between two values.
i32.xor Perform bitwise XOR operation between two values.
i32.shl Shift a value to the left by a number of bits.
i32.shr_s Shift a value to the right by a number of bits (signed).
i32.shr_u Shift a value to the right by a number of bits (signed).
i32.rotl Rotate a value to the left by a number of bits.
i32.rotr Rotate a value to the right by a number of bits.
i32.clz Count the number of leading 0 bits of a value.
i32.ctz Count the number of trailing 0 bits of a value.
i32.popcnt Count the number of bits that are set to 1 in a value.

i32 Condition

Instruction Description
i32.eqz Checks if a value is zero.
i32.eq Compares two values to see if they are equal.
i32.ne Compares two values to see if they are not equal.
i32.gt_s Compares two values and see if the first is greater than the second (signed).
i32.gt_u Compares two values and see if the first is greater than the second (unsigned).
i32.ge_s Compares two values and see if the first is greater than or equal to the second (signed).
i32.ge_u Compares two values and see if the first is greater than or equal to the second (unsigned).
i32.lt_s Compares two values and see if the first is less than the second (signed).
i32.lt_u Compares two values and see if the first is less than the second (unsigned).
i32.le_s Compares two values and see if the first is less than or equal to the second (signed).
i32.le_u Compares two values and see if the first is less than or equal to the second (unsigned).

i32 Conversion

Instruction Description
i32.wrap_i64 Convert an i64 value into an i32 value.
i32.trunc_f64_s Convert a f64 value into an i32 value (signed). Throws an error if out of range.
i32.trunc_f64_u Convert a f64 value into an i32 value (unsigned). Throws an error if out of range.
i32.trunc_sat_f64_s Convert a f64 value into an i32 value (signed).
i32.trunc_sat_f64_u Convert a f64 value into an i32 value (unsigned).
i32.trunc_f32_s Convert a f32 value into an i32 value (signed). Throws an error if out of range.
i32.trunc_f32_u Convert a f32 value into an i32 value (unsigned). Throws an error if out of range.
i32.trunc_sat_f32_s Convert a f32 value into an i32 value (signed).
i32.trunc_sat_f32_u Convert a f32 value into an i32 value (unsigned).
i32.extend8_s Convert the first 8 bits of an i32 value into an i32 value.
i32.extend16_s Convert the first 16 bits of an i32 value into an i32 value.
i32.reinterpret_f32 Translate the binary structure of a f32 into an i32 value.

i32 Memory

Instruction Description
i32.store Copy an i32 value into memory.
i32.store16 Copy the first 16 bits of an i32 value into memory.
i32.store8 Copy the first 8 bits of an i32 value into memory.
i32.load Copy a 32 bit (4 byte) value from memory.
i32.load16_s Copy a 16 bit (2 byte) value from memory (signed).
i32.load16_u Copy a 16 bit (2 byte) value from memory (unsigned).
i32.load8_s Copy a 8 bit (1 byte) value from memory (signed).
i32.load8_u Copy a 8 bit (1 byte) value from memory (unsigned).