March Docs

Simd

Simd -- explicit 128-bit SIMD vector values (F32x4, F64x2, I32x4, I64x2, U8x16). Fixed width: identical semantics on every target, interpreted or compiled. See docs/simd-vectorization.md.

Boundary rule: lane get/set traffic in widened Int/Float; integer narrowing wraps mod 2^w two's-complement; f32 narrowing rounds to nearest-even; u8 loads zero-extend (0..255), i32 sign-extends. Integer lane arithmetic wraps. Float lanes are true single/double precision. min/max/hmin/hmax on floats use minNum/maxNum semantics (a NaN operand loses to the other; both NaN is NaN). sum accumulates sequentially (f32x4/f64x2 in double, i32x4/i64x2 in i64).

Lane order: lane 0 is the first make_* argument / lowest-addressed on load.

Mask convention: select/any/all/first_set all read a lane's HIGH BIT (its sign bit), matching hardware blend/movemask. eq/lt/gt still produce canonical all-ones/all-zero lanes, which read the same either way; a hand-rolled non-canonical mask lane follows the high-bit rule. A float mask's all-ones lane is a NaN bit pattern, so extracting it gives NaN; read float masks with any/all/first_set/select (or and_* them with a value vector) rather than by extracting lanes.

Op coverage: F32x4, F64x2, I32x4 and I64x2 have the full set (construct, lanes, load/store, compare, bitwise, mask, arithmetic, min/max, horizontal reductions; floats add div/fma/sqrt, integers add shl/shr). U8x16 has construct, lanes, load/store, compare (unsigned), bitwise and mask ops only.

Arrays: load/store work on NativeArray's flat arrays, one per lane type: F32x4 <-> NativeF32Arr, F64x2 <-> NativeFloatArr, I32x4 <-> NativeI32Arr, I64x2 <-> NativeIntArr, U8x16 <-> NativeU8Arr (see NativeArray.from_list_, NativeArray.make_, Bytes.to_u8_arr).

Inspecting a vector: vectors have no literal form, so the REPL shows them as an opaque value. Use extract_* for one lane, == (impl Eq compares lane values with Int/Float ==), or to_string (impl Show, e.g. "I32x4[1, 2, 3, 4]").

Functions

fnadd_f32x4add_f32x4(a, b) do simd_f32x4_add(a, b) end#

Per-lane addition, rounded to binary32.

Examples

march> Simd.add_f32x4(Simd.make_f32x4(1.0, 2.0, 3.0, 4.0), Simd.splat_f32x4(0.5)) == Simd.make_f32x4(1.5, 2.5, 3.5, 4.5)
true
march> Simd.extract_f32x4(Simd.add_f32x4(Simd.splat_f32x4(16777216.0), Simd.splat_f32x4(1.0)), 0) == 16777216.0
true
fnadd_f64x2add_f64x2(a, b) do simd_f64x2_add(a, b) end#

Per-lane addition (binary64; no narrowing).

Examples

march> Simd.extract_f64x2(Simd.add_f64x2(Simd.splat_f64x2(16777216.0), Simd.splat_f64x2(1.0)), 0) == 16777217.0
true
fnadd_i32x4add_i32x4(a, b) do simd_i32x4_add(a, b) end#

Per-lane addition, wrapping mod 2^32 (never panics on overflow).

Examples

march> Simd.add_i32x4(Simd.make_i32x4(1, 2, 3, 4), Simd.splat_i32x4(10)) == Simd.make_i32x4(11, 12, 13, 14)
true
march> Simd.extract_i32x4(Simd.add_i32x4(Simd.splat_i32x4(2147483647), Simd.splat_i32x4(1)), 0)
-2147483648
fnadd_i64x2add_i64x2(a, b) do simd_i64x2_add(a, b) end#

Per-lane addition, wrapping mod 2^64.

Examples

march> Simd.add_i64x2(Simd.make_i64x2(1, 2), Simd.make_i64x2(10, -20)) == Simd.make_i64x2(11, -18)
true
fnall_f32x4all_f32x4(v) do simd_f32x4_all(v) end#

True if every lane's high (sign) bit is set (interprets [v] as a mask).

Examples

march> Simd.all_f32x4(Simd.make_f32x4(-1.0, -2.0, -0.5, -3.0))
true
fnall_f64x2all_f64x2(v) do simd_f64x2_all(v) end#

True if every lane's high (sign) bit is set (interprets [v] as a mask).

Examples

march> Simd.all_f64x2(Simd.make_f64x2(-1.0, 1.0))
false
fnall_i32x4all_i32x4(v) do simd_i32x4_all(v) end#

True if every lane's high bit is set, i.e. every lane is negative (interprets [v] as a mask).

Examples

march> Simd.all_i32x4(Simd.make_i32x4(-1, -1, -1, 1))
false
fnall_i64x2all_i64x2(v) do simd_i64x2_all(v) end#

True if every lane's high bit is set, i.e. both lanes are negative (interprets [v] as a mask).

Examples

march> Simd.all_i64x2(Simd.make_i64x2(0, -1))
false
fnall_u8x16all_u8x16(v) do simd_u8x16_all(v) end#

True if every lane has bit 7 set, i.e. is >= 128 (interprets [v] as a mask).

Examples

march> Simd.all_u8x16(Simd.splat_u8x16(255))
true
fnand_f32x4and_f32x4(a, b) do simd_f32x4_and(a, b) end#

Per-lane bitwise AND of the lanes' binary32 bit patterns. ANDing a compare mask with a value vector keeps the value where the mask is set and gives 0.0 elsewhere.

Examples

march> Simd.and_f32x4(Simd.eq_f32x4(Simd.make_f32x4(1.0, 2.0, 3.0, 2.0), Simd.splat_f32x4(2.0)), Simd.splat_f32x4(5.0)) == Simd.make_f32x4(0.0, 5.0, 0.0, 5.0)
true
fnand_f64x2and_f64x2(a, b) do simd_f64x2_and(a, b) end#

Per-lane bitwise AND of the lanes' binary64 bit patterns.

Examples

march> Simd.and_f64x2(Simd.eq_f64x2(Simd.make_f64x2(1.0, 2.0), Simd.splat_f64x2(2.0)), Simd.splat_f64x2(9.5)) == Simd.make_f64x2(0.0, 9.5)
true
fnand_i32x4and_i32x4(a, b) do simd_i32x4_and(a, b) end#

