fxsrintrin.h revision 341825
1200062Sed/*===---- fxsrintrin.h - FXSR intrinsic ------------------------------------===
2200062Sed *
3200062Sed * Permission is hereby granted, free of charge, to any person obtaining a copy
4200062Sed * of this software and associated documentation files (the "Software"), to deal
5200062Sed * in the Software without restriction, including without limitation the rights
6200153Sed * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7200153Sed * copies of the Software, and to permit persons to whom the Software is
8200062Sed * furnished to do so, subject to the following conditions:
9200153Sed *
10200062Sed * The above copyright notice and this permission notice shall be included in
11200153Sed * all copies or substantial portions of the Software.
12200153Sed *
13200062Sed * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14200062Sed * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15200062Sed * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16200153Sed * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17200153Sed * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18200062Sed * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19200153Sed * THE SOFTWARE.
20200153Sed *
21200153Sed *===-----------------------------------------------------------------------===
22200153Sed */
23200153Sed
24200153Sed#ifndef __IMMINTRIN_H
25200153Sed#error "Never use <fxsrintrin.h> directly; include <immintrin.h> instead."
26200062Sed#endif
27200062Sed
28200062Sed#ifndef __FXSRINTRIN_H
29200062Sed#define __FXSRINTRIN_H
30200062Sed
31200062Sed#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__,  __target__("fxsr")))
32
33/// Saves the XMM, MMX, MXCSR and x87 FPU registers into a 512-byte
34///    memory region pointed to by the input parameter \a __p.
35///
36/// \headerfile <x86intrin.h>
37///
38/// This intrinsic corresponds to the <c> FXSAVE </c> instruction.
39///
40/// \param __p
41///    A pointer to a 512-byte memory region. The beginning of this memory
42///    region should be aligned on a 16-byte boundary.
43static __inline__ void __DEFAULT_FN_ATTRS
44_fxsave(void *__p)
45{
46  __builtin_ia32_fxsave(__p);
47}
48
49/// Restores the XMM, MMX, MXCSR and x87 FPU registers from the 512-byte
50///    memory region pointed to by the input parameter \a __p. The contents of
51///    this memory region should have been written to by a previous \c _fxsave
52///    or \c _fxsave64 intrinsic.
53///
54/// \headerfile <x86intrin.h>
55///
56/// This intrinsic corresponds to the <c> FXRSTOR </c> instruction.
57///
58/// \param __p
59///    A pointer to a 512-byte memory region. The beginning of this memory
60///    region should be aligned on a 16-byte boundary.
61static __inline__ void __DEFAULT_FN_ATTRS
62_fxrstor(void *__p)
63{
64  __builtin_ia32_fxrstor(__p);
65}
66
67#ifdef __x86_64__
68/// Saves the XMM, MMX, MXCSR and x87 FPU registers into a 512-byte
69///    memory region pointed to by the input parameter \a __p.
70///
71/// \headerfile <x86intrin.h>
72///
73/// This intrinsic corresponds to the <c> FXSAVE64 </c> instruction.
74///
75/// \param __p
76///    A pointer to a 512-byte memory region. The beginning of this memory
77///    region should be aligned on a 16-byte boundary.
78static __inline__ void __DEFAULT_FN_ATTRS
79_fxsave64(void *__p)
80{
81  __builtin_ia32_fxsave64(__p);
82}
83
84/// Restores the XMM, MMX, MXCSR and x87 FPU registers from the 512-byte
85///    memory region pointed to by the input parameter \a __p. The contents of
86///    this memory region should have been written to by a previous \c _fxsave
87///    or \c _fxsave64 intrinsic.
88///
89/// \headerfile <x86intrin.h>
90///
91/// This intrinsic corresponds to the <c> FXRSTOR64 </c> instruction.
92///
93/// \param __p
94///    A pointer to a 512-byte memory region. The beginning of this memory
95///    region should be aligned on a 16-byte boundary.
96static __inline__ void __DEFAULT_FN_ATTRS
97_fxrstor64(void *__p)
98{
99  __builtin_ia32_fxrstor64(__p);
100}
101#endif
102
103#undef __DEFAULT_FN_ATTRS
104
105#endif
106