GO-V.ORG
As seen in

extract_lane_s: Wasm SIMD extract instruction

The extractlanes SIMD extract instruction extracts the value contained within the specified lane of a v128 value interpretation as a signed integer.

The **`extract_lane_s`** [SIMD extract instruction](/docs/WebAssembly/Reference/SIMD/extract) extracts the value contained within the specified lane of a [`v128`](/docs/WebAssembly/Reference/Value_types/v128) value interpretation as a signed integer.

tabbed-taller

```wat interactive-example
(module
(import "console" "log" (func $log (param i32)))
(func $main
;; load a SIMD value onto the stack
(v128.const i16x8 1 0 -2 -1 -4 -2 -2 3)

i16x8.extract_lane_s 6 ;; Extract a scalar value from the result
call $log ;; log the result
)
(start $main)
)
```

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

## Syntax

```plain
value_type.extract_lane_s
```

- `value_type`
- : The type of value the instruction is being run on. The following [`v128`](/docs/WebAssembly/Reference/Value_types/v128) value interpretations support `extract_lane_s`:
- `i8x16`
- `i16x8`
- `extract_lane_s`
- : The `extract_lane_s` instruction. Must always be included after the `value_type` and a period (`.`).

### Type

```plain
[input, lane] -> [output]
```

- `input`
- : The `v128` value interpretation you want to extract a lane from.
- `lane`
- : The index of the lane whose value you wish to extract, for example `0`.
- `output`
- : The value extracted from the lane.

### Binary encoding

| Instruction | Binary format | Example text => binary |
| ---------------------- | ------------------------ | --------------------------------------------- |
| `i8x16.extract_lane_s` | `0xfd 21:u32 l:lane_idx` | `i8x16.extract_lane_s 11` => `0xfd 0x15 0x0b` |
| `i16x8.extract_lane_s` | `0xfd 24:u32 l:lane_idx` | `i16x8.extract_lane_s 7` => `0xfd 0x18 0x07` |

## Specifications

## Browser compatibility

## See also

- [`extract_lane`](/docs/WebAssembly/Reference/SIMD/extract/extract_lane)

source: MDN Web Docs mirror · page

Cite this

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

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

Save to pass ·