Per-lane bitwise AND.

Examples

march> Simd.extract_i32x4(Simd.and_i32x4(Simd.splat_i32x4(12), Simd.splat_i32x4(10)), 0)
8
fnand_i64x2and_i64x2(a, b) do simd_i64x2_and(a, b) end#

Per-lane bitwise AND.

Examples

march> Simd.and_i64x2(Simd.make_i64x2(12, -1), Simd.splat_i64x2(10)) == Simd.make_i64x2(8, 10)
true
fnand_u8x16and_u8x16(a, b) do simd_u8x16_and(a, b) end#

Per-lane bitwise AND.

Examples

march> Simd.extract_u8x16(Simd.and_u8x16(Simd.splat_u8x16(12), Simd.splat_u8x16(10)), 0)
8
fnany_f32x4any_f32x4(v) do simd_f32x4_any(v) end#

True if any lane's high (sign) bit is set (interprets [v] as a mask). On a plain value vector that means "any lane is negative or -0.0".

Examples

march> Simd.any_f32x4(Simd.make_f32x4(1.0, 2.0, 0.5, 3.0))
false
march> Simd.any_f32x4(Simd.make_f32x4(1.0, 2.0, -0.0, 3.0))
true
fnany_f64x2any_f64x2(v) do simd_f64x2_any(v) end#

True if any lane's high (sign) bit is set (interprets [v] as a mask).

Examples

march> Simd.any_f64x2(Simd.make_f64x2(-0.0, 1.0))
true
fnany_i32x4any_i32x4(v) do simd_i32x4_any(v) end#

True if any lane's high bit is set, i.e. any lane is negative (interprets [v] as a mask).

Examples

march> Simd.any_i32x4(Simd.gt_i32x4(Simd.make_i32x4(1, 5, 2, 9), Simd.splat_i32x4(8)))
true
march> Simd.any_i32x4(Simd.make_i32x4(0, 1, 2, 3))
false
fnany_i64x2any_i64x2(v) do simd_i64x2_any(v) end#

True if any lane's high bit is set, i.e. any lane is negative (interprets [v] as a mask).

Examples

march> Simd.any_i64x2(Simd.make_i64x2(0, -1))
true
fnany_u8x16any_u8x16(v) do simd_u8x16_any(v) end#

True if any lane has bit 7 set, i.e. is >= 128 (interprets [v] as a mask).

Examples

march> Simd.any_u8x16(Simd.splat_u8x16(127))
false
march> Simd.any_u8x16(Simd.replace_u8x16(Simd.splat_u8x16(0), 9, 128))
true
fndiv_f32x4div_f32x4(a, b) do simd_f32x4_div(a, b) end#

Per-lane division [a] / [b], rounded to binary32. IEEE semantics: dividing by 0.0 gives an infinity (or NaN for 0.0 / 0.0), never a panic.

Examples

march> Simd.extract_f32x4(Simd.div_f32x4(Simd.make_f32x4(1.0, 2.0, 3.0, 5.0), Simd.splat_f32x4(2.0)), 3)
2.5
fndiv_f64x2div_f64x2(a, b) do simd_f64x2_div(a, b) end#

Per-lane division [a] / [b]. IEEE semantics: dividing by 0.0 gives an infinity (or NaN for 0.0 / 0.0), never a panic.

Examples

march> Simd.div_f64x2(Simd.make_f64x2(1.0, 3.0), Simd.splat_f64x2(2.0)) == Simd.make_f64x2(0.5, 1.5)
true
fneq_f32x4eq_f32x4(a, b) do simd_f32x4_eq(a, b) end#

Per-lane equality mask: all-ones lane where [a] == [b], zero otherwise. IEEE comparison: NaN is unequal to everything, 0.0 equals -0.0.

Examples

march> Simd.first_set_f32x4(Simd.eq_f32x4(Simd.make_f32x4(1.0, 2.0, 3.0, 2.0), Simd.splat_f32x4(2.0)))
1
fneq_f64x2eq_f64x2(a, b) do simd_f64x2_eq(a, b) end#

Per-lane equality mask: all-ones lane where [a] == [b], zero otherwise (IEEE: NaN is unequal to everything).

Examples

march> Simd.all_f64x2(Simd.eq_f64x2(Simd.make_f64x2(1.0, 2.0), Simd.make_f64x2(1.0, 2.0)))
true
fneq_i32x4eq_i32x4(a, b) do simd_i32x4_eq(a, b) end#

Per-lane equality mask: -1 (all ones) where [a] == [b], 0 otherwise.

Examples

march> Simd.eq_i32x4(Simd.make_i32x4(1, 2, 3, 4), Simd.make_i32x4(1, 0, 3, 0)) == Simd.make_i32x4(-1, 0, -1, 0)
true
fneq_i64x2eq_i64x2(a, b) do simd_i64x2_eq(a, b) end#

Per-lane equality mask: -1 (all ones) where [a] == [b], 0 otherwise.

Examples

march> Simd.eq_i64x2(Simd.make_i64x2(1, 2), Simd.make_i64x2(1, 3)) == Simd.make_i64x2(-1, 0)
true
fneq_u8x16eq_u8x16(a, b) do simd_u8x16_eq(a, b) end#

Per-lane equality mask: 255 where [a] == [b], 0 otherwise.

Examples

march> Simd.all_u8x16(Simd.eq_u8x16(Simd.splat_u8x16(7), Simd.make_u8x16(7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8)))
false
fnextract_f32x4extract_f32x4(v, i : {Int | 0 <= _ else "lane index must not be negative" && _ < 4 else "lane index must be less than 4"}) do simd_f32x4_extract(v, i) end#

Lane [i] (0-3), widened to Float exactly. The index is refinement-checked; an out-of-range index panics at run time if it gets past the checker.

Examples

march> (Simd.extract_f32x4(Simd.make_f32x4(1.0, 2.0, 3.0, 4.0), 3)) == 4.0
true
fnextract_f64x2extract_f64x2(v, i : {Int | 0 <= _ else "lane index must not be negative" && _ < 2 else "lane index must be less than 2"}) do simd_f64x2_extract(v, i) end#

Lane [i] (0-1). The index is refinement-checked; an out-of-range index panics at run time if it gets past the checker.

Examples

