extmul_low_i32x4_u: Wasm SIMD arithmetic instruction
The extmul_low_i32x4_u SIMD arithmetic instruction takes lanes 0–1 of two unsigned v128 i32x4 value interpretations, multiplies the values in the corresponding lanes, and outputs the result of those operations into an i64x2 value interpretation.
Try it
(module
(import "console" "log" (func $log (param i64)))
(func $main
v128.const i32x4 25 25 50 50
v128.const i32x4 20 20 40 40
i64x2.extmul_low_i32x4_u
i64x2.extract_lane 1
call $log ;; log the result
)
(start $main)
)
WebAssembly.instantiateStreaming(fetch("{%wasm-url%}"), { console });
In the above example, lanes 0–1 of the two i32x4 input values are multiplied together and the products output as an i64x2. 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 500 (25 * 20).
The extmul_low_i32x4_u instruction is a more performant equivalent to passing the results of two extend_low_i32x4_u instructions into a mul instruction.
In other words:
(i64x2.extmul_low_i32x4_u
(input1)
(input2)
)
is equivalent to
(i64x2.mul
(i64x2.extend_low_i32x4_u
(input1)
)
(i64x2.extend_low_i32x4_u
(input2)
)
)
Syntax
i64x2.extmul_low_i32x4_u
i64x2.extmul_low_i32x4_u-
The
i64x2.extmul_low_i32x4_uinstruction.
Type
[input1, input2] -> [output]
Binary encoding
| Instruction | Binary format | Example text => binary |
|---|---|---|
i64x2.extmul_low_i32x4_u |
0xfd 222:u32 |
i64x2.extmul_low_i32x4_u => 0xfd 0xde 0x01 |