13 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__MMX__) 17 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__SSE__) 21 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__SSE2__) 25 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__SSE3__) 29 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__SSSE3__) 33 #if !defined(_MSC_VER) || __has_feature(modules) || \ 34 (defined(__SSE4_2__) || defined(__SSE4_1__)) 38 #if !defined(_MSC_VER) || __has_feature(modules) || \ 39 (defined(__AES__) || defined(__PCLMUL__)) 43 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__CLFLUSHOPT__) 47 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__CLWB__) 51 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX__) 55 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX2__) 59 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__F16C__) 63 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__VPCLMULQDQ__) 70 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__BMI2__) 74 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__LZCNT__) 78 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__POPCNT__) 82 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__FMA__) 86 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512F__) 90 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512VL__) 94 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512BW__) 98 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512BITALG__) 102 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512CD__) 106 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512VPOPCNTDQ__) 110 #if !defined(_MSC_VER) || __has_feature(modules) || \ 111 (defined(__AVX512VL__) && defined(__AVX512VPOPCNTDQ__)) 115 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512VNNI__) 119 #if !defined(_MSC_VER) || __has_feature(modules) || \ 120 (defined(__AVX512VL__) && defined(__AVX512VNNI__)) 124 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512DQ__) 128 #if !defined(_MSC_VER) || __has_feature(modules) || \ 129 (defined(__AVX512VL__) && defined(__AVX512BITALG__)) 133 #if !defined(_MSC_VER) || __has_feature(modules) || \ 134 (defined(__AVX512VL__) && defined(__AVX512BW__)) 138 #if !defined(_MSC_VER) || __has_feature(modules) || \ 139 (defined(__AVX512VL__) && defined(__AVX512CD__)) 143 #if !defined(_MSC_VER) || __has_feature(modules) || \ 144 (defined(__AVX512VL__) && defined(__AVX512DQ__)) 148 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512ER__) 152 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512IFMA__) 156 #if !defined(_MSC_VER) || __has_feature(modules) || \ 157 (defined(__AVX512IFMA__) && defined(__AVX512VL__)) 161 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512VBMI__) 165 #if !defined(_MSC_VER) || __has_feature(modules) || \ 166 (defined(__AVX512VBMI__) && defined(__AVX512VL__)) 170 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512VBMI2__) 174 #if !defined(_MSC_VER) || __has_feature(modules) || \ 175 (defined(__AVX512VBMI2__) && defined(__AVX512VL__)) 179 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512PF__) 183 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512BF16__) 187 #if !defined(_MSC_VER) || __has_feature(modules) || \ 188 (defined(__AVX512VL__) && defined(__AVX512BF16__)) 192 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__PKU__) 196 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__VAES__) 200 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__GFNI__) 204 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__RDPID__) 210 static __inline__
unsigned int __attribute__((__always_inline__, __nodebug__, __target__(
"rdpid")))
212 return __builtin_ia32_rdpid();
216 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__RDRND__) 217 static __inline__
int __attribute__((__always_inline__, __nodebug__, __target__(
"rdrnd")))
218 _rdrand16_step(
unsigned short *
__p)
220 return __builtin_ia32_rdrand16_step(__p);
223 static __inline__
int __attribute__((__always_inline__, __nodebug__, __target__(
"rdrnd")))
224 _rdrand32_step(
unsigned int *
__p)
226 return __builtin_ia32_rdrand32_step(__p);
230 static __inline__
int __attribute__((__always_inline__, __nodebug__, __target__(
"rdrnd")))
231 _rdrand64_step(
unsigned long long *__p)
233 return __builtin_ia32_rdrand64_step(__p);
238 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__FSGSBASE__) 240 static __inline__
unsigned int __attribute__((__always_inline__, __nodebug__, __target__(
"fsgsbase")))
241 _readfsbase_u32(
void)
243 return __builtin_ia32_rdfsbase32();
246 static __inline__
unsigned long long __attribute__((__always_inline__, __nodebug__, __target__(
"fsgsbase")))
247 _readfsbase_u64(
void)
249 return __builtin_ia32_rdfsbase64();
252 static __inline__
unsigned int __attribute__((__always_inline__, __nodebug__, __target__(
"fsgsbase")))
253 _readgsbase_u32(
void)
255 return __builtin_ia32_rdgsbase32();
258 static __inline__
unsigned long long __attribute__((__always_inline__, __nodebug__, __target__(
"fsgsbase")))
259 _readgsbase_u64(
void)
261 return __builtin_ia32_rdgsbase64();
264 static __inline__
void __attribute__((__always_inline__, __nodebug__, __target__(
"fsgsbase")))
265 _writefsbase_u32(
unsigned int __V)
267 __builtin_ia32_wrfsbase32(__V);
270 static __inline__
void __attribute__((__always_inline__, __nodebug__, __target__(
"fsgsbase")))
271 _writefsbase_u64(
unsigned long long __V)
273 __builtin_ia32_wrfsbase64(__V);
276 static __inline__
void __attribute__((__always_inline__, __nodebug__, __target__(
"fsgsbase")))
277 _writegsbase_u32(
unsigned int __V)
279 __builtin_ia32_wrgsbase32(__V);
282 static __inline__
void __attribute__((__always_inline__, __nodebug__, __target__(
"fsgsbase")))
283 _writegsbase_u64(
unsigned long long __V)
285 __builtin_ia32_wrgsbase64(__V);
291 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__MOVBE__) 299 static __inline__
short __attribute__((__always_inline__, __nodebug__, __target__(
"movbe")))
300 _loadbe_i16(
void const * __P) {
304 return __builtin_bswap16(((
const struct __loadu_i16*)__P)->
__v);
307 static __inline__
void __attribute__((__always_inline__, __nodebug__, __target__(
"movbe")))
308 _storebe_i16(
void * __P,
short __D) {
309 struct __storeu_i16 {
312 ((
struct __storeu_i16*)__P)->__v = __builtin_bswap16(__D);
315 static __inline__
int __attribute__((__always_inline__, __nodebug__, __target__(
"movbe")))
316 _loadbe_i32(
void const * __P) {
320 return __builtin_bswap32(((
const struct __loadu_i32*)__P)->
__v);
323 static __inline__
void __attribute__((__always_inline__, __nodebug__, __target__(
"movbe")))
324 _storebe_i32(
void * __P,
int __D) {
325 struct __storeu_i32 {
328 ((
struct __storeu_i32*)__P)->__v = __builtin_bswap32(__D);
332 static __inline__
long long __attribute__((__always_inline__, __nodebug__, __target__(
"movbe")))
333 _loadbe_i64(
void const * __P) {
337 return __builtin_bswap64(((
const struct __loadu_i64*)__P)->
__v);
340 static __inline__
void __attribute__((__always_inline__, __nodebug__, __target__(
"movbe")))
341 _storebe_i64(
void * __P,
long long __D) {
342 struct __storeu_i64 {
345 ((
struct __storeu_i64*)__P)->__v = __builtin_bswap64(__D);
350 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__RTM__) 355 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__SHA__) 359 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__FXSR__) 366 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__XSAVEOPT__) 370 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__XSAVEC__) 374 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__XSAVES__) 378 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__SHSTK__) 386 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__RDSEED__) 390 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__WBNOINVD__) 394 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__CLDEMOTE__) 398 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__WAITPKG__) 402 #if !defined(_MSC_VER) || __has_feature(modules) || \ 403 defined(__MOVDIRI__) || defined(__MOVDIR64B__) 407 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__PCONFIG__) 411 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__SGX__) 415 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__PTWRITE__) 419 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__INVPCID__) 423 #if !defined(_MSC_VER) || __has_feature(modules) || \ 424 defined(__AVX512VP2INTERSECT__) 428 #if !defined(_MSC_VER) || __has_feature(modules) || \ 429 (defined(__AVX512VL__) && defined(__AVX512VP2INTERSECT__)) 433 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__ENQCMD__) 437 #if defined(_MSC_VER) && __has_extension(gnu_asm) 439 #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__)) 446 #if defined(__i386__) || defined(__x86_64__) 448 _InterlockedExchange_HLEAcquire(
long volatile *_Target,
long _Value) {
449 __asm__ __volatile__(
".byte 0xf2 ; lock ; xchg %0, %1" 450 :
"+r" (_Value),
"+m" (*_Target) ::
"memory");
454 _InterlockedExchange_HLERelease(
long volatile *_Target,
long _Value) {
455 __asm__ __volatile__(
".byte 0xf3 ; lock ; xchg %0, %1" 456 :
"+r" (_Value),
"+m" (*_Target) ::
"memory");
460 #if defined(__x86_64__) 462 _InterlockedExchange64_HLEAcquire(__int64
volatile *_Target, __int64 _Value) {
463 __asm__ __volatile__(
".byte 0xf2 ; lock ; xchg %0, %1" 464 :
"+r" (_Value),
"+m" (*_Target) ::
"memory");
468 _InterlockedExchange64_HLERelease(__int64
volatile *_Target, __int64 _Value) {
469 __asm__ __volatile__(
".byte 0xf3 ; lock ; xchg %0, %1" 470 :
"+r" (_Value),
"+m" (*_Target) ::
"memory");
477 #if defined(__i386__) || defined(__x86_64__) 479 _InterlockedCompareExchange_HLEAcquire(
long volatile *_Destination,
480 long _Exchange,
long _Comparand) {
481 __asm__ __volatile__(
".byte 0xf2 ; lock ; cmpxchg %2, %1" 482 :
"+a" (_Comparand),
"+m" (*_Destination)
483 :
"r" (_Exchange) :
"memory");
487 _InterlockedCompareExchange_HLERelease(
long volatile *_Destination,
488 long _Exchange,
long _Comparand) {
489 __asm__ __volatile__(
".byte 0xf3 ; lock ; cmpxchg %2, %1" 490 :
"+a" (_Comparand),
"+m" (*_Destination)
491 :
"r" (_Exchange) :
"memory");
495 #if defined(__x86_64__) 497 _InterlockedCompareExchange64_HLEAcquire(__int64
volatile *_Destination,
498 __int64 _Exchange, __int64 _Comparand) {
499 __asm__ __volatile__(
".byte 0xf2 ; lock ; cmpxchg %2, %1" 500 :
"+a" (_Comparand),
"+m" (*_Destination)
501 :
"r" (_Exchange) :
"memory");
505 _InterlockedCompareExchange64_HLERelease(__int64
volatile *_Destination,
506 __int64 _Exchange, __int64 _Comparand) {
507 __asm__ __volatile__(
".byte 0xf3 ; lock ; cmpxchg %2, %1" 508 :
"+a" (_Comparand),
"+m" (*_Destination)
509 :
"r" (_Exchange) :
"memory");
517 #undef __DEFAULT_FN_ATTRS
struct __storeu_i16 *__P __v
static __inline__ void short __D
static __inline unsigned char unsigned int unsigned int unsigned int * __p
#define __DEFAULT_FN_ATTRS
static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__, __target__("rdpid"))) _rdpid_u32(void)
Returns the value of the IA32_TSC_AUX MSR (0xc0000103).