extmul_low_i16x8_u: Wasm SIMD arithmetic instruction
The extmul_low_i16x8_u SIMD arithmetic instruction takes lanes 0–3 of two unsigned v128 i16x8 value interpretations, multiplies the values in the corresponding lanes, and outputs the result of those operations into an i32x4 value interpretation.
Try it
(module
(import "console" "log" (func $log (param i32)))
(func $main
v128.const i16x8 3 3 3 3 6 6 6 6
v128.const i16x8 2 2 2 2 4 4 4 4
i32x4.extmul_low_i16x8_u
i32x4.extract_lane 3
call $log ;; log the result
)
(start $main)
)
WebAssembly.instantiateStreaming(fetch("{%wasm-url%}"), { console });
In the above example, lanes 0–3 of the two i16x8 input values are multiplied together and the products output as an i32x4. Lane 0 of the first input is multiplied by lane 0 of the second input, and the product becomes lane 0 of the output, and so on. As a result, each lane of the output contains the value 6 (3 * 2).
The extmul_low_i16x8_u instruction is a more performant equivalent to passing the results of two extend_low_i16x8_u instructions into a mul instruction.
In other words:
(i32x4.extmul_low_i16x8_u
(input1)
(input2)
)
is equivalent to
(i32x4.mul
(i32x4.extend_low_i16x8_u
(input1)
)
(i32x4.extend_low_i16x8_u
(input2)
)
)
Syntax
i32x4.extmul_low_i16x8_u
i32x4.extmul_low_i16x8_u-
The
i32x4.extmul_low_i16x8_uinstruction.
Type
[input1, input2] -> [output]
Binary encoding
| Instruction | Binary format | Example text => binary |
|---|---|---|
i32x4.extmul_low_i16x8_u |
0xfd 190:u32 |
i32x4.extmul_low_i16x8_u => 0xfd 0xbe 0x01 |