According to Microsoft's x64 (amd64) Intrinsics List, Microsoft offers an intrinsic for RDRAND:
_rdrand16_step
_rdrand32_step
_rdrand64_step
However, the page does not discuss detecting the availability of the intrinsic. There is a footnote with [2], but it says its only available for Intel CPUs.
I have two questions. First, how can I detect the availability of the intrinsics. That is, what preprocessor macro should I use to guard the call to say _rdrand64_step
.
Second, how can I access RDRAND under AMD CPUs? According to the AMD manual, AMD offers it too.
(More humorously, Microsoft titles the page amd64 Intrinsic List. Why do they call it AMD64 Intrinsic List when they don't include AMD???)
For AMD and the RDRAND instruction, reference AMD64 Architecture Programmer’s Manual Volume 3: General-Purpose and System Instructions, page 278.