native 0.0.1
Vectors, masks and wide register packs for C++26
Loading...
Searching...
No Matches
native::simd< T, N, Arch > Struct Template Referenceexport

Omitted architecture arguments use the native.simd provider's baseline. More...

Detailed Description

template<class T, std::size_t N, isa<> Arch = NATIVE_BASELINE>
struct native::simd< T, N, Arch >

Omitted architecture arguments use the native.simd provider's baseline.

A value with N logical lanes of T for Arch. N describes lanes, not a count of registers. Unsupported shapes remain incomplete; use wide for several registers. Two- and three-lane native vectors have four-lane physical storage but touch only their logical lanes in memory. Scalar float and full-register integer storage initialize to zero. Default initialization of full native float and short vectors leaves storage unspecified. Use braces, broadcast construction or a load before reading those lanes. Custom elements retain their customization's initialization contract.

value_type, lanes, architecture, mask and rebind<U> describe the selected specialization. Comparisons return masks, not a scalar bool. Named swizzles return owning values; repeated destinations cannot be assigned.

template<native::isa<> Arch>
void swizzles() {
V position{1.f, 2.f, 3.f};
auto saved = position.xy; // an owning two-lane value
position.xyz = position.zyx; // snapshot, then scatter
position.x = 4.f;
check(all(saved == native::simd<float, 2, Arch>{1.f, 2.f}));
check(all(position == V{4.f, 2.f, 1.f}));
}

Definition at line 19 of file native.simd.ccm.


The documentation for this struct was generated from the following file: