The extmul_low_i8x16_s SIMD arithmetic instruction takes lanes 0–7 of two signed v128 i8x16 value interpretations, multiplies the values in the corresponding lanes, and outputs the result of those operations into an i16x8 value interpretation.
(module
(import "console" "log" (func $log (param i32)))
(func $main
v128.const i8x16 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3
v128.const i8x16 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5
i16x8.extmul_low_i8x16_s
i16x8.extract_lane_s 7
call $log ;; log the result
)
(start $main)
)WebAssembly.instantiateStreaming(fetch("{%wasm-url%}"), { console });In the above example, lanes 0–7 of the two i8x16 input values are multiplied together and the products output as an i16x8. 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 8 (2 * 4).
The extmul_low_i8x16_s instruction is a more performant equivalent to passing the results of two extend_low_i8x16_s instructions into a mul instruction.
In other words:
(i16x8.extmul_low_i8x16_s
(input1)
(input2)
)is equivalent to
(i16x8.mul
(i16x8.extend_low_i8x16_s
(input1)
)
(i16x8.extend_low_i8x16_s
(input2)
)
)i16x8.extmul_low_i8x16_s
i16x8.extmul_low_i8x16_sThe i16x8.extmul_low_i8x16_s instruction.
[input1, input2] -> [output]
input1The first input v128 i8x16 value interpretation.
input2The second input v128 i8x16 value interpretation.
outputThe output v128 i16x8 value interpretation.
| Instruction | Binary format | Example text => binary |
|---|---|---|
i16x8.extmul_low_i8x16_s | 0xfd 156:u32 | i16x8.extmul_low_i8x16_s => 0xfd 0x9c 0x01 |