/simd
Portable 128-bit SIMD vector types (F32x4, F64x2, I32x4, I64x2, U8x16) with lane-parallel arithmetic.
Functions & symbols#
F32x4#
Constructs a 4x32-bit floating-point 128-bit SIMD vector.
| Parameter | Type | Optional | Description |
|---|---|---|---|
lanes | Float | required | Four Float scalars, a single broadcast scalar, a Float-Array of length 4, or empty |
Any(use /simd)
(let v (F32x4 1.0 2.0 3.0 4.0))F64x2#
Constructs a 2x64-bit floating-point 128-bit SIMD vector.
| Parameter | Type | Optional | Description |
|---|---|---|---|
lanes | Float | required | Two Float scalars, a single broadcast scalar, a Float-Array of length 2, or empty |
Any(use /simd)
(let v (F64x2 1.5 2.5))I32x4#
Constructs a 4x32-bit signed integer 128-bit SIMD vector.
| Parameter | Type | Optional | Description |
|---|---|---|---|
lanes | Int | required | Four Int scalars, a broadcast scalar, an Int-Array of length 4, or empty |
AnyI64x2#
Constructs a 2x64-bit signed integer 128-bit SIMD vector.
| Parameter | Type | Optional | Description |
|---|---|---|---|
lanes | Int | required | Two Int scalars, a broadcast scalar, an Int-Array of length 2, or empty |
AnyU8x16#
Constructs a 16x8-bit unsigned byte 128-bit SIMD vector.
| Parameter | Type | Optional | Description |
|---|---|---|---|
lanes | U8 | required | Sixteen bytes, a single broadcast byte/int, or a 16-byte Slab/array |
Anyabs#
Computes lane-wise absolute values of `vec`.
| Parameter | Type | Optional | Description |
|---|---|---|---|
vec | F32x4 | F64x2 | I32x4 | required | SIMD vector |
Anyadd-float-arrays#
Adds two float arrays elementwise using SIMD vector instructions.
| Parameter | Type | Optional | Description |
|---|---|---|---|
a | Array Float | required | First float array |
b | Array Float | required | Second float array |
Anyall-true?#
Returns `true` if every lane in `mask` is active.
| Parameter | Type | Optional | Description |
|---|---|---|---|
mask | Simd-Mask | required | SIMD mask vector |
Anyany-true?#
Returns `true` if any lane in `mask` is active.
| Parameter | Type | Optional | Description |
|---|---|---|---|
mask | Simd-Mask | required | SIMD mask vector |
Anyclamp#
Clamps every lane of `v` into `[lo, hi]`.
| Parameter | Type | Optional | Description |
|---|---|---|---|
v | Simd-Vec | required | Input vector |
lo | Simd-Vec | Float | Int | required | Lower bound |
hi | Simd-Vec | Float | Int | required | Upper bound |
Anydot#
Computes the dot product of two SIMD vectors.
| Parameter | Type | Optional | Description |
|---|---|---|---|
a | Simd128 | required | First SIMD vector |
b | Simd128 | required | Second SIMD vector |
Anydot-float-arrays#
Computes the dot product of two float arrays using SIMD vector multiplication and accumulation.
| Parameter | Type | Optional | Description |
|---|---|---|---|
a | Array Float | required | First float array |
b | Array Float | required | Second float array |
Anydot-int-arrays#
Computes the integer dot product of two integer arrays.
| Parameter | Type | Optional | Description |
|---|---|---|---|
a | Array Int | required | First int array |
b | Array Int | required | Second int array |
Anyfast-inv#
Computes fast reciprocal `1.0 / x` across all lanes.
| Parameter | Type | Optional | Description |
|---|---|---|---|
vec | F32x4 | required | Float SIMD vector |
Anyfast-inv-sqrt#
Computes fast inverse square root `1.0 / sqrt(x)` across lanes.
| Parameter | Type | Optional | Description |
|---|---|---|---|
vec | F32x4 | required | Float SIMD vector |
Anyfma#
Computes fused multiply-add `(a * b) + c` across floating-point SIMD lanes.
| Parameter | Type | Optional | Description |
|---|---|---|---|
a | Simd128 | required | Multiplicand vector |
b | Simd128 | required | Multiplier vector |
c | Simd128 | required | Addend vector |
Anylane-at#
Extracts the scalar value at lane `idx` from a SIMD vector.
| Parameter | Type | Optional | Description |
|---|---|---|---|
vec | Simd128 | required | SIMD vector |
idx | Int | required | Zero-based lane index |
Anymax#
Computes lane-wise maximum across two SIMD vectors.
| Parameter | Type | Optional | Description |
|---|---|---|---|
a | Simd-Vec | required | First vector |
b | Simd-Vec | required | Second vector |
Anymin#
Computes lane-wise minimum across two SIMD vectors.
| Parameter | Type | Optional | Description |
|---|---|---|---|
a | Simd-Vec | required | First vector |
b | Simd-Vec | required | Second vector |
Anyproduct#
Multiplies all lanes of a SIMD vector together.
| Parameter | Type | Optional | Description |
|---|---|---|---|
vec | Simd128 | required | SIMD vector to multiply across lanes |
Anyreduce-max#
Returns the largest scalar lane value in `vec`.
| Parameter | Type | Optional | Description |
|---|---|---|---|
vec | Simd-Vec | required | Input SIMD vector |
Anyreduce-min#
Returns the smallest scalar lane value in `vec`.
| Parameter | Type | Optional | Description |
|---|---|---|---|
vec | Simd-Vec | required | Input SIMD vector |
Anyselect#
Branchless lane-wise blend selecting `on-true` where mask bits are set, else `on-false`.
| Parameter | Type | Optional | Description |
|---|---|---|---|
mask | Simd-Mask | required | Comparison mask vector |
on_true | Simd-Vec | required | True branch vector |
on_false | Simd-Vec | required | False branch vector |
Anysimd-eq#
Lane-wise equality comparison returning a SIMD mask vector.
| Parameter | Type | Optional | Description |
|---|---|---|---|
a | Simd-Vec | required | Left vector |
b | Simd-Vec | required | Right vector |
Anysimd-ge#
Lane-wise `>=` comparison returning a SIMD mask vector.
| Parameter | Type | Optional | Description |
|---|---|---|---|
a | Simd-Vec | required | Left vector |
b | Simd-Vec | required | Right vector |
Anysimd-gt#
Lane-wise `>` comparison returning a SIMD mask vector.
| Parameter | Type | Optional | Description |
|---|---|---|---|
a | Simd-Vec | required | Left vector |
b | Simd-Vec | required | Right vector |
Anysimd-le#
Lane-wise `<=` comparison returning a SIMD mask vector.
| Parameter | Type | Optional | Description |
|---|---|---|---|
a | Simd-Vec | required | Left vector |
b | Simd-Vec | required | Right vector |
Anysimd-lt#
Lane-wise `<` comparison returning a SIMD mask vector.
| Parameter | Type | Optional | Description |
|---|---|---|---|
a | Simd-Vec | required | Left vector |
b | Simd-Vec | required | Right vector |
Anysimd-ne#
Lane-wise inequality comparison returning a SIMD mask vector.
| Parameter | Type | Optional | Description |
|---|---|---|---|
a | Simd-Vec | required | Left vector |
b | Simd-Vec | required | Right vector |
Anysplat#
Broadcasts a scalar number into all lanes of the specified 128-bit SIMD vector type.
| Parameter | Type | Optional | Description |
|---|---|---|---|
type | Type | required | SIMD vector type (`F32x4`, `F64x2`, `I32x4`, `I64x2`, or `U8x16`) |
val | Number | required | Scalar value to broadcast across all lanes |
Any(use /simd)
(let v (splat F32x4 1.0))sqrt#
Computes hardware lane-wise square root.
| Parameter | Type | Optional | Description |
|---|---|---|---|
vec | F32x4 | F64x2 | required | Float SIMD vector |
Anysum#
Performs horizontal sum across all lanes of a SIMD vector.
| Parameter | Type | Optional | Description |
|---|---|---|---|
vec | Simd128 | required | SIMD vector to horizontally sum |
Anysum-float-array#
Sums all elements of a float array using SIMD vector accumulation.
| Parameter | Type | Optional | Description |
|---|---|---|---|
arr | Array Float | required | Float array or Float-Array buffer |
Any(use /simd)
(sum-float-array [1.0 2.0 3.0 4.0])sum-int-array#
Sums all elements of an integer array using 128-bit SIMD vector addition.
| Parameter | Type | Optional | Description |
|---|---|---|---|
arr | Array Int | required | Int array or Int-Array buffer |
Anyswizzle#
Permutes SIMD vector lanes according to `indices`.
| Parameter | Type | Optional | Description |
|---|---|---|---|
vec | Simd-Vec | required | Source vector |
indices | Array Int | required | Lane permutation indices |
Anyto-array#
Unpacks all SIMD lanes into a standard Tangu `Array`.
| Parameter | Type | Optional | Description |
|---|---|---|---|
vec | Simd-Vec | required | SIMD vector |
Anyto-bitmask#
Packs active mask lanes into a compact integer bitmask.
| Parameter | Type | Optional | Description |
|---|---|---|---|
mask | Simd-Mask | required | SIMD mask vector |
Anyto-float-array#
Extracts float SIMD lanes into an unboxed `Float-Array`.
| Parameter | Type | Optional | Description |
|---|---|---|---|
vec | F32x4 | F64x2 | required | Float SIMD vector |
Anywith-lane#
Returns a copy of `vec` with lane `idx` replaced by `val`.
| Parameter | Type | Optional | Description |
|---|---|---|---|
vec | Simd128 | required | Source SIMD vector |
idx | Int | required | Zero-based lane index to replace |
val | Number | required | Replacement scalar lane value |
Anyzero#
Creates a zero-initialized 128-bit SIMD vector of the given type.
| Parameter | Type | Optional | Description |
|---|---|---|---|
type | Type | required | SIMD vector type (`F32x4`, `F64x2`, `I32x4`, `I64x2`, or `U8x16`) |
Any