SIMD (Single Instruction, Multiple Data) types are 128-bit vector primitives that operate on multiple values in a single instruction. On x86-64 the backend lowers them to SSE/SSE2/SSE3/SSE4.1/FMA3 instructions; on ARM64 (Apple Silicon, Android, AArch64 servers) the same operations lower to NEON. The IL is platform-agnostic — every SIMD operation has equivalents on both backends, so the same source runs unchanged across architectures.
Types
All SIMD types are 128-bit (16-byte), stack-allocated with 16-byte alignment:
Type Lanes Element float32x44 32-bit float float64x22 64-bit float int8x1616 signed 8-bit int int16x88 signed 16-bit int int32x44 signed 32-bit int int64x22 signed 64-bit int uint8x1616 unsigned 8-bit int uint16x88 unsigned 16-bit int uint32x44 unsigned 32-bit int uint64x22 unsigned 64-bit int
SIMD types are global primitives — no using directive is needed to use them.
Construction
Broadcast (scalar to all lanes)
float32x4 v = float32x4 ( 1.0 ); // [1.0, 1.0, 1.0, 1.0]
int32x4 w = int32x4 ( 42 ); // [42, 42, 42, 42]
float64x2 d = float64x2 ( 3.14 ); // [3.14, 3.14]
Per-element
float32x4 v = float32x4 ( 1.0 , 2.0 , 3.0 , 4.0 );
float64x2 d = float64x2 ( 1.0 , 2.0 );
int32x4 w = int32x4 ( 10 , 20 , 30 , 40 );
int64x2 q = int64x2 ( 100 , 200 );
Operators
All SIMD types support element-wise arithmetic:
float32x4 a = float32x4 ( 1.0 , 2.0 , 3.0 , 4.0 );
float32x4 b = float32x4 ( 10.0 , 20.0 , 30.0 , 40.0 );
float32x4 c = a + b ; // [11.0, 22.0, 33.0, 44.0]
float32x4 d = a - b ; // [-9.0, -18.0, -27.0, -36.0]
float32x4 e = a * b ; // [10.0, 40.0, 90.0, 160.0]
float32x4 f = a / b ; // division (float types only)
float32x4 neg = - a ; // unary negation
Bitwise operations
int32x4 a = int32x4 ( 0xFF , 0xF0 , 0x0F , 0xFF );
int32x4 b = int32x4 ( 0x0F , 0x0F , 0x0F , 0x0F );
int32x4 c = a & b ; // AND
int32x4 e = a ^ b ; // XOR
Comparisons
Comparisons return a lane mask (all bits set for true, zero for false):
SIMD Namespace Functions
The SIMD namespace (under Core) provides utility functions. Access them with using Core;:
float32x4 a = float32x4 ( 4.0 , 9.0 , 16.0 , 25.0 );
float32x4 b = SIMD . Sqrt ( a ); // [2.0, 3.0, 4.0, 5.0]
Unary
Function Description Types SIMD.Sqrt(a)Square root float only SIMD.Abs(a)Absolute value all SIMD.Not(a)Bitwise complement all SIMD.Reciprocal(a)Approximate 1/a float32 only SIMD.ReciprocalSqrt(a)Approximate 1/sqrt(a) float32 only
Binary
Function Description Types SIMD.Min(a, b)Element-wise minimum all SIMD.Max(a, b)Element-wise maximum all SIMD.AndNot(a, b)~a & ball SIMD.DotProduct(a, b)Dot product float only
Ternary
Function Description Types SIMD.FMA(a, b, c)Fused multiply-add: a*b+c float only SIMD.FMS(a, b, c)Fused multiply-subtract: a*b-c float only SIMD.Clamp(a, min, max)Element-wise clamp all
Horizontal Operations
Function Description SIMD.HAdd(a, b)Horizontal add SIMD.HSub(a, b)Horizontal subtract SIMD.ReduceAdd(a)Sum all lanes, broadcast result SIMD.ReduceMin(a)Min of all lanes, broadcast result SIMD.ReduceMax(a)Max of all lanes, broadcast result
Rounding (float only, SSE4.1)
Function Description SIMD.Floor(a)Round toward -infinity SIMD.Ceil(a)Round toward +infinity SIMD.Round(a)Round to nearest even SIMD.Trunc(a)Round toward zero
Shifts
Function Description SIMD.ShiftLeft(a, count)Shift left SIMD.ShiftRight(a, count)Arithmetic shift right (signed) SIMD.ShiftRightLogical(a, count)Logical shift right (unsigned)
Conversions
Function Description SIMD.ConvertToFloat(a)int32x4 → float32x4SIMD.ConvertToInt(a)float32x4 → int32x4 (truncate)
Example
float32x4 positions = float32x4 ( 1.0 , 2.0 , 3.0 , 4.0 );
float32x4 velocities = float32x4 ( 0.1 , 0.2 , 0.3 , 0.4 );
float32x4 dt = float32x4 ( 0.016 );
// Update: pos = pos + vel * dt
positions = SIMD . FMA ( velocities , dt , positions );
float32x4 lo = float32x4 ( 0.0 );
float32x4 hi = float32x4 ( 10.0 );
positions = SIMD . Clamp ( positions , lo , hi );