march> (Simd.extract_f64x2(Simd.make_f64x2(1.5, -2.0), 1)) == -2.0
true
fnextract_i32x4extract_i32x4(v, i : {Int | 0 <= _ else "lane index must not be negative" && _ < 4 else "lane index must be less than 4"}) do simd_i32x4_extract(v, i) end#

Lane [i] (0-3), sign-extended to Int. The index is refinement-checked; an out-of-range index panics at run time if it gets past the checker.

Examples

march> Simd.extract_i32x4(Simd.make_i32x4(10, 20, 30, 40), 2)
30
fnextract_i64x2extract_i64x2(v, i : {Int | 0 <= _ else "lane index must not be negative" && _ < 2 else "lane index must be less than 2"}) do simd_i64x2_extract(v, i) end#

Lane [i] (0-1) as an Int. The index is refinement-checked; an out-of-range index panics at run time if it gets past the checker.

Examples

march> Simd.extract_i64x2(Simd.make_i64x2(5, -6), 1)
-6
fnextract_u8x16extract_u8x16(v, i : {Int | 0 <= _ else "lane index must not be negative" && _ < 16 else "lane index must be less than 16"}) do simd_u8x16_extract(v, i) end#

Lane [i] (0-15) as an Int in 0..255. The index is refinement-checked; an out-of-range index panics at run time if it gets past the checker.

Examples

march> Simd.extract_u8x16(Simd.splat_u8x16(200), 15)
200
fnfirst_set_f32x4first_set_f32x4(v) do simd_f32x4_first_set(v) end#

Index (0-3) of the first lane whose high bit is set (interprets [v] as a mask), or -1 if none.

Examples

march> Simd.first_set_f32x4(Simd.splat_f32x4(1.0))
-1
fnfirst_set_f64x2first_set_f64x2(v) do simd_f64x2_first_set(v) end#

Index (0-1) of the first lane whose high bit is set (interprets [v] as a mask), or -1 if none.

Examples

march> Simd.first_set_f64x2(Simd.splat_f64x2(0.0))
-1
fnfirst_set_i32x4first_set_i32x4(v) do simd_i32x4_first_set(v) end#

Index (0-3) of the first lane whose high bit is set (interprets [v] as a mask), or -1 if none. Combined with a compare, finds the first match.

Examples

march> Simd.first_set_i32x4(Simd.gt_i32x4(Simd.make_i32x4(1, 5, 2, 9), Simd.splat_i32x4(4)))
1
march> Simd.first_set_i32x4(Simd.splat_i32x4(0))
-1
fnfirst_set_i64x2first_set_i64x2(v) do simd_i64x2_first_set(v) end#

Index (0-1) of the first lane whose high bit is set (interprets [v] as a mask), or -1 if none.

Examples

march> Simd.first_set_i64x2(Simd.lt_i64x2(Simd.make_i64x2(4, -9), Simd.splat_i64x2(0)))
1
fnfirst_set_u8x16first_set_u8x16(v) do simd_u8x16_first_set(v) end#

Index (0-15) of the first lane with bit 7 set (interprets [v] as a mask), or -1 if none.

Examples

march> Simd.first_set_u8x16(Simd.splat_u8x16(0))
-1
fnfma_f32x4fma_f32x4(a, b, c) do simd_f32x4_fma(a, b, c) end#

Per-lane fused multiply-add [a] * [b] + [c] with a single binary32 rounding (bit-identical to hardware fmaf on both backends).

Examples

march> (Simd.extract_f32x4(Simd.fma_f32x4(Simd.splat_f32x4(2.0), Simd.splat_f32x4(3.0), Simd.splat_f32x4(1.0)), 0)) == 7.0
true
fnfma_f64x2fma_f64x2(a, b, c) do simd_f64x2_fma(a, b, c) end#

Per-lane fused multiply-add [a] * [b] + [c] with a single binary64 rounding.

Examples

march> Simd.fma_f64x2(Simd.splat_f64x2(2.0), Simd.make_f64x2(3.0, 0.5), Simd.splat_f64x2(1.0)) == Simd.make_f64x2(7.0, 2.0)
true
fngt_f32x4gt_f32x4(a, b) do simd_f32x4_gt(a, b) end#

Per-lane greater-than mask: all-ones lane where [a] > [b], zero otherwise (false for a NaN lane).

Examples

march> Simd.all_f32x4(Simd.gt_f32x4(Simd.make_f32x4(5.0, 6.0, 7.0, 1.0), Simd.splat_f32x4(4.0)))
false
fngt_f64x2gt_f64x2(a, b) do simd_f64x2_gt(a, b) end#

Per-lane greater-than mask: all-ones lane where [a] > [b], zero otherwise.

Examples

march> Simd.first_set_f64x2(Simd.gt_f64x2(Simd.make_f64x2(1.0, 5.0), Simd.splat_f64x2(2.0)))
1
fngt_i32x4gt_i32x4(a, b) do simd_i32x4_gt(a, b) end#

Per-lane signed greater-than mask: -1 where [a] > [b], 0 otherwise.

Examples

march> Simd.gt_i32x4(Simd.make_i32x4(1, 5, -2, 9), Simd.splat_i32x4(4)) == Simd.make_i32x4(0, -1, 0, -1)
true
fngt_i64x2gt_i64x2(a, b) do simd_i64x2_gt(a, b) end#

Per-lane signed greater-than mask: -1 where [a] > [b], 0 otherwise.

Examples

march> Simd.gt_i64x2(Simd.make_i64x2(4, -9), Simd.splat_i64x2(0)) == Simd.make_i64x2(-1, 0)
true
fngt_u8x16gt_u8x16(a, b) do simd_u8x16_gt(a, b) end#

Per-lane UNSIGNED greater-than mask: 255 where [a] > [b], 0 otherwise.

Examples

march> Simd.first_set_u8x16(Simd.gt_u8x16(Simd.make_u8x16(0, 0, 0, 200, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9), Simd.splat_u8x16(100)))
3
fnhmax_f32x4hmax_f32x4(v) do simd_f32x4_hmax(v) end#

Horizontal maximum of all lanes (maxNum: a NaN lane is skipped unless every lane is NaN).

Examples

march> Simd.hmax_f32x4(Simd.make_f32x4(1.0, 7.5, -2.0, 3.0))
7.5
fnhmax_f64x2hmax_f64x2(v) do simd_f64x2_hmax(v) end#

