GO-Ve01
ServicesDevelopersBooksDictionaryPapersWikidataEncyclopediaSearchBabelCareersDeck

store16_lane: Wasm SIMD load/store instruction

The store16lane SIMD load/store instruction stores a specified lane of a v128 i16x8 value interpretation at a given memory address.

The **`store16_lane`** [SIMD load/store instruction](/docs/WebAssembly/Reference/SIMD/load_store) stores a specified lane of a [`v128`](/docs/WebAssembly/Reference/Value_types/v128) `i16x8` value interpretation at a given memory address.

tabbed-taller

```wat interactive-example
(module
(import "console" "log" (func $log (param i32)))
(memory $memory 1)
(func $main
i32.const 0
v128.const i16x8 120 140 160 180 200 220 240 260
v128.store16_lane 7

i32.const 0
v128.load
i16x8.extract_lane_u 0
call $log
)
(start $main)
)
```

```js interactive-example
WebAssembly.instantiateStreaming(fetch("{%wasm-url%}"), { console });
```

## Syntax

```plain
;; Common usage
v128.store16_lane lane_idx

;; With optional immediate operands
v128.store16_lane mem_idx offset=int align=int lane_idx
```

- `v128.store16_lane`
- : The `v128.store16_lane` instruction.
- `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 address before storing. 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 `1` and the default and maximum value is `2`. An `align` value has to be a power of `2`.
- `lane_idx`
- : The index of the lane whose value you want to store.

### Type

```plain
[memory_address, input] -> []
```

- `memory_address`
- : An integer representing the memory address to store the `input` at.
- `input`
- : The `v128` type from which to extract a lane value to store.

### Binary encoding

| Instruction | Binary format | Example text => binary |
| ------------------- | ------------------------------------------------------- | ---------------------------------------------------------------------- |
| `v128.store16_lane` | `0xfd 89:u32 mem_idx:u8 offset:u32 align:u32 l:laneidx` | `v128.store16_lane 0 offset=0 align=2 7` => `0xfd 0x59 0x01 0x00 0x07` |

> [!NOTE]
> While Wasm text format specifies the literal `align` value, the binary equivalent represents the exponent of the formula `2^x` used to calculate the alignment. So for example, `align=2` is equivalent to `0x01` (`2^1`).

## Specifications

## Browser compatibility

source: MDN Web Docs mirror · page

Cite this

"store16_lane: Wasm SIMD load/store instruction". MDN Web Docs. CC BY-SA 2.5 (MDN). https://developer.mozilla.org/en-US/docs/WebAssembly/Reference/SIMD/load_store/store16_lane

JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy

Save to pass ·