Skip to content

Latest commit

 

History

History
45 lines (27 loc) · 1.76 KB

le.md

File metadata and controls

45 lines (27 loc) · 1.76 KB

le (less than or equals)

Takes 2 operands from the stack of the same numeric type and compares them.

Places an i32 on the stack representing the result of the comparison: either 1 if the first operand is less than or equal to the second, or 0 otherwise 1 2 3.

For integer types, there are two opcodes per type, to indicate whether to treat the operands as signed or unsigned for the comparison 4.

$$ T.\mathsf{le}_s^? \enspace (a: T, b: T) \to \begin{cases} 1_\mathsf{i32} &\text{if } a \le b \\ 0_\mathsf{i32} &\text{if } a > b \end{cases} $$

Instructions

Opcode Instruction Stack Arity
0x4C i32.le_s $[ \mathsf{i32}, \mathsf{i32} ] \to [ \mathsf{i32} ]$
0x4D i32.le_u $[ \mathsf{i32}, \mathsf{i32} ] \to [ \mathsf{i32} ]$
0x5A i64.le_s $[ \mathsf{i64}, \mathsf{i64} ] \to [ \mathsf{i32} ]$
0x5B i64.le_u $[ \mathsf{i64}, \mathsf{i64} ] \to [ \mathsf{i32} ]$
0x5F f32.le $[ \mathsf{f32}, \mathsf{f32} ] \to [ \mathsf{i32} ]$
0x65 f64.le $[ \mathsf{f64}, \mathsf{f64} ] \to [ \mathsf{i32} ]$

WAT Examples

todo

References

WebAssembly Core Specification

Footnotes

  1. Execution, Numerics, Integer Operations, ile_u - https://www.w3.org/TR/wasm-core-2/exec/numerics.html#op-ile-u

  2. Execution, Numerics, Integer Operations, ile_s - https://www.w3.org/TR/wasm-core-2/exec/numerics.html#op-ile-s

  3. Execution, Numerics, Floating-Point Operations, fle - https://www.w3.org/TR/wasm-core-2/exec/numerics.html#op-fle

  4. Structure, Numeric Instructions - https://www.w3.org/TR/wasm-core-2/syntax/instructions.html#numeric-instructions