Horizontal maximum of both lanes (maxNum: a NaN lane is skipped unless both lanes are NaN).

Examples

march> Simd.hmax_f64x2(Simd.make_f64x2(-1.5, -2.5))
-1.5
fnhmax_i32x4hmax_i32x4(v) do simd_i32x4_hmax(v) end#

Horizontal signed maximum of all lanes.

Examples

march> Simd.hmax_i32x4(Simd.make_i32x4(3, -2, 7, 0))
7
fnhmax_i64x2hmax_i64x2(v) do simd_i64x2_hmax(v) end#

Horizontal signed maximum of both lanes.

Examples

march> Simd.hmax_i64x2(Simd.make_i64x2(4, -9))
4
fnhmin_f32x4hmin_f32x4(v) do simd_f32x4_hmin(v) end#

Horizontal minimum of all lanes (minNum: a NaN lane is skipped unless every lane is NaN).

Examples

march> (Simd.hmin_f32x4(Simd.make_f32x4(1.0, 7.5, -2.0, 3.0))) == -2.0
true
fnhmin_f64x2hmin_f64x2(v) do simd_f64x2_hmin(v) end#

Horizontal minimum of both lanes (minNum: a NaN lane is skipped unless both lanes are NaN).

Examples

march> Simd.hmin_f64x2(Simd.make_f64x2(-1.5, -2.5))
-2.5
fnhmin_i32x4hmin_i32x4(v) do simd_i32x4_hmin(v) end#

Horizontal signed minimum of all lanes.

Examples

march> Simd.hmin_i32x4(Simd.make_i32x4(3, -2, 7, 0))
-2
fnhmin_i64x2hmin_i64x2(v) do simd_i64x2_hmin(v) end#

Horizontal signed minimum of both lanes.

Examples

march> Simd.hmin_i64x2(Simd.make_i64x2(4, -9))
-9
fnload_f32x4load_f32x4(arr, i : Int) do simd_f32x4_load(arr, i) end#

Load 4 lanes from the NativeF32Arr [arr], elements [i] to [i] + 3. Panics unless 0 <= [i] and [i] + 4 <= length.

Examples

march> (Simd.extract_f32x4(Simd.load_f32x4(NativeArray.from_list_f32([1.0, 2.0, 3.0, 4.0, 5.0]), 1), 3)) == 5.0
true
fnload_f64x2load_f64x2(arr, i : Int) do simd_f64x2_load(arr, i) end#

Load 2 lanes from the NativeFloatArr [arr], elements [i] and [i] + 1. Panics unless 0 <= [i] and [i] + 2 <= length.

Examples

march> Simd.load_f64x2(NativeArray.from_list_float([1.0, 2.0, 3.0]), 1) == Simd.make_f64x2(2.0, 3.0)
true
fnload_i32x4load_i32x4(arr, i : Int) do simd_i32x4_load(arr, i) end#

Load 4 lanes from the NativeI32Arr [arr], elements [i] to [i] + 3. Panics unless 0 <= [i] and [i] + 4 <= length.

Examples

march> Simd.load_i32x4(NativeArray.from_list_i32([1, 2, 3, 4, 5]), 1) == Simd.make_i32x4(2, 3, 4, 5)
true
fnload_i64x2load_i64x2(arr, i : Int) do simd_i64x2_load(arr, i) end#

Load 2 lanes from the NativeIntArr [arr], elements [i] and [i] + 1. Panics unless 0 <= [i] and [i] + 2 <= length.

Examples

march> Simd.load_i64x2(NativeArray.from_list_int([5, 6, 7]), 1) == Simd.make_i64x2(6, 7)
true
fnload_u8x16load_u8x16(arr, i : Int) do simd_u8x16_load(arr, i) end#

Load 16 lanes from the NativeU8Arr [arr], elements [i] to [i] + 15. Panics unless 0 <= [i] and [i] + 16 <= length. Bytes.to_u8_arr turns a Bytes value into a NativeU8Arr, which makes byte scanning straightforward:

Examples

march> let chunk = Simd.load_u8x16(Bytes.to_u8_arr(Bytes.from_string("hello, world! ok")), 0)
march> Simd.first_set_u8x16(Simd.eq_u8x16(chunk, Simd.splat_u8x16(44)))
5
fnlt_f32x4lt_f32x4(a, b) do simd_f32x4_lt(a, b) end#

Per-lane less-than mask: all-ones lane where [a] < [b], zero otherwise (false for a NaN lane).

Examples

march> Simd.first_set_f32x4(Simd.lt_f32x4(Simd.make_f32x4(4.0, 3.0, 1.0, 0.0), Simd.splat_f32x4(2.0)))
2
fnlt_f64x2lt_f64x2(a, b) do simd_f64x2_lt(a, b) end#

Per-lane less-than mask: all-ones lane where [a] < [b], zero otherwise.

Examples

march> Simd.first_set_f64x2(Simd.lt_f64x2(Simd.make_f64x2(3.0, 1.0), Simd.splat_f64x2(2.0)))
1
fnlt_i32x4lt_i32x4(a, b) do simd_i32x4_lt(a, b) end#

Per-lane signed less-than mask: -1 where [a] < [b], 0 otherwise.

Examples

march> Simd.lt_i32x4(Simd.make_i32x4(1, 5, -2, 9), Simd.splat_i32x4(4)) == Simd.make_i32x4(-1, 0, -1, 0)
true
fnlt_i64x2lt_i64x2(a, b) do simd_i64x2_lt(a, b) end#

Per-lane signed less-than mask: -1 where [a] < [b], 0 otherwise.

Examples

march> Simd.lt_i64x2(Simd.make_i64x2(4, -9), Simd.splat_i64x2(0)) == Simd.make_i64x2(0, -1)
true
fnlt_u8x16lt_u8x16(a, b) do simd_u8x16_lt(a, b) end#

Per-lane UNSIGNED less-than mask: 255 where [a] < [b], 0 otherwise.

Examples

march> Simd.extract_u8x16(Simd.lt_u8x16(Simd.splat_u8x16(1), Simd.splat_u8x16(200)), 0)
255
fnmake_f32x4make_f32x4(v0 : Float, v1 : Float, v2 : Float, v3 : Float) do simd_f32x4_make(v0, v1, v2, v3) end#

