fxsrintrin.h revision 314564
1/*===---- fxsrintrin.h - FXSR intrinsic ------------------------------------=== 2 * 3 * Permission is hereby granted, free of charge, to any person obtaining a copy 4 * of this software and associated documentation files (the "Software"), to deal 5 * in the Software without restriction, including without limitation the rights 6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 * copies of the Software, and to permit persons to whom the Software is 8 * furnished to do so, subject to the following conditions: 9 * 10 * The above copyright notice and this permission notice shall be included in 11 * all copies or substantial portions of the Software. 12 * 13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 * THE SOFTWARE. 20 * 21 *===-----------------------------------------------------------------------=== 22 */ 23 24#ifndef __IMMINTRIN_H 25#error "Never use <fxsrintrin.h> directly; include <immintrin.h> instead." 26#endif 27 28#ifndef __FXSRINTRIN_H 29#define __FXSRINTRIN_H 30 31#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("fxsr"))) 32 33/// \brief 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 return __builtin_ia32_fxsave(__p); 47} 48 49/// \brief 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 return __builtin_ia32_fxrstor(__p); 65} 66 67#ifdef __x86_64__ 68/// \brief 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 return __builtin_ia32_fxsave64(__p); 82} 83 84/// \brief 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 return __builtin_ia32_fxrstor64(__p); 100} 101#endif 102 103#undef __DEFAULT_FN_ATTRS 104 105#endif 106