min_s: Wasm SIMD arithmetic instruction
The min_s instruction compares two v128 signed integer value interpretations and returns a new interpretation with each lane set to the lower of that lane index's value on the two inputs.
Try it
(module
(import "console" "log" (func $log (param i32)))
(func $main
;; load two v128 i16x8s onto the stack
v128.const i16x8 10 400 0 86 87 9000 -5 19
v128.const i16x8 200 20 0 -5 80 9 -6 283
;; return a i16x8 containing the smallest values from each input
i16x8.min_s
i16x8.extract_lane_s 5 ;; Extract a single lane
call $log ;; log the result
)
(start $main)
)
const url = "{%wasm-url%}";
await WebAssembly.instantiateStreaming(fetch(url), { console });
Syntax
value_type.min_s
value_type-
The type of value the instruction is being run on. The following types support
min_s:i8x16i16x8i32x4
min_s-
The
min_sinstruction. Must always be included after thevalue_typeand a period (.).
Type
[input1, input2] -> [output]
Binary encoding
| Instruction | Binary format | Example text => binary |
|---|---|---|
i8x16.min_s |
0xfd 118:u32 |
i8x16.min_s => 0xfd 0x76 |
i16x8.min_s |
0xfd 150:u32 |
i16x8.min_s => 0xfd 0x96 0x01 |
i32x4.min_s |
0xfd 182:u32 |
i32x4.min_s => 0xfd 0xb6 0x01 |