Vector with lane 0 = the first argument, ..., lane 3 = the last. Each value is rounded to binary32, so a lane need not read back as the Float passed in.

Examples

march> Simd.extract_f32x4(Simd.make_f32x4(1.0, 2.5, -3.0, 0.25), 1)
2.5
march> Simd.extract_f32x4(Simd.make_f32x4(0.1, 0.0, 0.0, 0.0), 0) == 0.1
false
fnmake_f64x2make_f64x2(v0 : Float, v1 : Float) do simd_f64x2_make(v0, v1) end#

Vector with lane 0 = [v0] and lane 1 = [v1] (exact; no rounding).

Examples

march> Simd.extract_f64x2(Simd.make_f64x2(0.1, 2.0), 0) == 0.1
true
fnmake_i32x4make_i32x4(v0 : Int, v1 : Int, v2 : Int, v3 : Int) do simd_i32x4_make(v0, v1, v2, v3) end#

Vector with lane 0 = the first argument, ..., lane 3 = the last. Each value is wrapped to 32 bits (two's complement).

Examples

march> Simd.make_i32x4(1, -2, 3, 2147483647) == Simd.make_i32x4(1, -2, 3, 2147483647)
true
fnmake_i64x2make_i64x2(v0 : Int, v1 : Int) do simd_i64x2_make(v0, v1) end#

Vector with lane 0 = [v0] and lane 1 = [v1].

Examples

march> Simd.make_i64x2(5, -6) == Simd.make_i64x2(5, -6)
true
fnmake_u8x16make_u8x16(v0 : Int, v1 : Int, v2 : Int, v3 : Int, v4 : Int, v5 : Int, v6 : Int, v7 : Int, v8 : Int, v9 : Int, v10 : Int, v11 : Int, v12 : Int, v13 : Int, v14 : Int, v15 : Int) do simd_u8x16_make(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) end#

Vector with lane 0 = the first argument, ..., lane 15 = the last, each taken mod 256.

Examples

march> Simd.extract_u8x16(Simd.make_u8x16(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15), 15)
15
march> Simd.extract_u8x16(Simd.make_u8x16(-1, 256, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), 0)
255
fnmax_f32x4max_f32x4(a, b) do simd_f32x4_max(a, b) end#

Per-lane maximum (maxNum: a NaN lane yields the other operand; both NaN yields NaN).

Examples

march> Simd.max_f32x4(Simd.make_f32x4(1.0, 5.0, 2.0, 9.0), Simd.splat_f32x4(3.0)) == Simd.make_f32x4(3.0, 5.0, 3.0, 9.0)
true
fnmax_f64x2max_f64x2(a, b) do simd_f64x2_max(a, b) end#

Per-lane maximum (maxNum: a NaN lane yields the other operand; both NaN yields NaN).

Examples

march> Simd.max_f64x2(Simd.make_f64x2(1.0, 5.0), Simd.splat_f64x2(2.0)) == Simd.make_f64x2(2.0, 5.0)
true
fnmax_i32x4max_i32x4(a, b) do simd_i32x4_max(a, b) end#

Per-lane signed maximum.

Examples

march> Simd.max_i32x4(Simd.make_i32x4(1, 5, -2, 9), Simd.splat_i32x4(3)) == Simd.make_i32x4(3, 5, 3, 9)
true
fnmax_i64x2max_i64x2(a, b) do simd_i64x2_max(a, b) end#

Per-lane signed maximum.

Examples

march> Simd.max_i64x2(Simd.make_i64x2(4, -9), Simd.splat_i64x2(1)) == Simd.make_i64x2(4, 1)
true
fnmin_f32x4min_f32x4(a, b) do simd_f32x4_min(a, b) end#

Per-lane minimum (minNum: a NaN lane yields the other operand; both NaN yields NaN).

Examples

march> Simd.min_f32x4(Simd.make_f32x4(1.0, 5.0, 2.0, 9.0), Simd.splat_f32x4(3.0)) == Simd.make_f32x4(1.0, 3.0, 2.0, 3.0)
true
fnmin_f64x2min_f64x2(a, b) do simd_f64x2_min(a, b) end#

Per-lane minimum (minNum: a NaN lane yields the other operand; both NaN yields NaN).

Examples

march> Simd.min_f64x2(Simd.make_f64x2(1.0, 5.0), Simd.splat_f64x2(2.0)) == Simd.make_f64x2(1.0, 2.0)
true
fnmin_i32x4min_i32x4(a, b) do simd_i32x4_min(a, b) end#

Per-lane signed minimum.

Examples

march> Simd.min_i32x4(Simd.make_i32x4(1, 5, -2, 9), Simd.splat_i32x4(3)) == Simd.make_i32x4(1, 3, -2, 3)
true
fnmin_i64x2min_i64x2(a, b) do simd_i64x2_min(a, b) end#

Per-lane signed minimum.

Examples

march> Simd.min_i64x2(Simd.make_i64x2(4, -9), Simd.splat_i64x2(1)) == Simd.make_i64x2(1, -9)
true
fnmul_f32x4mul_f32x4(a, b) do simd_f32x4_mul(a, b) end#

Per-lane multiplication, rounded to binary32.

Examples

march> (Simd.extract_f32x4(Simd.mul_f32x4(Simd.splat_f32x4(1.5), Simd.splat_f32x4(4.0)), 0)) == 6.0
true
fnmul_f64x2mul_f64x2(a, b) do simd_f64x2_mul(a, b) end#

Per-lane multiplication.

Examples

march> Simd.mul_f64x2(Simd.make_f64x2(1.5, 2.0), Simd.splat_f64x2(4.0)) == Simd.make_f64x2(6.0, 8.0)
true
fnmul_i32x4mul_i32x4(a, b) do simd_i32x4_mul(a, b) end#

Per-lane multiplication, keeping the low 32 bits of each product (wraps mod 2^32).

Examples

march> Simd.mul_i32x4(Simd.make_i32x4(1, -2, 3, 4), Simd.splat_i32x4(3)) == Simd.make_i32x4(3, -6, 9, 12)
true
fnmul_i64x2mul_i64x2(a, b) do simd_i64x2_mul(a, b) end#

Per-lane multiplication, keeping the low 64 bits of each product.

Examples

march> Simd.mul_i64x2(Simd.make_i64x2(4, -9), Simd.splat_i64x2(3)) == Simd.make_i64x2(12, -27)
true
fnnot_f32x4not_f32x4(v) do simd_f32x4_not(v) end#

Per-lane bitwise complement of the binary32 bit pattern; inverts a mask.

Examples

march> Simd.all_f32x4(Simd.not_f32x4(Simd.splat_f32x4(0.0)))
true
fnnot_f64x2not_f64x2(v) do simd_f64x2_not(v) end#

Per-lane bitwise complement of the binary64 bit pattern; inverts a mask.

Examples

march> Simd.any_f64x2(Simd.not_f64x2(Simd.eq_f64x2(Simd.splat_f64x2(1.0), Simd.splat_f64x2(1.0))))
false
fnnot_i32x4not_i32x4(v) do simd_i32x4_not(v) end#

Per-lane bitwise complement (-1 - x); inverts a mask.

Examples

march> Simd.not_i32x4(Simd.make_i32x4(0, -1, 5, -6)) == Simd.make_i32x4(-1, 0, -6, 5)
true
fnnot_i64x2not_i64x2(v) do simd_i64x2_not(v) end#

Per-lane bitwise complement (-1 - x); inverts a mask.

Examples

march> Simd.not_i64x2(Simd.make_i64x2(0, 5)) == Simd.make_i64x2(-1, -6)
true
fnnot_u8x16not_u8x16(v) do simd_u8x16_not(v) end#

Per-lane bitwise complement within 8 bits (255 - x); inverts a mask.

Examples

march> Simd.extract_u8x16(Simd.not_u8x16(Simd.splat_u8x16(15)), 0)
240
fnor_f32x4or_f32x4(a, b) do simd_f32x4_or(a, b) end#

Per-lane bitwise OR of the lanes' binary32 bit patterns (ORing in -0.0 sets the sign bit).

Examples

march> (Simd.extract_f32x4(Simd.or_f32x4(Simd.splat_f32x4(2.0), Simd.splat_f32x4(-0.0)), 0)) == -2.0
true
fnor_f64x2or_f64x2(a, b) do simd_f64x2_or(a, b) end#

Per-lane bitwise OR of the lanes' binary64 bit patterns.

Examples

march> Simd.extract_f64x2(Simd.or_f64x2(Simd.splat_f64x2(1.5), Simd.splat_f64x2(-0.0)), 0)
-1.5
fnor_i32x4or_i32x4(a, b) do simd_i32x4_or(a, b) end#

Per-lane bitwise OR.

Examples

march> Simd.extract_i32x4(Simd.or_i32x4(Simd.splat_i32x4(12), Simd.splat_i32x4(10)), 0)
14
fnor_i64x2or_i64x2(a, b) do simd_i64x2_or(a, b) end#

Per-lane bitwise OR.

Examples

march> Simd.or_i64x2(Simd.make_i64x2(12, 0), Simd.splat_i64x2(10)) == Simd.make_i64x2(14, 10)
true
fnor_u8x16or_u8x16(a, b) do simd_u8x16_or(a, b) end#

Per-lane bitwise OR.

Examples

march> Simd.extract_u8x16(Simd.or_u8x16(Simd.splat_u8x16(12), Simd.splat_u8x16(10)), 0)
14
fnreplace_f32x4replace_f32x4(v, i : {Int | 0 <= _ else "lane index must not be negative" && _ < 4 else "lane index must be less than 4"}, x : Float) do simd_f32x4_replace(v, i, x) end#

A copy of [v] with lane [i] (0-3) set to [x], rounded to binary32. [v] is unchanged.

Examples

march> Simd.replace_f32x4(Simd.splat_f32x4(0.0), 3, 2.5) == Simd.make_f32x4(0.0, 0.0, 0.0, 2.5)
true
fnreplace_f64x2replace_f64x2(v, i : {Int | 0 <= _ else "lane index must not be negative" && _ < 2 else "lane index must be less than 2"}, x : Float) do simd_f64x2_replace(v, i, x) end#

A copy of [v] with lane [i] (0-1) set to [x].

Examples

march> Simd.extract_f64x2(Simd.replace_f64x2(Simd.splat_f64x2(0.0), 1, 2.5), 1)
2.5
fnreplace_i32x4replace_i32x4(v, i : {Int | 0 <= _ else "lane index must not be negative" && _ < 4 else "lane index must be less than 4"}, x : Int) do simd_i32x4_replace(v, i, x) end#

A copy of [v] with lane [i] (0-3) set to [x], wrapped to 32 bits.

Examples

march> Simd.replace_i32x4(Simd.splat_i32x4(0), 2, 7) == Simd.make_i32x4(0, 0, 7, 0)
true
fnreplace_i64x2replace_i64x2(v, i : {Int | 0 <= _ else "lane index must not be negative" && _ < 2 else "lane index must be less than 2"}, x : Int) do simd_i64x2_replace(v, i, x) end#

A copy of [v] with lane [i] (0-1) set to [x].

Examples

march> Simd.replace_i64x2(Simd.splat_i64x2(0), 1, 42) == Simd.make_i64x2(0, 42)
true
fnreplace_u8x16replace_u8x16(v, i : {Int | 0 <= _ else "lane index must not be negative" && _ < 16 else "lane index must be less than 16"}, x : Int) do simd_u8x16_replace(v, i, x) end#

A copy of [v] with lane [i] (0-15) set to [x] mod 256.

Examples

march> Simd.extract_u8x16(Simd.replace_u8x16(Simd.splat_u8x16(0), 15, 257), 15)
1
fnselect_f32x4select_f32x4(mask, a, b) do simd_f32x4_select(mask, a, b) end#

Per-lane blend: where [mask]'s lane has its high (sign) bit set take [a]'s lane, else [b]'s lane.

Examples

march> let xs = Simd.make_f32x4(1.0, 5.0, 2.0, 9.0)
march> Simd.select_f32x4(Simd.gt_f32x4(xs, Simd.splat_f32x4(4.0)), Simd.splat_f32x4(4.0), xs) == Simd.make_f32x4(1.0, 4.0, 2.0, 4.0)
true
fnselect_f64x2select_f64x2(mask, a, b) do simd_f64x2_select(mask, a, b) end#

Per-lane blend: where [mask]'s lane has its high (sign) bit set take [a]'s lane, else [b]'s lane.

Examples

march> Simd.select_f64x2(Simd.lt_f64x2(Simd.make_f64x2(1.0, 5.0), Simd.splat_f64x2(2.0)), Simd.splat_f64x2(0.0), Simd.make_f64x2(1.0, 5.0)) == Simd.make_f64x2(0.0, 5.0)
true
fnselect_i32x4select_i32x4(mask, a, b) do simd_i32x4_select(mask, a, b) end#

Per-lane blend: where [mask]'s lane is negative (high bit set) take [a]'s lane, else [b]'s lane.

Examples

march> let xs = Simd.make_i32x4(1, 5, 2, 9)
march> Simd.select_i32x4(Simd.lt_i32x4(xs, Simd.splat_i32x4(4)), Simd.splat_i32x4(0), xs) == Simd.make_i32x4(0, 5, 0, 9)
true
fnselect_i64x2select_i64x2(mask, a, b) do simd_i64x2_select(mask, a, b) end#

Per-lane blend: where [mask]'s lane is negative (high bit set) take [a]'s lane, else [b]'s lane.

Examples

march> Simd.select_i64x2(Simd.make_i64x2(-1, 0), Simd.splat_i64x2(1), Simd.splat_i64x2(2)) == Simd.make_i64x2(1, 2)
true
fnselect_u8x16select_u8x16(mask, a, b) do simd_u8x16_select(mask, a, b) end#

Per-lane blend: where [mask]'s lane has bit 7 set (>= 128) take [a]'s lane, else [b]'s lane.

Examples

march> Simd.extract_u8x16(Simd.select_u8x16(Simd.splat_u8x16(128), Simd.splat_u8x16(1), Simd.splat_u8x16(2)), 0)
1
march> Simd.extract_u8x16(Simd.select_u8x16(Simd.splat_u8x16(127), Simd.splat_u8x16(1), Simd.splat_u8x16(2)), 0)
2
fnshl_i32x4shl_i32x4(v, n : Int) do simd_i32x4_shl(v, n) end#

Per-lane shift left by [n] mod 32 (the count is masked to its low 5 bits, so a negative or oversized count never panics); bits shifted out of the lane are lost.

Examples

march> Simd.shl_i32x4(Simd.make_i32x4(1, 3, -1, 0), 4) == Simd.make_i32x4(16, 48, -16, 0)
true
march> Simd.extract_i32x4(Simd.shl_i32x4(Simd.splat_i32x4(1), 33), 0)
2
fnshl_i64x2shl_i64x2(v, n : Int) do simd_i64x2_shl(v, n) end#

Per-lane shift left by [n] mod 64 (the count is masked to its low 6 bits); bits shifted out of the lane are lost.

Examples

march> Simd.shl_i64x2(Simd.make_i64x2(3, -1), 4) == Simd.make_i64x2(48, -16)
true
march> Simd.extract_i64x2(Simd.shl_i64x2(Simd.splat_i64x2(1), 65), 0)
2
fnshr_i32x4shr_i32x4(v, n : Int) do simd_i32x4_shr(v, n) end#

Per-lane arithmetic (sign-extending) shift right by [n] mod 32 (the count is masked to its low 5 bits).

Examples

march> Simd.shr_i32x4(Simd.make_i32x4(16, -8, -1, 7), 1) == Simd.make_i32x4(8, -4, -1, 3)
true
fnshr_i64x2shr_i64x2(v, n : Int) do simd_i64x2_shr(v, n) end#

Per-lane arithmetic (sign-extending) shift right by [n] mod 64 (the count is masked to its low 6 bits).

Examples

march> Simd.shr_i64x2(Simd.make_i64x2(-16, 16), 2) == Simd.make_i64x2(-4, 4)
true
fnsplat_f32x4splat_f32x4(v : Float) do simd_f32x4_splat(v) end#

All four lanes set to [v], rounded to binary32 (nearest-even).

Examples

march> Simd.splat_f32x4(1.5) == Simd.make_f32x4(1.5, 1.5, 1.5, 1.5)
true
march> Simd.extract_f32x4(Simd.splat_f32x4(16777217.0), 0) == 16777216.0
true
fnsplat_f64x2splat_f64x2(v : Float) do simd_f64x2_splat(v) end#

Both lanes set to [v].

Examples

march> Simd.splat_f64x2(2.5) == Simd.make_f64x2(2.5, 2.5)
true
fnsplat_i32x4splat_i32x4(v : Int) do simd_i32x4_splat(v) end#

All four lanes set to [v], wrapped to 32 bits (two's complement).

Examples

march> Simd.splat_i32x4(7) == Simd.make_i32x4(7, 7, 7, 7)
true
fnsplat_i64x2splat_i64x2(v : Int) do simd_i64x2_splat(v) end#

Both lanes set to [v].

Examples

march> Simd.splat_i64x2(-3) == Simd.make_i64x2(-3, -3)
true
fnsplat_u8x16splat_u8x16(v : Int) do simd_u8x16_splat(v) end#

All sixteen lanes set to [v] mod 256 (so 300 becomes 44 and -1 becomes 255).

Examples

march> Simd.splat_u8x16(300) == Simd.make_u8x16(44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44)
true
march> Simd.extract_u8x16(Simd.splat_u8x16(-1), 0)
255
fnsqrt_f32x4sqrt_f32x4(v) do simd_f32x4_sqrt(v) end#

Per-lane square root, rounded to binary32 (NaN for a negative lane).

Examples

march> (Simd.extract_f32x4(Simd.sqrt_f32x4(Simd.make_f32x4(9.0, 2.0, 4.0, 1.0)), 0)) == 3.0
true
fnsqrt_f64x2sqrt_f64x2(v) do simd_f64x2_sqrt(v) end#

Per-lane square root (NaN for a negative lane).

Examples

march> (Simd.extract_f64x2(Simd.sqrt_f64x2(Simd.make_f64x2(16.0, 2.0)), 0)) == 4.0
true
fnstore_f32x4store_f32x4(arr, i : Int, v) do simd_f32x4_store(arr, i, v) end#

Store [v]'s 4 lanes into the NativeF32Arr [arr] at elements [i] to [i] + 3, returning the updated array. Panics unless 0 <= [i] and [i] + 4 <= length.

Examples

march> NativeArray.to_list_f32(Simd.store_f32x4(NativeArray.make_f32(5, 0.5), 1, Simd.splat_f32x4(1.5)))
[0.5, 1.5, 1.5, 1.5, 1.5]
fnstore_f64x2store_f64x2(arr, i : Int, v) do simd_f64x2_store(arr, i, v) end#

Store [v]'s 2 lanes into the NativeFloatArr [arr] at elements [i] and [i] + 1, returning the updated array. Panics unless 0 <= [i] and [i] + 2 <= length.

Examples

march> NativeArray.to_list_float(Simd.store_f64x2(NativeArray.make_float(3, 0.5), 1, Simd.make_f64x2(1.5, 2.5)))
[0.5, 1.5, 2.5]
fnstore_i32x4store_i32x4(arr, i : Int, v) do simd_i32x4_store(arr, i, v) end#

Store [v]'s 4 lanes into the NativeI32Arr [arr] at elements [i] to [i] + 3, returning the updated array. Panics unless 0 <= [i] and [i] + 4 <= length.

Examples

march> NativeArray.to_list_i32(Simd.store_i32x4(NativeArray.make_i32(6, 0), 2, Simd.make_i32x4(1, 2, 3, 4)))
[0, 0, 1, 2, 3, 4]
fnstore_i64x2store_i64x2(arr, i : Int, v) do simd_i64x2_store(arr, i, v) end#

Store [v]'s 2 lanes into the NativeIntArr [arr] at elements [i] and [i] + 1, returning the updated array. Panics unless 0 <= [i] and [i] + 2 <= length.

Examples

march> NativeArray.to_list_int(Simd.store_i64x2(NativeArray.make_int(3, 0), 1, Simd.make_i64x2(8, 9)))
[0, 8, 9]
fnstore_u8x16store_u8x16(arr, i : Int, v) do simd_u8x16_store(arr, i, v) end#

Store [v]'s 16 lanes into the NativeU8Arr [arr] at elements [i] to [i] + 15, returning the updated array. Panics unless 0 <= [i] and [i] + 16 <= length.

Examples

march> List.take(NativeArray.to_list_u8(Simd.store_u8x16(NativeArray.make_u8(18, 0), 2, Simd.splat_u8x16(255))), 4)
[0, 0, 255, 255]
fnsub_f32x4sub_f32x4(a, b) do simd_f32x4_sub(a, b) end#

Per-lane subtraction [a] - [b], rounded to binary32.

Examples

march> Simd.extract_f32x4(Simd.sub_f32x4(Simd.splat_f32x4(1.0), Simd.splat_f32x4(0.25)), 0)
0.75
fnsub_f64x2sub_f64x2(a, b) do simd_f64x2_sub(a, b) end#

Per-lane subtraction [a] - [b].

Examples

march> Simd.sub_f64x2(Simd.make_f64x2(1.5, 2.0), Simd.splat_f64x2(4.0)) == Simd.make_f64x2(-2.5, -2.0)
true
fnsub_i32x4sub_i32x4(a, b) do simd_i32x4_sub(a, b) end#

Per-lane subtraction [a] - [b], wrapping mod 2^32.

Examples

march> Simd.sub_i32x4(Simd.make_i32x4(10, 0, -5, 3), Simd.splat_i32x4(3)) == Simd.make_i32x4(7, -3, -8, 0)
true
fnsub_i64x2sub_i64x2(a, b) do simd_i64x2_sub(a, b) end#

Per-lane subtraction [a] - [b], wrapping mod 2^64.

Examples

march> Simd.sub_i64x2(Simd.make_i64x2(4, -9), Simd.splat_i64x2(3)) == Simd.make_i64x2(1, -12)
true
fnsum_f32x4sum_f32x4(v) do simd_f32x4_sum(v) end#

Horizontal sum of all lanes, accumulated sequentially (lane 0 first) in double, so the result is not rounded back to binary32.

Examples

march> Simd.sum_f32x4(Simd.make_f32x4(1.5, 2.0, 3.0, 4.0))
10.5
fnsum_f64x2sum_f64x2(v) do simd_f64x2_sum(v) end#

Horizontal sum of both lanes (lane 0 + lane 1).

Examples

march> Simd.sum_f64x2(Simd.make_f64x2(1.5, 2.25))
3.75
fnsum_i32x4sum_i32x4(v) do simd_i32x4_sum(v) end#

Horizontal sum of all lanes, accumulated in i64, so the sum of four i32 lanes never wraps.

Examples

march> Simd.sum_i32x4(Simd.make_i32x4(1, 2, 3, 4))
10
fnsum_i64x2sum_i64x2(v) do simd_i64x2_sum(v) end#

Horizontal sum of both lanes, wrapping mod 2^64.

Examples

march> Simd.sum_i64x2(Simd.make_i64x2(100, -30))
70
fnxor_f32x4xor_f32x4(a, b) do simd_f32x4_xor(a, b) end#

Per-lane bitwise XOR of the lanes' binary32 bit patterns (XOR with -0.0 flips the sign bit).

Examples

march> (Simd.extract_f32x4(Simd.xor_f32x4(Simd.splat_f32x4(-2.0), Simd.splat_f32x4(-0.0)), 0)) == 2.0
true
fnxor_f64x2xor_f64x2(a, b) do simd_f64x2_xor(a, b) end#

Per-lane bitwise XOR of the lanes' binary64 bit patterns (x XOR x is 0.0).

Examples

march> (Simd.extract_f64x2(Simd.xor_f64x2(Simd.splat_f64x2(1.0), Simd.splat_f64x2(1.0)), 0)) == 0.0
true
fnxor_i32x4xor_i32x4(a, b) do simd_i32x4_xor(a, b) end#

Per-lane bitwise XOR.

Examples

march> Simd.extract_i32x4(Simd.xor_i32x4(Simd.splat_i32x4(12), Simd.splat_i32x4(10)), 0)
6
fnxor_i64x2xor_i64x2(a, b) do simd_i64x2_xor(a, b) end#

Per-lane bitwise XOR.

Examples

march> Simd.xor_i64x2(Simd.make_i64x2(12, 10), Simd.splat_i64x2(10)) == Simd.make_i64x2(6, 0)
true
fnxor_u8x16xor_u8x16(a, b) do simd_u8x16_xor(a, b) end#

Per-lane bitwise XOR.

Examples

march> Simd.extract_u8x16(Simd.xor_u8x16(Simd.splat_u8x16(12), Simd.splat_u8x16(10)), 0)
6