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