extmul_high_i8x16_u: Wasm SIMD arithmetic instruction

The extmul_high_i8x16_u SIMD arithmetic instruction takes lanes 8–15 of two unsigned v128 i8x16 value interpretations, multiplies the values in the corresponding lanes, and outputs the result of those operations into an i16x8 value interpretation.

Try it

(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_high_i8x16_u
    i16x8.extract_lane_s 7
    call $log ;; log the result
  )
  (start $main)
)
WebAssembly.instantiateStreaming(fetch("{%wasm-url%}"), { console });

In the above example, lanes 8–15 of the two i8x16 input values are multiplied together and the products output as an i16x8. Lane 8 of the first input is multiplied by lane 8 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 15 (3 * 5).

The extmul_high_i8x16_u instruction is a more performant equivalent to passing the results of two extend_high_i8x16_u instructions into a mul instruction.

In other words:

wat
(i16x8.extmul_high_i8x16_u
  (input1)
  (input2)
)

is equivalent to

wat
(i16x8.mul
  (i16x8.extend_high_i8x16_u
    (input1)
  )
  (i16x8.extend_high_i8x16_u
    (input2)
  )
)

Syntax

i16x8.extmul_high_i8x16_u
i16x8.extmul_high_i8x16_u

The i16x8.extmul_high_i8x16_u instruction.

Type

[input1, input2] -> [output]
input1

The first input v128 i8x16 value interpretation.

input2

The second input v128 i8x16 value interpretation.

output

The output v128 i16x8 value interpretation.

Binary encoding

Instruction Binary format Example text => binary
i16x8.extmul_high_i8x16_u 0xfd 159:u32 i16x8.extmul_high_i8x16_u => 0xfd 0x9f 0x01

Specifications

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

Browser compatibility

See also