Separate meaning from machinery.

The scalar implementation defines behavior. Backend bodies contain target mechanisms. Generic algorithms compose primitive packages without a per-operation runtime branch.

Define portability in three dimensions

Flyology_SIMD promises identical public operation semantics across its backends. The scalar source provides a fallback on supported GCC-based GNAT targets. Verified target packages improve code generation for specific instruction sets.

The project does not promise that a private vector representation or calling convention survives compiler switches, enabled instruction sets, architectures, or compilers. The public contract is portable; the representation and ABI are not.

Keep one authoritative behavior

Flyology_SIMD.Backends.Scalar implements the public semantics with auditable lane operations. Differential tests compare each executable optimized operation against this backend.

Flyology_SIMD.Backends.Native has the same primitive contract. The GPR selects its body from the scalar, AArch64, or x86-64 source directory. Backend representations remain in private types and body-local machine types.

The boundary leaves room for GNAT LLVM without changing application code. GNAT LLVM is a compatibility target, not a supported backend, because this release has no equivalent verified lowering evidence.

Compose the inner loop statically

Flyology_SIMD.Algorithms.Generic_Bytes receives splat, bitwise, comparison, compact-mask, and load operations as generic formals. The compiler can inline those primitives into each complete-buffer loop.

This contract proves that the public family supports real algorithms rather than isolated instructions. The initial algorithms find one byte, count one byte, and validate ASCII input.

Dispatch once at the algorithm boundary

Flyology_SIMD.Features reports which backends were compiled and which can execute safely. Flyology_SIMD.Algorithms.Runtime chooses one implementation before it enters the buffer loop.

On x86-64, the AVX2 gate requires the CPU bits for AVX and AVX2. It also requires OSXSAVE and XCR0 support for XMM and YMM state. The immutable detection result is computed once with baseline-safe code.

AArch64 Advanced SIMD is part of the architecture baseline. The AArch64 implementation therefore does not perform a redundant NEON feature probe.

Isolate machine mechanisms narrowly

A backend uses a verified compiler intrinsic when GNAT exposes one with the required semantics. When no suitable intrinsic exists, the project prefers a small Ada System.Machine_Code assembly leaf over an out-of-line C wrapper.

The leaf contains mechanism only. Ada retains validation and portable policy. Differential tests check the leaf against scalar behavior, and code-generation checks inspect its emitted instructions.

A native boundary must not allocate memory, perform I/O, acquire a lock, wait, start a task, or read ambient process configuration. Low-level primitive operations have the same restriction.

Add a backend without widening the API

  1. Implement the existing native backend contract in a target-specific source directory.
  2. Keep vector and mask representations private to the backend.
  3. Map every operation to the scalar semantics, including edge cases.
  4. Add deterministic differential tests for every public operation and lane.
  5. Add guarded-tail tests where the target supports protected pages.
  6. Inspect critical operations and complete loops in generated assembly.
  7. Record compilation, execution, and continuous-test evidence separately.

Do not add a target instruction merely because the hardware exposes it. Add a portable operation only when its meaning is useful and can remain stable across backends.