RDRAND and RDSEED intrinsics GCC and Intel C++

时光怂恿深爱的人放手 提交于 2019-11-29 08:04:59

Both GCC and Intel compiler support them. GCC support was introduced at the end of 2010. They require the header <immintrin.h>.

GCC support has been present since at least version 4.6, but there doesn't seem to be any specific compile-time constant - you can just check __GNUC_MAJOR__ > 4 || (__GNUC_MAJOR__ == 4 && __GNUC_MINOR__ >= 6).

MitulShrivastava

Microsoft compiler does not have intrinsics support for RDSEED and RDRAND instruction.

But, you may implement these instruction using NASM or MASM. Assembly code is available at:

https://software.intel.com/en-us/articles/intel-digital-random-number-generator-drng-software-implementation-guide

For Intel Compiler, you can use header to determine the version. You can use following macros to determine the version and sub-version:

__INTEL_COMPILER //Major Version
__INTEL_COMPILER_UPDATE // Minor Update.

For instance if you use ICC15.0 Update 3 compiler, it will show that you have

__INTEL_COMPILER  = 1500
__INTEL_COMPILER_UPDATE = 3

For further details on pre-defined macros you can go to: https://software.intel.com/en-us/node/524490

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!