1 /* Check if the OS supports executing AVX512F instructions. */
3 #define XCR_XFEATURE_ENABLED_MASK 0x0
8 #define XSTATE_OPMASK 0x20
9 #define XSTATE_ZMM 0x40
10 #define XSTATE_HI_ZMM 0x80
13 avx512f_os_support (void)
15 unsigned int eax
, edx
;
16 unsigned int ecx
= XCR_XFEATURE_ENABLED_MASK
;
17 unsigned int mask
= XSTATE_SSE
| XSTATE_YMM
| XSTATE_OPMASK
18 | XSTATE_ZMM
| XSTATE_HI_ZMM
;
20 __asm__ ("xgetbv" : "=a" (eax
), "=d" (edx
) : "c" (ecx
));
22 return ((eax
& mask
) == mask
);