[bitcoin/bitcoin] For AVX2 code, also check for AVX, XSAVE, and OS support (#13471)

Empact commented on this pull request.

> @@ -484,6 +484,14 @@ void inline cpuid(uint32_t leaf, uint32_t subleaf, uint32_t& a, uint32_t& b, uin
{
__asm__ (“cpuid” : “=a”(a), “=b”(b), “=c”(c), “=d”(d) : “0”(leaf), “2”(subleaf));
}
+
+/** Check whether the OS has enabled AVX registers. */
+bool AVXEnabled()
+{
+ uint32_t a, d;
+ __asm__(“xgetbv” : “=a”(a), “=d”(d) : “c”(0));

Agreed

This post was last modified on June 15, 2018, 1:24 am