Reference
std/simd
std/simd
Vector types and operations on all their lanes at once.
import * as Simd from "std/simd"
The guide teaches it in chapter 19, Building for other systems.
This page is generated by scripts/std/generate.nra from narrac query --json interface std/simd. Do not edit it.
Types
I8x16
export opaque struct I8x16
I16x8
export opaque struct I16x8
I32x4
export opaque struct I32x4
I64x2
export opaque struct I64x2
I8x32
export opaque struct I8x32
I16x16
export opaque struct I16x16
I32x8
export opaque struct I32x8
I64x4
export opaque struct I64x4
Functions of I8x16, I16x8, I32x4, I64x2, I8x32, I16x16, I32x8, I64x4: abs, all, any, equal, fromFixed, greater, greaterOrEqual, less, lessOrEqual, load, max, min, notEqual, select, shiftLeft, shiftRight, shuffle, splat, store, sum, toFixed, withLane.
U8x16
export opaque struct U8x16
U16x8
export opaque struct U16x8
U32x4
export opaque struct U32x4
U64x2
export opaque struct U64x2
U8x32
export opaque struct U8x32
U16x16
export opaque struct U16x16
U32x8
export opaque struct U32x8
U64x4
export opaque struct U64x4
Functions of U8x16, U16x8, U32x4, U64x2, U8x32, U16x16, U32x8, U64x4: all, any, equal, fromFixed, greater, greaterOrEqual, less, lessOrEqual, load, max, min, notEqual, select, shiftLeft, shiftRight, shuffle, splat, store, sum, toFixed, withLane.
F32x4
export opaque struct F32x4
F64x2
export opaque struct F64x2
F32x8
export opaque struct F32x8
F64x4
export opaque struct F64x4
Functions of F32x4, F64x2, F32x8, F64x4: abs, equal, fromFixed, greater, greaterOrEqual, less, lessOrEqual, load, max, min, notEqual, select, shuffle, splat, store, sum, toFixed, withLane.
Functions
Details for every function below: V: a vector type such as I32x4 (listed above), M: the signed integer vector of the same shape (its mask), L: the lane type of V, N: its lane count.
abs
export function abs<V>(vector: V): V
Effects: none.
all
export function all<M>(mask: M): bool
Effects: none.
any
export function any<M>(mask: M): bool
Effects: none.
equal
export function equal<V, M>(first: V, second: V): M
Effects: none.
fromFixed
export function fromFixed<L, const N: int, V>(values: FixedArray<L, N>): V
Effects: none.
greater
export function greater<V, M>(first: V, second: V): M
Effects: none.
greaterOrEqual
export function greaterOrEqual<V, M>(first: V, second: V): M
Effects: none.
less
export function less<V, M>(first: V, second: V): M
Effects: none.
lessOrEqual
export function lessOrEqual<V, M>(first: V, second: V): M
Effects: none.
load
export function load<V, L>(items: Array<L>, start: int): Option<V>
Effects: none.
max
export function max<V>(first: V, second: V): V
Effects: none.
min
export function min<V>(first: V, second: V): V
Effects: none.
notEqual
export function notEqual<V, M>(first: V, second: V): M
Effects: none.
select
export function select<M, V>(mask: M, ifTrue: V, ifFalse: V): V
Effects: none.
shiftLeft
export function shiftLeft<V>(vector: V, count: int): V
Effects: none.
Details: count: a constant from 0 to the lane bits - 1, or a name checked against both ends.
shiftRight
export function shiftRight<V>(vector: V, count: int): V
Effects: none.
Details: count: a constant from 0 to the lane bits - 1, or a name checked against both ends.
shuffle
export function shuffle<V>(vector: V, lanes: Array<int>): V
Effects: none.
Details: lanes: a list literal of constants, one per lane.
splat
export function splat<V, L>(value: L): V
Effects: none.
store
export function store<V, L>(mutable items: Array<L>, start: int, vector: V): bool
Effects: none.
sum
export function sum<V, L>(vector: V): L
Effects: none.
toFixed
export function toFixed<V, L, const N: int>(vector: V): FixedArray<L, N>
Effects: none.
withLane
export function withLane<V, L>(vector: V, index: int, value: L): V
Effects: none.
Details: index: a constant or a name proven to be 0 to N - 1.