Intel® C++ Compiler 16.0 User and Reference Guide
Queries the processor dynamically at the source level (this intrinsic does not perform a vendor check) to determine if processor-specific features are available.
extern int _may_i_use_cpu_feature(unsigned __int64); |
unsigned __int64 |
an unsigned __int64 bitset representing one or more cpuid features. The arguments for feature query accepted by this intrinsics are: _FEATURE_GENERIC_IA32 _FEATURE_FPU _FEATURE_CMOV _FEATURE_MMX _FEATURE_FXSAVE _FEATURE_SSE _FEATURE_SSE2 _FEATURE_SSE3 _FEATURE_SSSE3 _FEATURE_SSE4_1 _FEATURE_SSE4_2 _FEATURE_POPCNT _FEATURE_MOVBE _FEATURE_PCLMULQDQ _FEATURE_AES _FEATURE_F16C _FEATURE_AVX _FEATURE_RDRND _FEATURE_FMA _FEATURE_BMI _FEATURE_LZCNT _FEATURE_HLE _FEATURE_RTM _FEATURE_AVX2 _FEATURE_KNCNI _FEATURE_ADX _FEATURE_RDSEED |
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).
Result of the feature query, true or false (1 or 0) for whether the set of features is available on the machine on which the intrinsic is executed.