The narrow_i16x8_u SIMD conversion instruction converts two signed v128 i16x8 value interpretations into an i8x16 value interpretation using unsigned saturation (clamping to the range between 0 to 255).
(module
(import "console" "log" (func $log (param i32)))
(func $main
v128.const i16x8 2 4 6 8 10 12 14 16
v128.const i16x8 18 20 22 24 26 28 30 32
i8x16.narrow_i16x8_u
i8x16.extract_lane_s 15
call $log ;; log the result
)
(start $main)
)WebAssembly.instantiateStreaming(fetch("{%wasm-url%}"), { console });i8x16.narrow_i16x8_u
i8x16.narrow_i16x8_uThe i8x16.narrow_i16x8_u instruction.
[input1, input2] -> [output]
input1The first input v128 i16x8 value interpretation.
input2The second input v128 i16x8 value interpretation.
outputThe output v128 i8x16 value interpretation.
| Instruction | Binary format | Example text => binary |
|---|---|---|
i8x16.narrow_i16x8_u | 0xfd 102:u32 | i8x16.narrow_i16x8_u => 0xfd 0x66 |