Narra

Reference

std/simd

std/simd

Vector types and operations on all their lanes at once.

narra
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

narra
export opaque struct I8x16

I16x8

narra
export opaque struct I16x8

I32x4

narra
export opaque struct I32x4

I64x2

narra
export opaque struct I64x2

I8x32

narra
export opaque struct I8x32

I16x16

narra
export opaque struct I16x16

I32x8

narra
export opaque struct I32x8

I64x4

narra
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

narra
export opaque struct U8x16

U16x8

narra
export opaque struct U16x8

U32x4

narra
export opaque struct U32x4

U64x2

narra
export opaque struct U64x2

U8x32

narra
export opaque struct U8x32

U16x16

narra
export opaque struct U16x16

U32x8

narra
export opaque struct U32x8

U64x4

narra
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

narra
export opaque struct F32x4

F64x2

narra
export opaque struct F64x2

F32x8

narra
export opaque struct F32x8

F64x4

narra
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

narra
export function abs<V>(vector: V): V

Effects: none.

all

narra
export function all<M>(mask: M): bool

Effects: none.

any

narra
export function any<M>(mask: M): bool

Effects: none.

equal

narra
export function equal<V, M>(first: V, second: V): M

Effects: none.

fromFixed

narra
export function fromFixed<L, const N: int, V>(values: FixedArray<L, N>): V

Effects: none.

greater

narra
export function greater<V, M>(first: V, second: V): M

Effects: none.

greaterOrEqual

narra
export function greaterOrEqual<V, M>(first: V, second: V): M

Effects: none.

less

narra
export function less<V, M>(first: V, second: V): M

Effects: none.

lessOrEqual

narra
export function lessOrEqual<V, M>(first: V, second: V): M

Effects: none.

load

narra
export function load<V, L>(items: Array<L>, start: int): Option<V>

Effects: none.

max

narra
export function max<V>(first: V, second: V): V

Effects: none.

min

narra
export function min<V>(first: V, second: V): V

Effects: none.

notEqual

narra
export function notEqual<V, M>(first: V, second: V): M

Effects: none.

select

narra
export function select<M, V>(mask: M, ifTrue: V, ifFalse: V): V

Effects: none.

shiftLeft

narra
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

narra
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

narra
export function shuffle<V>(vector: V, lanes: Array<int>): V

Effects: none.

Details: lanes: a list literal of constants, one per lane.

splat

narra
export function splat<V, L>(value: L): V

Effects: none.

store

narra
export function store<V, L>(mutable items: Array<L>, start: int, vector: V): bool

Effects: none.

sum

narra
export function sum<V, L>(vector: V): L

Effects: none.

toFixed

narra
export function toFixed<V, L, const N: int>(vector: V): FixedArray<L, N>

Effects: none.

withLane

narra
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.