链接已复制
gcc 4.8 provides similar feature via __builtin_cpu_supports intrinsic. See GCC 4.8 release notes for details: http://gcc.gnu.org/gcc-4.8/changes.html
While I agree that _may_i_use_cpu_feature is a very odd name, I don't think that _mm_ prefix is appropriate because cpuid is not a SIMD (or "multimedia", in the early Intel terms; remember MMX) instruction.
Just for the sake of reference, MSVC supports __cpuid intrinsic: http://msdn.microsoft.com/es-es/library/vstudio/hskdteyh%28v=vs.100%29.aspx. I think, Intel on Windows should support it as well.
Sergey Kostrov wrote:
I'd like to add that the name of the intrinsic function:
_may_i_use_cpu_feature
looks very strange and it violates already defined naming conventions, that is, using _mm_ prefix for 99% of all intrinsic functions. I think Intel needs to rename the function to:
__cpufeature ( similar to __cpuid )
or
_mm_cpufeature
and please consider it as a Feature Request. Thanks.
Completely agree with you
> Proper for name for cpuid intrinsic function.
cpuid intrinsic is more useful when you want to test for multiple features. Which, by the way, is often the case when testing for different versions of SSE/AVX.
