1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 | |
11 | |
12 | |
13 | |
14 | |
15 | |
16 | |
17 | |
18 | |
19 | |
20 | |
21 | |
22 | |
23 | |
24 | #ifndef __IMMINTRIN_H |
25 | #error "Never use <xsaveintrin.h> directly; include <immintrin.h> instead." |
26 | #endif |
27 | |
28 | #ifndef __XSAVEINTRIN_H |
29 | #define __XSAVEINTRIN_H |
30 | |
31 | #ifdef _MSC_VER |
32 | #define _XCR_XFEATURE_ENABLED_MASK 0 |
33 | #endif |
34 | |
35 | |
36 | #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("xsave"))) |
37 | |
38 | static __inline__ void __DEFAULT_FN_ATTRS |
39 | _xsave(void *__p, unsigned long long __m) { |
40 | __builtin_ia32_xsave(__p, __m); |
41 | } |
42 | |
43 | static __inline__ void __DEFAULT_FN_ATTRS |
44 | _xrstor(void *__p, unsigned long long __m) { |
45 | __builtin_ia32_xrstor(__p, __m); |
46 | } |
47 | |
48 | #ifndef _MSC_VER |
49 | #define _xgetbv(A) __builtin_ia32_xgetbv((long long)(A)) |
50 | #define _xsetbv(A, B) __builtin_ia32_xsetbv((unsigned int)(A), (unsigned long long)(B)); |
51 | #else |
52 | #ifdef __cplusplus |
53 | extern "C" { |
54 | #endif |
55 | unsigned __int64 __cdecl _xgetbv(unsigned int); |
56 | void __cdecl _xsetbv(unsigned int, unsigned __int64); |
57 | #ifdef __cplusplus |
58 | } |
59 | #endif |
60 | #endif |
61 | |
62 | #ifdef __x86_64__ |
63 | static __inline__ void __DEFAULT_FN_ATTRS |
64 | _xsave64(void *__p, unsigned long long __m) { |
65 | __builtin_ia32_xsave64(__p, __m); |
66 | } |
67 | |
68 | static __inline__ void __DEFAULT_FN_ATTRS |
69 | _xrstor64(void *__p, unsigned long long __m) { |
70 | __builtin_ia32_xrstor64(__p, __m); |
71 | } |
72 | |
73 | #endif |
74 | |
75 | #undef __DEFAULT_FN_ATTRS |
76 | |
77 | #endif |
78 | |