xsaveintrin.h revision 1.9 1 1.9 mrg /* Copyright (C) 2012-2020 Free Software Foundation, Inc.
2 1.1 mrg
3 1.1 mrg This file is part of GCC.
4 1.1 mrg
5 1.1 mrg GCC is free software; you can redistribute it and/or modify
6 1.1 mrg it under the terms of the GNU General Public License as published by
7 1.1 mrg the Free Software Foundation; either version 3, or (at your option)
8 1.1 mrg any later version.
9 1.1 mrg
10 1.1 mrg GCC is distributed in the hope that it will be useful,
11 1.1 mrg but WITHOUT ANY WARRANTY; without even the implied warranty of
12 1.1 mrg MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 1.1 mrg GNU General Public License for more details.
14 1.1 mrg
15 1.1 mrg Under Section 7 of GPL version 3, you are granted additional
16 1.1 mrg permissions described in the GCC Runtime Library Exception, version
17 1.1 mrg 3.1, as published by the Free Software Foundation.
18 1.1 mrg
19 1.1 mrg You should have received a copy of the GNU General Public License and
20 1.1 mrg a copy of the GCC Runtime Library Exception along with this program;
21 1.1 mrg see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
22 1.1 mrg <http://www.gnu.org/licenses/>. */
23 1.1 mrg
24 1.8 mrg #if !defined _IMMINTRIN_H_INCLUDED
25 1.8 mrg # error "Never use <xsaveintrin.h> directly; include <immintrin.h> instead."
26 1.8 mrg #endif
27 1.1 mrg
28 1.1 mrg #ifndef _XSAVEINTRIN_H_INCLUDED
29 1.1 mrg #define _XSAVEINTRIN_H_INCLUDED
30 1.1 mrg
31 1.3 mrg #ifndef __XSAVE__
32 1.3 mrg #pragma GCC push_options
33 1.3 mrg #pragma GCC target("xsave")
34 1.3 mrg #define __DISABLE_XSAVE__
35 1.3 mrg #endif /* __XSAVE__ */
36 1.3 mrg
37 1.1 mrg extern __inline void
38 1.1 mrg __attribute__((__gnu_inline__, __always_inline__, __artificial__))
39 1.1 mrg _xsave (void *__P, long long __M)
40 1.1 mrg {
41 1.6 mrg __builtin_ia32_xsave (__P, __M);
42 1.1 mrg }
43 1.1 mrg
44 1.1 mrg extern __inline void
45 1.1 mrg __attribute__((__gnu_inline__, __always_inline__, __artificial__))
46 1.1 mrg _xrstor (void *__P, long long __M)
47 1.1 mrg {
48 1.6 mrg __builtin_ia32_xrstor (__P, __M);
49 1.1 mrg }
50 1.1 mrg
51 1.7 mrg extern __inline void
52 1.7 mrg __attribute__((__gnu_inline__, __always_inline__, __artificial__))
53 1.7 mrg _xsetbv (unsigned int __A, long long __V)
54 1.7 mrg {
55 1.7 mrg __builtin_ia32_xsetbv (__A, __V);
56 1.7 mrg }
57 1.7 mrg
58 1.7 mrg extern __inline long long
59 1.7 mrg __attribute__((__gnu_inline__, __always_inline__, __artificial__))
60 1.7 mrg _xgetbv (unsigned int __A)
61 1.7 mrg {
62 1.7 mrg return __builtin_ia32_xgetbv (__A);
63 1.7 mrg }
64 1.7 mrg
65 1.1 mrg #ifdef __x86_64__
66 1.1 mrg extern __inline void
67 1.1 mrg __attribute__((__gnu_inline__, __always_inline__, __artificial__))
68 1.1 mrg _xsave64 (void *__P, long long __M)
69 1.1 mrg {
70 1.6 mrg __builtin_ia32_xsave64 (__P, __M);
71 1.1 mrg }
72 1.1 mrg
73 1.1 mrg extern __inline void
74 1.1 mrg __attribute__((__gnu_inline__, __always_inline__, __artificial__))
75 1.1 mrg _xrstor64 (void *__P, long long __M)
76 1.1 mrg {
77 1.6 mrg __builtin_ia32_xrstor64 (__P, __M);
78 1.1 mrg }
79 1.1 mrg #endif
80 1.1 mrg
81 1.3 mrg #ifdef __DISABLE_XSAVE__
82 1.3 mrg #undef __DISABLE_XSAVE__
83 1.3 mrg #pragma GCC pop_options
84 1.3 mrg #endif /* __DISABLE_XSAVE__ */
85 1.3 mrg
86 1.1 mrg #endif /* _XSAVEINTRIN_H_INCLUDED */
87