PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx-os-support.h
blobfb1ce7562d324c7a247599dd39d764c9d7b477d3
1 /* Check if the OS supports executing AVX instructions. */
3 #define XCR_XFEATURE_ENABLED_MASK 0x0
5 #define XSTATE_FP 0x1
6 #define XSTATE_SSE 0x2
7 #define XSTATE_YMM 0x4
9 static int
10 avx_os_support (void)
12 unsigned int eax, edx;
13 unsigned int ecx = XCR_XFEATURE_ENABLED_MASK;
15 __asm__ ("xgetbv" : "=a" (eax), "=d" (edx) : "c" (ecx));
17 return (eax & (XSTATE_SSE | XSTATE_YMM)) == (XSTATE_SSE | XSTATE_YMM);