native 0.0.1
Vectors, masks and wide register packs for C++26
Loading...
Searching...
No Matches
Feature detection
Collaboration diagram for Feature detection:

Classes

struct  native::cpuid_t

Functions

cpuid_t native::cpuid (std::int32_t eax, std::int32_t ecx) noexcept

Detailed Description

x86-only queries and wait helpers. Feature queries belong outside hot loops; SIMD instruction admission also requires the appropriate OS vector state.

void capabilities() {
auto maximum_leaf = native::cpuid(0, 0).eax;
check(maximum_leaf >= 0);
// A real feature test must also admit the required OS vector state.
// Waiting is independent of SIMD architecture selection.
int ready = 1;
native::wait_until<native::spin>(&ready, [](volatile int * p) { return *p != 0; });
}

Function Documentation

◆ cpuid()

cpuid_t native::cpuid ( std::int32_t eax,
std::int32_t ecx )
exportnoexcept

Execute CPUID with leaf eax and subleaf ecx, returning all four registers. Unsupported leaves retain the instruction's behavior; check maximum leaves before interpreting feature bits. This does not check XCR0/OS vector state. CPUID serializes execution; query capabilities outside critical paths.

Definition at line 117 of file native.x86.features.ccm.

Here is the caller graph for this function: