Stop only if there aren't any usable algorithms
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx512f-os-support.h
blob2f1ed03df4597fd825974b5d94239b3355950245
1 /* Check if the OS supports executing AVX512F instructions. */
3 #define XCR_XFEATURE_ENABLED_MASK 0x0
5 #define XSTATE_FP 0x1
6 #define XSTATE_SSE 0x2
7 #define XSTATE_YMM 0x4
8 #define XSTATE_OPMASK 0x20
9 #define XSTATE_ZMM 0x40
10 #define XSTATE_HI_ZMM 0x80
12 static int
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);