chsvlib
chsv helper source code

◆ x86_cpuid_test_feature

#define x86_cpuid_test_feature (   feature_id)    implementation

DOXYGEN.

DOXYGEN

Tests whether a feature is supported by the active x86 or x86-64 CPU.

Parameters
feature_idA bit mask of values specified in the table. Different values can be combined into one value using bitwise OR ("|").
Returns
A value of the type bool which is true only if all the features specified by the feature_id parameter are supported by the active processor. On architectures other than x86 and x86_64 the function always returns false.
Warning
The function relies on the Intel CPUID instruction to check the availability of the features. Use of CPUID requires a prior test for availability of the required set of features as determined by a maximum input value for basic CPUID information and maximum input value for extended function CPUID information. Also, availability of the respective instructions as well as the set of corresponding registers may have to be determined beforehand via the XCR0 register obtained executing the XGETBV instruction. For performance none of the three checks (maximal basic CPUID feature, maximal extended CPUID feature and state availability in XCR0) is performed by the function and must be done beforehand by the caller using respectively x86_cpuid_max_basic_level(), x86_cpuid_max_extended_level() and get_xcr0().