extmul_low_i16x8_s: Wasm SIMD arithmetic instruction

The extmul_low_i16x8_s SIMD arithmetic instruction takes lanes 0–3 of two signed 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_s
    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_s instruction is a more performant equivalent to passing the results of two extend_low_i16x8_s instructions into a mul instruction.

In other words:

wat
(i32x4.extmul_low_i16x8_s
  (input1)
  (input2)
)

is equivalent to

wat
(i32x4.mul
  (i32x4.extend_low_i16x8_s
    (input1)
  )
  (i32x4.extend_low_i16x8_s
    (input2)
  )
)

Syntax

i32x4.extmul_low_i16x8_s
i32x4.extmul_low_i16x8_s

The i32x4.extmul_low_i16x8_s instruction.

Type

[input1, input2] -> [output]
input1

The first input v128 i16x8 value interpretation.

input2

The second input v128 i16x8 value interpretation.

output

The output v128 i32x4 value interpretation.

Binary encoding

Instruction Binary format Example text => binary
i32x4.extmul_low_i16x8_s 0xfd 188:u32 i32x4.extmul_low_i16x8_s => 0xfd 0xbc 0x01

Specifications

This feature does not appear to be defined in any specification.

Browser compatibility

See also