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

ken2812221 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));

From gcc code I don’t think `_xgetbv` is a mcro
https://github.com/gcc-mirror/gcc/commit/154452f45aad4bfe7a1f719c65cd26837f416a48#diff-547c091edc6345b286585818a4ae7528R60

Добавить комментарий