Takes two operands (both of the same numeric type), subtracts the second operand from the first, and places the result on the stack 1 2 3.
Opcode | Instruction | Stack Arity |
---|---|---|
0x6B |
i32.sub |
|
0x7D |
i64.sub |
|
0x93 |
f32.sub |
|
0xA1 |
f64.sub |
;; Places 2 values on the stack
i32.const 20
i32.const 10
;; Takes two values off of the stack (20 and 10), subtracts, and
;; places the result (10) on the stack
i32.sub
Footnotes
-
Structure, Numeric Instructions - https://www.w3.org/TR/wasm-core-2/syntax/instructions.html#numeric-instructions ↩
-
Execution, Numerics, Integer Operations, isub - https://www.w3.org/TR/wasm-core-2/exec/numerics.html#op-isub ↩
-
Execution, Numerics, Floating-Point Operations, fsub - https://www.w3.org/TR/wasm-core-2/exec/numerics.html#op-fsub ↩