Dieser Inhalt wurde automatisch aus dem Englischen übersetzt, und kann Fehler enthalten. Erfahre mehr über dieses Experiment.

View in English Always switch to English

extmul_low_i16x8_s: Wasm SIMD Arithmetik-Instruktion

Die extmul_low_i16x8_s SIMD Arithmetik-Instruktion nimmt die Lanes 0–3 von zwei vorzeichenbehafteten v128 i16x8 Wertinterpretationen, multipliziert die Werte in den entsprechenden Lanes und gibt das Ergebnis dieser Operationen in einer i32x4 Wertinterpretation aus.

Probieren Sie es aus

(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 });

Im obigen Beispiel werden die Lanes 0–3 der beiden i16x8 Eingabewerte miteinander multipliziert, und die Produkte werden als i32x4 ausgegeben. Lane 0 des ersten Eingangs wird mit Lane 0 des zweiten Eingangs multipliziert, und das Produkt wird zu Lane 0 der Ausgabe, und so weiter. Dadurch enthält jede Lane der Ausgabe den Wert 6 (3 * 2).

Die extmul_low_i16x8_s Instruktion ist eine leistungsfähigere Variante, die Ergebnisse von zwei extend_low_i16x8_s Instruktionen in eine mul Instruktion zu führen.

Mit anderen Worten:

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

ist gleichwertig mit

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

Die i32x4.extmul_low_i16x8_s Instruktion.

Typ

[input1, input2] -> [output]
input1

Die erste v128 i16x8 Wertinterpretation.

input2

Die zweite v128 i16x8 Wertinterpretation.

output

Die Ausgabe v128 i32x4 Wertinterpretation.

Binäre Codierung

Instruktion Binärformat Beispieltext => binär
i32x4.extmul_low_i16x8_s 0xfd 188:u32 i32x4.extmul_low_i16x8_s => 0xfd 0xbc 0x01

Spezifikationen

Spezifikation
WebAssembly Core Specification
# vector-instructions%E2%91%A8

Browser-Kompatibilität