fxsrintrin.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. #ifndef __IMMINTRIN_H
  24. #error "Never use <fxsrintrin.h> directly; include <immintrin.h> instead."
  25. #endif
  26. #ifndef __FXSRINTRIN_H
  27. #define __FXSRINTRIN_H
  28. #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("fxsr")))
  29. /// \brief Saves the XMM, MMX, MXCSR and x87 FPU registers into a 512-byte
  30. /// memory region pointed to by the input parameter \a __p.
  31. ///
  32. /// \headerfile <x86intrin.h>
  33. ///
  34. /// This intrinsic corresponds to the <c> FXSAVE </c> instruction.
  35. ///
  36. /// \param __p
  37. /// A pointer to a 512-byte memory region. The beginning of this memory
  38. /// region should be aligned on a 16-byte boundary.
  39. static __inline__ void __DEFAULT_FN_ATTRS
  40. _fxsave(void *__p)
  41. {
  42. return __builtin_ia32_fxsave(__p);
  43. }
  44. /// \brief Restores the XMM, MMX, MXCSR and x87 FPU registers from the 512-byte
  45. /// memory region pointed to by the input parameter \a __p. The contents of
  46. /// this memory region should have been written to by a previous \c _fxsave
  47. /// or \c _fxsave64 intrinsic.
  48. ///
  49. /// \headerfile <x86intrin.h>
  50. ///
  51. /// This intrinsic corresponds to the <c> FXRSTOR </c> instruction.
  52. ///
  53. /// \param __p
  54. /// A pointer to a 512-byte memory region. The beginning of this memory
  55. /// region should be aligned on a 16-byte boundary.
  56. static __inline__ void __DEFAULT_FN_ATTRS
  57. _fxrstor(void *__p)
  58. {
  59. return __builtin_ia32_fxrstor(__p);
  60. }
  61. #ifdef __x86_64__
  62. /// \brief Saves the XMM, MMX, MXCSR and x87 FPU registers into a 512-byte
  63. /// memory region pointed to by the input parameter \a __p.
  64. ///
  65. /// \headerfile <x86intrin.h>
  66. ///
  67. /// This intrinsic corresponds to the <c> FXSAVE64 </c> instruction.
  68. ///
  69. /// \param __p
  70. /// A pointer to a 512-byte memory region. The beginning of this memory
  71. /// region should be aligned on a 16-byte boundary.
  72. static __inline__ void __DEFAULT_FN_ATTRS
  73. _fxsave64(void *__p)
  74. {
  75. return __builtin_ia32_fxsave64(__p);
  76. }
  77. /// \brief Restores the XMM, MMX, MXCSR and x87 FPU registers from the 512-byte
  78. /// memory region pointed to by the input parameter \a __p. The contents of
  79. /// this memory region should have been written to by a previous \c _fxsave
  80. /// or \c _fxsave64 intrinsic.
  81. ///
  82. /// \headerfile <x86intrin.h>
  83. ///
  84. /// This intrinsic corresponds to the <c> FXRSTOR64 </c> instruction.
  85. ///
  86. /// \param __p
  87. /// A pointer to a 512-byte memory region. The beginning of this memory
  88. /// region should be aligned on a 16-byte boundary.
  89. static __inline__ void __DEFAULT_FN_ATTRS
  90. _fxrstor64(void *__p)
  91. {
  92. return __builtin_ia32_fxrstor64(__p);
  93. }
  94. #endif
  95. #undef __DEFAULT_FN_ATTRS
  96. #endif