x86gprintrin.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. /* Copyright (C) 2020-2022 Free Software Foundation, Inc.
  2. This file is part of GCC.
  3. GCC is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 3, or (at your option)
  6. any later version.
  7. GCC is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. Under Section 7 of GPL version 3, you are granted additional
  12. permissions described in the GCC Runtime Library Exception, version
  13. 3.1, as published by the Free Software Foundation.
  14. You should have received a copy of the GNU General Public License and
  15. a copy of the GCC Runtime Library Exception along with this program;
  16. see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  17. <http://www.gnu.org/licenses/>. */
  18. #ifndef _X86GPRINTRIN_H_INCLUDED
  19. #define _X86GPRINTRIN_H_INCLUDED
  20. #if !defined _SOFT_FLOAT || defined __MMX__ || defined __SSE__
  21. #pragma GCC push_options
  22. #pragma GCC target("general-regs-only")
  23. #define __DISABLE_GENERAL_REGS_ONLY__
  24. #endif
  25. #include <ia32intrin.h>
  26. #ifndef __iamcu__
  27. #include <stddef.h>
  28. #include <adxintrin.h>
  29. #include <bmiintrin.h>
  30. #include <bmi2intrin.h>
  31. #include <cetintrin.h>
  32. #include <cldemoteintrin.h>
  33. #include <clflushoptintrin.h>
  34. #include <clwbintrin.h>
  35. #include <clzerointrin.h>
  36. #include <enqcmdintrin.h>
  37. #include <fxsrintrin.h>
  38. #include <lzcntintrin.h>
  39. #include <lwpintrin.h>
  40. #include <movdirintrin.h>
  41. #include <mwaitintrin.h>
  42. #include <mwaitxintrin.h>
  43. #include <pconfigintrin.h>
  44. #include <popcntintrin.h>
  45. #include <pkuintrin.h>
  46. #include <rdseedintrin.h>
  47. #include <rtmintrin.h>
  48. #include <serializeintrin.h>
  49. #include <sgxintrin.h>
  50. #include <tbmintrin.h>
  51. #include <tsxldtrkintrin.h>
  52. #include <uintrintrin.h>
  53. #include <waitpkgintrin.h>
  54. #include <wbnoinvdintrin.h>
  55. #include <xsaveintrin.h>
  56. #include <xsavecintrin.h>
  57. #include <xsaveoptintrin.h>
  58. #include <xsavesintrin.h>
  59. #include <xtestintrin.h>
  60. #include <hresetintrin.h>
  61. extern __inline void
  62. __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  63. _wbinvd (void)
  64. {
  65. __builtin_ia32_wbinvd ();
  66. }
  67. #ifndef __RDRND__
  68. #pragma GCC push_options
  69. #pragma GCC target("rdrnd")
  70. #define __DISABLE_RDRND__
  71. #endif /* __RDRND__ */
  72. extern __inline int
  73. __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  74. _rdrand16_step (unsigned short *__P)
  75. {
  76. return __builtin_ia32_rdrand16_step (__P);
  77. }
  78. extern __inline int
  79. __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  80. _rdrand32_step (unsigned int *__P)
  81. {
  82. return __builtin_ia32_rdrand32_step (__P);
  83. }
  84. #ifdef __DISABLE_RDRND__
  85. #undef __DISABLE_RDRND__
  86. #pragma GCC pop_options
  87. #endif /* __DISABLE_RDRND__ */
  88. #ifndef __RDPID__
  89. #pragma GCC push_options
  90. #pragma GCC target("rdpid")
  91. #define __DISABLE_RDPID__
  92. #endif /* __RDPID__ */
  93. extern __inline unsigned int
  94. __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  95. _rdpid_u32 (void)
  96. {
  97. return __builtin_ia32_rdpid ();
  98. }
  99. #ifdef __DISABLE_RDPID__
  100. #undef __DISABLE_RDPID__
  101. #pragma GCC pop_options
  102. #endif /* __DISABLE_RDPID__ */
  103. #ifdef __x86_64__
  104. #ifndef __FSGSBASE__
  105. #pragma GCC push_options
  106. #pragma GCC target("fsgsbase")
  107. #define __DISABLE_FSGSBASE__
  108. #endif /* __FSGSBASE__ */
  109. extern __inline unsigned int
  110. __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  111. _readfsbase_u32 (void)
  112. {
  113. return __builtin_ia32_rdfsbase32 ();
  114. }
  115. extern __inline unsigned long long
  116. __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  117. _readfsbase_u64 (void)
  118. {
  119. return __builtin_ia32_rdfsbase64 ();
  120. }
  121. extern __inline unsigned int
  122. __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  123. _readgsbase_u32 (void)
  124. {
  125. return __builtin_ia32_rdgsbase32 ();
  126. }
  127. extern __inline unsigned long long
  128. __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  129. _readgsbase_u64 (void)
  130. {
  131. return __builtin_ia32_rdgsbase64 ();
  132. }
  133. extern __inline void
  134. __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  135. _writefsbase_u32 (unsigned int __B)
  136. {
  137. __builtin_ia32_wrfsbase32 (__B);
  138. }
  139. extern __inline void
  140. __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  141. _writefsbase_u64 (unsigned long long __B)
  142. {
  143. __builtin_ia32_wrfsbase64 (__B);
  144. }
  145. extern __inline void
  146. __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  147. _writegsbase_u32 (unsigned int __B)
  148. {
  149. __builtin_ia32_wrgsbase32 (__B);
  150. }
  151. extern __inline void
  152. __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  153. _writegsbase_u64 (unsigned long long __B)
  154. {
  155. __builtin_ia32_wrgsbase64 (__B);
  156. }
  157. #ifdef __DISABLE_FSGSBASE__
  158. #undef __DISABLE_FSGSBASE__
  159. #pragma GCC pop_options
  160. #endif /* __DISABLE_FSGSBASE__ */
  161. #ifndef __RDRND__
  162. #pragma GCC push_options
  163. #pragma GCC target("rdrnd")
  164. #define __DISABLE_RDRND__
  165. #endif /* __RDRND__ */
  166. extern __inline int
  167. __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  168. _rdrand64_step (unsigned long long *__P)
  169. {
  170. return __builtin_ia32_rdrand64_step (__P);
  171. }
  172. #ifdef __DISABLE_RDRND__
  173. #undef __DISABLE_RDRND__
  174. #pragma GCC pop_options
  175. #endif /* __DISABLE_RDRND__ */
  176. #endif /* __x86_64__ */
  177. #ifndef __PTWRITE__
  178. #pragma GCC push_options
  179. #pragma GCC target("ptwrite")
  180. #define __DISABLE_PTWRITE__
  181. #endif
  182. #ifdef __x86_64__
  183. extern __inline void
  184. __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  185. _ptwrite64 (unsigned long long __B)
  186. {
  187. __builtin_ia32_ptwrite64 (__B);
  188. }
  189. #endif /* __x86_64__ */
  190. extern __inline void
  191. __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  192. _ptwrite32 (unsigned __B)
  193. {
  194. __builtin_ia32_ptwrite32 (__B);
  195. }
  196. #ifdef __DISABLE_PTWRITE__
  197. #undef __DISABLE_PTWRITE__
  198. #pragma GCC pop_options
  199. #endif /* __DISABLE_PTWRITE__ */
  200. #endif /* __iamcu__ */
  201. #ifdef __DISABLE_GENERAL_REGS_ONLY__
  202. #undef __DISABLE_GENERAL_REGS_ONLY__
  203. #pragma GCC pop_options
  204. #endif /* __DISABLE_GENERAL_REGS_ONLY__ */
  205. #endif /* _X86GPRINTRIN_H_INCLUDED. */