↑ arvau

MDN / extadd_pairwise_i16x8_u: Wasm SIMD arithmetic instruction

The extadd_pairwise_i16x8_u SIMD arithmetic instruction adds each adjacent pair of lanes of an unsigned v128 i16x8 value interpretation, outputting the results into an i32x4 value interpretation.

(module
  (import "console" "log" (func $log (param i32)))
  (func $main
    v128.const i16x8 20 40 20 40 20 40 20 40

    i32x4.extadd_pairwise_i16x8_u
    i32x4.extract_lane 3
    call $log ;; log the result
  )
  (start $main)
)
WebAssembly.instantiateStreaming(fetch("{%wasm-url%}"), { console });

In the above example, each adjacent pair of lanes contains the values 20 and 40. The extadd_pairwise_i16x8_u instruction adds each pair together, resulting in the 4 lanes of the output i32x4 value all containing the value 60.

Syntax

i32x4.extadd_pairwise_i16x8_u
  • i32x4.extadd_pairwise_i16x8_u

    • : The i32x4.extadd_pairwise_i16x8_u instruction.

Type

[input] -> [output]
  • input

    • : The input v128 i16x8 value interpretation.

    output

    • : The output v128 i32x4 value interpretation.

Binary encoding

InstructionBinary formatExample text => binaryi32x4.extadd_pairwise_i16x8_u0xfd 127:u32i32x4.extadd_pairwise_i16x8_u => 0xfd 0x7f

Specifications

Browser compatibility