extract_lane_u: Wasm SIMD extract instruction
The extract_lane_u SIMD extract instruction extracts the value contained within the specified lane of a v128 value interpretation as an unsigned integer.
Try it
(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_u 6 ;; Extract a scalar value from the result
call $log ;; log the result
)
(start $main)
)
WebAssembly.instantiateStreaming(fetch("{%wasm-url%}"), { console });
Syntax
value_type.extract_lane_u
value_type-
The type of value the instruction is being run on. The following
v128value interpretations supportextract_lane_u:i8x16i16x8
extract_lane_u-
The
extract_lane_uinstruction. Must always be included after thevalue_typeand a period (.).
Type
[input, lane] -> [output]
Binary encoding
| Instruction | Binary format | Example text => binary |
|---|---|---|
i8x16.extract_lane_u |
0xfd 22:u32 l:laneidx |
i8x16.extract_lane_u 11 => 0xfd 0x16 0x0b |
i16x8.extract_lane_u |
0xfd 25:u32 l:laneidx |
i16x8.extract_lane_u 7 => 0xfd 0x19 0x07 |