Experimental Ada library

Fixed-width vector operations for Ada.

Use private 128-bit vector types such as U8x16, I32x4, and F64x2, or the corresponding initial 256-bit Wide profile. The public operations have the same result on the scalar, AArch64 NEON, and x86-64 SSE2 backends.

Version 0.1.1-dev. GCC-based GNAT is required. The API can change.

U8x16 loaded from bytes 0 through 15 lane 0 = byte 0
20212223 24252627 28292A2B 2C2D2E2F
Equal (V, Splat (16#20#)) 0x0001
one public result→scalar or SIMD code
Width Complete 128-bit family and an initial 256-bit Wide profile.
Backends Scalar, AArch64 NEON, and x86-64 SSE2. AVX2 is optional for selected buffer algorithms and Wide byte, floating-arithmetic, lookup, and permutation operations.
Dependencies No runtime crate dependency. No heap allocation or tasking in vector operations.
Example: add eight 16-bit lanes

The operation name states the overflow rule.

Add_Wrap computes modulo 216. Add_Saturate clamps each result to 65,535. Both operations process the same U16x8 inputs.

package Native renames Flyology_SIMD.Backends.Native;

Input     : constant U16x8 :=
  Native.From_Lanes ([65_530, 1, 2, 3, 100, 200, 300, 400]);
Increment : constant U16x8 := Native.Splat (10);

Wrapped   : constant U16x8 := Native.Add_Wrap (Input, Increment);
Saturated : constant U16x8 := Native.Add_Saturate (Input, Increment);

--  lane 0 of Wrapped is 4
--  lane 0 of Saturated is 65_535

The repository contains this complete program in examples/integer_vectors.adb. The guide gives the exact build command and explains each result.

Current API boundary

Ten lane families have 128-bit and 256-bit value types.

The 128-bit integer families have explicit wrapping and saturating arithmetic, shifts, comparisons, reductions, fixed lane arrangements, masks, and typed memory operations. The 128-bit floating families have arithmetic, ordered and unordered comparisons, number minimum and maximum, add reduction, fixed lane arrangements, masks, and typed memory operations. All ten 128-bit value types have reusable one-source and two-source lane maps, zero-filled lane slides, and stable mask compression and expansion.

The complete 128-bit API also has lane-preserving bit casts, adjacent integer widening and narrowing, floating narrowing and widening, numeric conversion, signedness conversion, and 16-entry byte-table lookup. Flyology_SIMD.Wide supplies corresponding private 256-bit types with an initial profile. Wide includes compression and expansion, one-source and two-source lane maps, bit casts between types with the same lane width and lane count, widening, narrowing, numeric conversion, and 32-entry byte-table lookup for U8x32.

Read the exact matrix
U8x1616 unsigned bytes
I8x1616 signed bytes
U16x88 unsigned 16-bit lanes
I16x88 signed 16-bit lanes
U32x44 unsigned 32-bit lanes
I32x44 signed 32-bit lanes
U64x22 unsigned 64-bit lanes
I64x22 signed 64-bit lanes
F32x44 IEEE binary32 lanes
F64x22 IEEE binary64 lanes