13#if !defined(__i386__) && !defined(__x86_64__)
14#error "This header is only meant to be used on x86 and x64 architecture"
136static __inline__
unsigned int __attribute__((__always_inline__, __nodebug__, __target__(
"rdpid")))
138 return __builtin_ia32_rdpid();
150static __inline__
int __attribute__((__always_inline__, __nodebug__, __target__(
"rdrnd")))
151_rdrand16_step(
unsigned short *
__p)
153 return (
int)__builtin_ia32_rdrand16_step(
__p);
165static __inline__
int __attribute__((__always_inline__, __nodebug__, __target__(
"rdrnd")))
166_rdrand32_step(
unsigned int *
__p)
168 return (
int)__builtin_ia32_rdrand32_step(
__p);
180static __inline__
int __attribute__((__always_inline__, __nodebug__, __target__(
"rdrnd")))
181_rdrand64_step(
unsigned long long *
__p)
184 return (
int)__builtin_ia32_rdrand64_step(
__p);
188 unsigned int __lo, __hi;
189 unsigned int __res_lo = __builtin_ia32_rdrand32_step(&__lo);
190 unsigned int __res_hi = __builtin_ia32_rdrand32_step(&__hi);
191 if (__res_lo && __res_hi) {
192 *
__p = ((
unsigned long long)__hi << 32) | (
unsigned long long)__lo;
209static __inline__
unsigned int __attribute__((__always_inline__, __nodebug__, __target__(
"fsgsbase")))
212 return __builtin_ia32_rdfsbase32();
222static __inline__
unsigned long long __attribute__((__always_inline__, __nodebug__, __target__(
"fsgsbase")))
225 return __builtin_ia32_rdfsbase64();
235static __inline__
unsigned int __attribute__((__always_inline__, __nodebug__, __target__(
"fsgsbase")))
238 return __builtin_ia32_rdgsbase32();
248static __inline__
unsigned long long __attribute__((__always_inline__, __nodebug__, __target__(
"fsgsbase")))
251 return __builtin_ia32_rdgsbase64();
262static __inline__
void __attribute__((__always_inline__, __nodebug__, __target__(
"fsgsbase")))
263_writefsbase_u32(
unsigned int __V)
265 __builtin_ia32_wrfsbase32(__V);
276static __inline__
void __attribute__((__always_inline__, __nodebug__, __target__(
"fsgsbase")))
277_writefsbase_u64(
unsigned long long __V)
279 __builtin_ia32_wrfsbase64(__V);
290static __inline__
void __attribute__((__always_inline__, __nodebug__, __target__(
"fsgsbase")))
291_writegsbase_u32(
unsigned int __V)
293 __builtin_ia32_wrgsbase32(__V);
304static __inline__
void __attribute__((__always_inline__, __nodebug__, __target__(
"fsgsbase")))
305_writegsbase_u64(
unsigned long long __V)
307 __builtin_ia32_wrgsbase64(__V);
327static __inline__
short __attribute__((__always_inline__, __nodebug__, __target__(
"movbe")))
328_loadbe_i16(
void const *
__P) {
332 return (
short)__builtin_bswap16(((
const struct __loadu_i16*)
__P)->
__v);
345static __inline__
void __attribute__((__always_inline__, __nodebug__, __target__(
"movbe")))
347 struct __storeu_i16 {
350 ((
struct __storeu_i16*)
__P)->
__v = __builtin_bswap16((
unsigned short)
__D);
362static __inline__
int __attribute__((__always_inline__, __nodebug__, __target__(
"movbe")))
363_loadbe_i32(
void const *
__P) {
367 return (
int)__builtin_bswap32(((
const struct __loadu_i32*)
__P)->
__v);
380static __inline__
void __attribute__((__always_inline__, __nodebug__, __target__(
"movbe")))
381_storebe_i32(
void *
__P,
int __D) {
382 struct __storeu_i32 {
385 ((
struct __storeu_i32*)
__P)->
__v = __builtin_bswap32((
unsigned int)
__D);
398static __inline__
long long __attribute__((__always_inline__, __nodebug__, __target__(
"movbe")))
399_loadbe_i64(
void const *
__P) {
401 unsigned long long __v;
403 return (
long long)__builtin_bswap64(((
const struct __loadu_i64*)
__P)->
__v);
416static __inline__
void __attribute__((__always_inline__, __nodebug__, __target__(
"movbe")))
417_storebe_i64(
void *
__P,
long long __D) {
418 struct __storeu_i64 {
419 unsigned long long __v;
421 ((
struct __storeu_i64*)
__P)->
__v = __builtin_bswap64((
unsigned long long)
__D);
515#if defined(_MSC_VER) && __has_extension(gnu_asm)
517#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
524#if defined(__i386__) || defined(__x86_64__)
526_InterlockedExchange_HLEAcquire(
long volatile *_Target,
long _Value) {
527 __asm__ __volatile__(
".byte 0xf2 ; lock ; xchg {%0, %1|%1, %0}"
528 :
"+r" (_Value),
"+m" (*_Target) ::
"memory");
532_InterlockedExchange_HLERelease(
long volatile *_Target,
long _Value) {
533 __asm__ __volatile__(
".byte 0xf3 ; lock ; xchg {%0, %1|%1, %0}"
534 :
"+r" (_Value),
"+m" (*_Target) ::
"memory");
538#if defined(__x86_64__)
540_InterlockedExchange64_HLEAcquire(__int64
volatile *_Target, __int64 _Value) {
541 __asm__ __volatile__(
".byte 0xf2 ; lock ; xchg {%0, %1|%1, %0}"
542 :
"+r" (_Value),
"+m" (*_Target) ::
"memory");
546_InterlockedExchange64_HLERelease(__int64
volatile *_Target, __int64 _Value) {
547 __asm__ __volatile__(
".byte 0xf3 ; lock ; xchg {%0, %1|%1, %0}"
548 :
"+r" (_Value),
"+m" (*_Target) ::
"memory");
555#if defined(__i386__) || defined(__x86_64__)
557_InterlockedCompareExchange_HLEAcquire(
long volatile *_Destination,
558 long _Exchange,
long _Comparand) {
559 __asm__ __volatile__(
".byte 0xf2 ; lock ; cmpxchg {%2, %1|%1, %2}"
560 :
"+a" (_Comparand),
"+m" (*_Destination)
561 :
"r" (_Exchange) :
"memory");
565_InterlockedCompareExchange_HLERelease(
long volatile *_Destination,
566 long _Exchange,
long _Comparand) {
567 __asm__ __volatile__(
".byte 0xf3 ; lock ; cmpxchg {%2, %1|%1, %2}"
568 :
"+a" (_Comparand),
"+m" (*_Destination)
569 :
"r" (_Exchange) :
"memory");
573#if defined(__x86_64__)
575_InterlockedCompareExchange64_HLEAcquire(__int64
volatile *_Destination,
576 __int64 _Exchange, __int64 _Comparand) {
577 __asm__ __volatile__(
".byte 0xf2 ; lock ; cmpxchg {%2, %1|%1, %2}"
578 :
"+a" (_Comparand),
"+m" (*_Destination)
579 :
"r" (_Exchange) :
"memory");
583_InterlockedCompareExchange64_HLERelease(__int64
volatile *_Destination,
584 __int64 _Exchange, __int64 _Comparand) {
585 __asm__ __volatile__(
".byte 0xf3 ; lock ; cmpxchg {%2, %1|%1, %2}"
586 :
"+a" (_Comparand),
"+m" (*_Destination)
587 :
"r" (_Exchange) :
"memory");
595#undef __DEFAULT_FN_ATTRS
_Float16 __2f16 __attribute__((ext_vector_type(2)))
Zeroes the upper 128 bits (bits 255:128) of all YMM registers.
#define __DEFAULT_FN_ATTRS
static __inline__ uint32_t volatile uint32_t * __p
__asm__("swp %0, %1, [%2]" :"=r"(__v) :"r"(__x), "r"(__p) :"memory")
static __inline__ void short __D
__inline unsigned int unsigned int unsigned int * __P