Queries the processor dynamically at the source level (this intrinsic does not perform a vendor check) to determine if processor-specific features are available.
Arguments
unsigned __int64 | an unsigned __int64 bitset representing one or more cpuid features. The arguments for feature query accepted by this intrinsics are:
|
Description
This intrinsic will query the processor on which it is running to check to see if the given feature is (or features are) available. This check is dynamically performed at the point in the source where it is called. For example:
if (_may_i_use_cpu_feature(_FEATURE_SSE4_2)) { Use SSE4.2 intrinsics; } Else { Use generic code; }
The _may_i_use_feature
intrinsic, in this case, will dynamically check to see if the code is being executed on a processor that supports SSE4.2, and return true if it is supported (false, otherwise). The _may_i_use_feature
also accepts multiple features within a single argument, for example:
if (_may_i_use_cpu_feature(_FEATURE_SSE | _FEATURE_SSE2 | _FEATURE_SSE3 | _FEATURE_SSSE3 | _FEATURE_MOVBE) && !_may_i_use_cpu_feature(_FEATURE_SSE4_1)) { printf(“\nYou are running on an Atom processor.”\n”); }
This intrinsic does not perform processor vendor checks that other features do (-m <cpu>
type option).