load16_splat: Wasm SIMD load/store instruction
The load16splat SIMD load/store instruction loads a single value from a given memory address into all lanes of a v128 type i16x8 value interpretation.
The load16_splat SIMD load/store instruction loads a single value from a given memory address into all lanes of a v128 type i16x8 value interpretation.
tabbed-taller
```wat interactive-example (module (import "console" "log" (func $log (param i32))) (memory $memory 1) (data (i32.const 0) "\01\02\03\04\05\06\07\08\09\0a\0b\0c\0d\0e\0f\00\01\02\03") (func $main i32.const 1 v128.load16_splat i16x8.extract_lane_s 6 call $log ) (start $main) )
```js interactive-example
WebAssembly.instantiateStreaming(fetch("{%wasm-url%}"), { console });
Syntax
;; Common usage
v128.load16_splat
;; With optional immediate operands
v128.load16_splat mem_idx offset=int align=int
v128.load16_splat- : The
v128.load16_splatinstruction. mem_idx- : An integer representing the memory index, in cases where the module uses multiple memories. The default is
0. offset=int- : An integer representing a constant number of bytes to add to the memory address before loading. The default is
0. align=int- : An integer representing a hint to the Wasm engine about what alignment to expect for the final address. The minimum value is
1and the default and maximum value is2. Analignvalue has to be a power of2.
Type
[memory_address] -> [output]
memory_address- : An integer representing the memory address to load from.
output- : The output
v128typei16x8value interpretation.
Binary encoding
| Instruction | Binary format | Example text => binary |
|---|---|---|
v128.load16_splat |
0xFD 8:u32 mem_idx:u8 offset:u32 align:u32 |
v128.load16_splat 0 offset=0 align=2 => 0xfd 0x08 0x01 0x00 |
[!NOTE] While Wasm text format specifies the literal
alignvalue, the binary equivalent represents the exponent of the formula2^xused to calculate the alignment. So for example,align=1is equivalent to0x00(2^0), whilealign=2is equivalent to0x01(2^1).