1*0b57cec5SDimitry Andric /*===---- fxsrintrin.h - FXSR intrinsic ------------------------------------===
2*0b57cec5SDimitry Andric *
3*0b57cec5SDimitry Andric * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*0b57cec5SDimitry Andric * See https://llvm.org/LICENSE.txt for license information.
5*0b57cec5SDimitry Andric * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*0b57cec5SDimitry Andric *
7*0b57cec5SDimitry Andric *===-----------------------------------------------------------------------===
8*0b57cec5SDimitry Andric */
9*0b57cec5SDimitry Andric
10*0b57cec5SDimitry Andric #ifndef __IMMINTRIN_H
11*0b57cec5SDimitry Andric #error "Never use <fxsrintrin.h> directly; include <immintrin.h> instead."
12*0b57cec5SDimitry Andric #endif
13*0b57cec5SDimitry Andric
14*0b57cec5SDimitry Andric #ifndef __FXSRINTRIN_H
15*0b57cec5SDimitry Andric #define __FXSRINTRIN_H
16*0b57cec5SDimitry Andric
17*0b57cec5SDimitry Andric #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("fxsr")))
18*0b57cec5SDimitry Andric
19*0b57cec5SDimitry Andric /// Saves the XMM, MMX, MXCSR and x87 FPU registers into a 512-byte
20*0b57cec5SDimitry Andric /// memory region pointed to by the input parameter \a __p.
21*0b57cec5SDimitry Andric ///
22*0b57cec5SDimitry Andric /// \headerfile <x86intrin.h>
23*0b57cec5SDimitry Andric ///
24*0b57cec5SDimitry Andric /// This intrinsic corresponds to the <c> FXSAVE </c> instruction.
25*0b57cec5SDimitry Andric ///
26*0b57cec5SDimitry Andric /// \param __p
27*0b57cec5SDimitry Andric /// A pointer to a 512-byte memory region. The beginning of this memory
28*0b57cec5SDimitry Andric /// region should be aligned on a 16-byte boundary.
29*0b57cec5SDimitry Andric static __inline__ void __DEFAULT_FN_ATTRS
_fxsave(void * __p)30*0b57cec5SDimitry Andric _fxsave(void *__p)
31*0b57cec5SDimitry Andric {
32*0b57cec5SDimitry Andric __builtin_ia32_fxsave(__p);
33*0b57cec5SDimitry Andric }
34*0b57cec5SDimitry Andric
35*0b57cec5SDimitry Andric /// Restores the XMM, MMX, MXCSR and x87 FPU registers from the 512-byte
36*0b57cec5SDimitry Andric /// memory region pointed to by the input parameter \a __p. The contents of
37*0b57cec5SDimitry Andric /// this memory region should have been written to by a previous \c _fxsave
38*0b57cec5SDimitry Andric /// or \c _fxsave64 intrinsic.
39*0b57cec5SDimitry Andric ///
40*0b57cec5SDimitry Andric /// \headerfile <x86intrin.h>
41*0b57cec5SDimitry Andric ///
42*0b57cec5SDimitry Andric /// This intrinsic corresponds to the <c> FXRSTOR </c> instruction.
43*0b57cec5SDimitry Andric ///
44*0b57cec5SDimitry Andric /// \param __p
45*0b57cec5SDimitry Andric /// A pointer to a 512-byte memory region. The beginning of this memory
46*0b57cec5SDimitry Andric /// region should be aligned on a 16-byte boundary.
47*0b57cec5SDimitry Andric static __inline__ void __DEFAULT_FN_ATTRS
_fxrstor(void * __p)48*0b57cec5SDimitry Andric _fxrstor(void *__p)
49*0b57cec5SDimitry Andric {
50*0b57cec5SDimitry Andric __builtin_ia32_fxrstor(__p);
51*0b57cec5SDimitry Andric }
52*0b57cec5SDimitry Andric
53*0b57cec5SDimitry Andric #ifdef __x86_64__
54*0b57cec5SDimitry Andric /// Saves the XMM, MMX, MXCSR and x87 FPU registers into a 512-byte
55*0b57cec5SDimitry Andric /// memory region pointed to by the input parameter \a __p.
56*0b57cec5SDimitry Andric ///
57*0b57cec5SDimitry Andric /// \headerfile <x86intrin.h>
58*0b57cec5SDimitry Andric ///
59*0b57cec5SDimitry Andric /// This intrinsic corresponds to the <c> FXSAVE64 </c> instruction.
60*0b57cec5SDimitry Andric ///
61*0b57cec5SDimitry Andric /// \param __p
62*0b57cec5SDimitry Andric /// A pointer to a 512-byte memory region. The beginning of this memory
63*0b57cec5SDimitry Andric /// region should be aligned on a 16-byte boundary.
64*0b57cec5SDimitry Andric static __inline__ void __DEFAULT_FN_ATTRS
_fxsave64(void * __p)65*0b57cec5SDimitry Andric _fxsave64(void *__p)
66*0b57cec5SDimitry Andric {
67*0b57cec5SDimitry Andric __builtin_ia32_fxsave64(__p);
68*0b57cec5SDimitry Andric }
69*0b57cec5SDimitry Andric
70*0b57cec5SDimitry Andric /// Restores the XMM, MMX, MXCSR and x87 FPU registers from the 512-byte
71*0b57cec5SDimitry Andric /// memory region pointed to by the input parameter \a __p. The contents of
72*0b57cec5SDimitry Andric /// this memory region should have been written to by a previous \c _fxsave
73*0b57cec5SDimitry Andric /// or \c _fxsave64 intrinsic.
74*0b57cec5SDimitry Andric ///
75*0b57cec5SDimitry Andric /// \headerfile <x86intrin.h>
76*0b57cec5SDimitry Andric ///
77*0b57cec5SDimitry Andric /// This intrinsic corresponds to the <c> FXRSTOR64 </c> instruction.
78*0b57cec5SDimitry Andric ///
79*0b57cec5SDimitry Andric /// \param __p
80*0b57cec5SDimitry Andric /// A pointer to a 512-byte memory region. The beginning of this memory
81*0b57cec5SDimitry Andric /// region should be aligned on a 16-byte boundary.
82*0b57cec5SDimitry Andric static __inline__ void __DEFAULT_FN_ATTRS
_fxrstor64(void * __p)83*0b57cec5SDimitry Andric _fxrstor64(void *__p)
84*0b57cec5SDimitry Andric {
85*0b57cec5SDimitry Andric __builtin_ia32_fxrstor64(__p);
86*0b57cec5SDimitry Andric }
87*0b57cec5SDimitry Andric #endif
88*0b57cec5SDimitry Andric
89*0b57cec5SDimitry Andric #undef __DEFAULT_FN_ATTRS
90*0b57cec5SDimitry Andric
91*0b57cec5SDimitry Andric #endif
92