ReactOS 0.4.17-dev-540-g8f54750
intrin_arm64.h File Reference

Go to the source code of this file.

Macros

#define HAS_BUILTIN(x)   0
 
#define __INTRIN_INLINE   extern __inline__ __attribute__((__always_inline__, __gnu_inline__))
 
#define _ReturnAddress()   (__builtin_return_address(0))
 
#define _AddressOfReturnAddress()   ((void *)((unsigned char *)__builtin_frame_address(0) + 8))
 
#define _ReadBarrier   _ReadWriteBarrier
 
#define _WriteBarrier   _ReadWriteBarrier
 
#define __getReg(reg)
 

Typedefs

typedef __int128 __attribute__((may_alias)) __ms_int128_t
 

Functions

__INTRIN_INLINE void __break (int value)
 
__INTRIN_INLINE void _ReadWriteBarrier (void)
 
__INTRIN_INLINE unsigned short _byteswap_ushort (unsigned short value)
 
__INTRIN_INLINE unsigned long __cdecl _byteswap_ulong (unsigned long value)
 
__INTRIN_INLINE unsigned __int64 __cdecl _byteswap_uint64 (unsigned __int64 value)
 
__INTRIN_INLINE unsigned char _BitScanForward (unsigned long *Index, unsigned long Mask)
 
__INTRIN_INLINE unsigned char _BitScanReverse (unsigned long *Index, unsigned long Mask)
 
__INTRIN_INLINE unsigned char _BitScanForward64 (unsigned long *Index, unsigned long long Mask)
 
__INTRIN_INLINE unsigned char _BitScanReverse64 (unsigned long *Index, unsigned long long Mask)
 
__INTRIN_INLINE long _InterlockedCompareExchange (volatile long *Destination, long Exchange, long Comparand)
 
__INTRIN_INLINE short _InterlockedCompareExchange16 (volatile short *Destination, short Exchange, short Comparand)
 
__INTRIN_INLINE char _InterlockedCompareExchange8 (volatile char *Destination, char Exchange, char Comparand)
 
__INTRIN_INLINE long long _InterlockedCompareExchange64 (volatile long long *Destination, long long Exchange, long long Comparand)
 
__INTRIN_INLINE void_InterlockedCompareExchangePointer (void *volatile *Destination, void *Exchange, void *Comparand)
 
__INTRIN_INLINE long _InterlockedExchange (volatile long *Target, long Value)
 
__INTRIN_INLINE short _InterlockedExchange16 (volatile short *Target, short Value)
 
__INTRIN_INLINE char _InterlockedExchange8 (volatile char *Target, char Value)
 
__INTRIN_INLINE long long _InterlockedExchange64 (volatile long long *Target, long long Value)
 
__INTRIN_INLINE void_InterlockedExchangePointer (void *volatile *Target, void *Value)
 
__INTRIN_INLINE long _InterlockedExchangeAdd (volatile long *Addend, long Value)
 
__INTRIN_INLINE short _InterlockedExchangeAdd16 (volatile short *Addend, short Value)
 
__INTRIN_INLINE char _InterlockedExchangeAdd8 (volatile char *Addend, char Value)
 
__INTRIN_INLINE long long _InterlockedExchangeAdd64 (volatile long long *Addend, long long Value)
 
__INTRIN_INLINE long _InterlockedAnd (volatile long *Value, long Mask)
 
__INTRIN_INLINE short _InterlockedAnd16 (volatile short *Value, short Mask)
 
__INTRIN_INLINE char _InterlockedAnd8 (volatile char *Value, char Mask)
 
__INTRIN_INLINE long long _InterlockedAnd64 (volatile long long *Value, long long Mask)
 
__INTRIN_INLINE long _InterlockedOr (volatile long *Value, long Mask)
 
__INTRIN_INLINE short _InterlockedOr16 (volatile short *Value, short Mask)
 
__INTRIN_INLINE char _InterlockedOr8 (volatile char *Value, char Mask)
 
__INTRIN_INLINE long long _InterlockedOr64 (volatile long long *Value, long long Mask)
 
__INTRIN_INLINE long _InterlockedXor (volatile long *Value, long Mask)
 
__INTRIN_INLINE short _InterlockedXor16 (volatile short *Value, short Mask)
 
__INTRIN_INLINE char _InterlockedXor8 (volatile char *Value, char Mask)
 
__INTRIN_INLINE long long _InterlockedXor64 (volatile long long *Value, long long Mask)
 
__INTRIN_INLINE long _InterlockedIncrement (volatile long *Addend)
 
__INTRIN_INLINE short _InterlockedIncrement16 (volatile short *Addend)
 
__INTRIN_INLINE long long _InterlockedIncrement64 (volatile long long *Addend)
 
__INTRIN_INLINE long _InterlockedDecrement (volatile long *Addend)
 
__INTRIN_INLINE short _InterlockedDecrement16 (volatile short *Addend)
 
__INTRIN_INLINE long long _InterlockedDecrement64 (volatile long long *Addend)
 
__INTRIN_INLINE unsigned char _InterlockedCompareExchange128 (volatile __int64 *Destination, __int64 ExchangeHigh, __int64 ExchangeLow, __int64 *ComparandResult)
 
__INTRIN_INLINE void __nop (void)
 
__INTRIN_INLINE unsigned char _bittest (const long *a, long b)
 
__INTRIN_INLINE unsigned char _bittestandset (long *a, long b)
 
__INTRIN_INLINE unsigned char _bittestandreset (long *a, long b)
 
__INTRIN_INLINE unsigned char _bittestandcomplement (long *a, long b)
 
__INTRIN_INLINE unsigned char _bittest64 (const long long *a, long long b)
 
__INTRIN_INLINE unsigned char _bittestandset64 (long long *a, long long b)
 
__INTRIN_INLINE unsigned char _bittestandreset64 (long long *a, long long b)
 
__INTRIN_INLINE unsigned char _bittestandcomplement64 (long long *a, long long b)
 
__INTRIN_INLINE unsigned char _interlockedbittestandreset (volatile long *a, long b)
 
__INTRIN_INLINE unsigned char _interlockedbittestandset (volatile long *a, long b)
 
__INTRIN_INLINE unsigned char _interlockedbittestandreset64 (volatile long long *a, long long b)
 
__INTRIN_INLINE unsigned char _interlockedbittestandset64 (volatile long long *a, long long b)
 
__INTRIN_INLINE unsigned char __cdecl _rotl8 (unsigned char value, unsigned char shift)
 
__INTRIN_INLINE unsigned short __cdecl _rotl16 (unsigned short value, unsigned char shift)
 
__INTRIN_INLINE unsigned int __cdecl _rotl (unsigned int value, int shift)
 
__INTRIN_INLINE unsigned long long _rotl64 (unsigned long long value, int shift)
 
__INTRIN_INLINE unsigned char __cdecl _rotr8 (unsigned char value, unsigned char shift)
 
__INTRIN_INLINE unsigned short __cdecl _rotr16 (unsigned short value, unsigned char shift)
 
__INTRIN_INLINE unsigned int __cdecl _rotr (unsigned int value, int shift)
 
__INTRIN_INLINE unsigned long long _rotr64 (unsigned long long value, int shift)
 
__INTRIN_INLINE unsigned long __cdecl _lrotl (unsigned long value, int shift)
 
__INTRIN_INLINE unsigned long __cdecl _lrotr (unsigned long value, int shift)
 
__INTRIN_INLINE unsigned int _CountLeadingZeros (unsigned long value)
 
__INTRIN_INLINE unsigned int _CountLeadingZeros64 (unsigned __int64 value)
 
__INTRIN_INLINE unsigned int _CountOneBits (unsigned long value)
 
__INTRIN_INLINE unsigned int _CountOneBits64 (unsigned __int64 value)
 
__INTRIN_INLINE long long __mulh (long long a, long long b)
 
__INTRIN_INLINE unsigned long long __umulh (unsigned long long a, unsigned long long b)
 
__INTRIN_INLINE long long __cdecl _abs64 (long long value)
 
__INTRIN_INLINE void __yield (void)
 
__INTRIN_INLINE void __dmb (unsigned int type)
 
__INTRIN_INLINE void __dsb (unsigned int type)
 
__INTRIN_INLINE void __isb (unsigned int type)
 
__INTRIN_INLINE long _InterlockedAdd (volatile long *Addend, long Value)
 
__INTRIN_INLINE long long _InterlockedAdd64 (volatile long long *Addend, long long Value)
 
__INTRIN_INLINE unsigned char __readx18byte (unsigned long offset)
 
__INTRIN_INLINE unsigned short __readx18word (unsigned long offset)
 
__INTRIN_INLINE unsigned long __readx18dword (unsigned long offset)
 
__INTRIN_INLINE unsigned __int64 __readx18qword (unsigned long offset)
 
__INTRIN_INLINE void __writex18byte (unsigned long offset, unsigned char value)
 
__INTRIN_INLINE void __writex18word (unsigned long offset, unsigned short value)
 
__INTRIN_INLINE void __writex18dword (unsigned long offset, unsigned long value)
 
__INTRIN_INLINE void __writex18qword (unsigned long offset, unsigned __int64 value)
 

Macro Definition Documentation

◆ __getReg

#define __getReg (   reg)
Value:
__extension__({ \
_Static_assert((unsigned long long)(reg) <= 31ULL, \
"__getReg: register index out of range"); \
unsigned __int64 _value; \
__asm__ __volatile__("mov %0, x%c1" : "=r"(_value) : "i"(reg)); \
_value; \
})
#define __int64
Definition: corecrt.h:72
static int reg
Definition: i386-dis.c:1290
__asm__(".p2align 4, 0x90\n" ".seh_proc __seh2_global_filter_func\n" "__seh2_global_filter_func:\n" "\tsub %rbp, %rax\n" "\tpush %rbp\n" "\t.seh_pushreg %rbp\n" "\tpush %rbx\n" "\t.seh_pushreg %rbx\n" "\tpush %rdi\n" "\t.seh_pushreg %rdi\n" "\tpush %rsi\n" "\t.seh_pushreg %rsi\n" "\tpush %r12\n" "\t.seh_pushreg %r12\n" "\tpush %r13\n" "\t.seh_pushreg %r13\n" "\tpush %r14\n" "\t.seh_pushreg %r14\n" "\tpush %r15\n" "\t.seh_pushreg %r15\n" "\tsub $40, %rsp\n" "\t.seh_stackalloc 40\n" "\t.seh_endprologue\n" "\tsub %rax, %rdx\n" "\tmov %rdx, %rbp\n" "\tjmp *%r8\n" "__seh2_global_filter_func_exit:\n" "\t.p2align 4\n" "\tadd $40, %rsp\n" "\tpop %r15\n" "\tpop %r14\n" "\tpop %r13\n" "\tpop %r12\n" "\tpop %rsi\n" "\tpop %rdi\n" "\tpop %rbx\n" "\tpop %rbp\n" "\tret\n" "\t.seh_endproc")

Definition at line 753 of file intrin_arm64.h.

◆ __INTRIN_INLINE

#define __INTRIN_INLINE   extern __inline__ __attribute__((__always_inline__, __gnu_inline__))

Definition at line 45 of file intrin_arm64.h.

◆ _AddressOfReturnAddress

#define _AddressOfReturnAddress (   void)    ((void *)((unsigned char *)__builtin_frame_address(0) + 8))

Definition at line 50 of file intrin_arm64.h.

◆ _ReadBarrier

#define _ReadBarrier (   void)    _ReadWriteBarrier

Definition at line 66 of file intrin_arm64.h.

◆ _ReturnAddress

#define _ReturnAddress (   void)    (__builtin_return_address(0))

Definition at line 48 of file intrin_arm64.h.

◆ _WriteBarrier

#define _WriteBarrier (   void)    _ReadWriteBarrier

Definition at line 67 of file intrin_arm64.h.

◆ HAS_BUILTIN

#define HAS_BUILTIN (   x)    0

Definition at line 37 of file intrin_arm64.h.

Typedef Documentation

◆ __attribute__

typedef __int128 __attribute__((may_alias)) __ms_int128_t

Definition at line 361 of file intrin_arm64.h.

Function Documentation

◆ __break()

__INTRIN_INLINE void __break ( int  value)

Definition at line 53 of file intrin_arm64.h.

54{
55 __asm__ __volatile__("brk %0" : : "i"(value));
56}
Definition: pdh_main.c:96

◆ __dmb()

__INTRIN_INLINE void __dmb ( unsigned int  type)

Definition at line 694 of file intrin_arm64.h.

695{
696 /* MS _ARM64_BARRIER_* constants: OSHLD=1 OSHST=2 OSH=3 NSHLD=5 NSHST=6
697 NSH=7 ISHLD=9 ISHST=10 ISH=11 LD=13 ST=14 SY=15. The dmb option must
698 be an assembler literal, so we dispatch on the runtime value. */
699 switch (type)
700 {
701 case 1: __asm__ __volatile__("dmb oshld" ::: "memory"); break;
702 case 2: __asm__ __volatile__("dmb oshst" ::: "memory"); break;
703 case 3: __asm__ __volatile__("dmb osh" ::: "memory"); break;
704 case 5: __asm__ __volatile__("dmb nshld" ::: "memory"); break;
705 case 6: __asm__ __volatile__("dmb nshst" ::: "memory"); break;
706 case 7: __asm__ __volatile__("dmb nsh" ::: "memory"); break;
707 case 9: __asm__ __volatile__("dmb ishld" ::: "memory"); break;
708 case 10: __asm__ __volatile__("dmb ishst" ::: "memory"); break;
709 case 11: __asm__ __volatile__("dmb ish" ::: "memory"); break;
710 case 13: __asm__ __volatile__("dmb ld" ::: "memory"); break;
711 case 14: __asm__ __volatile__("dmb st" ::: "memory"); break;
712 default: __asm__ __volatile__("dmb sy" ::: "memory"); break;
713 }
714}
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545

Referenced by YieldProcessor().

◆ __dsb()

__INTRIN_INLINE void __dsb ( unsigned int  type)

Definition at line 718 of file intrin_arm64.h.

719{
720 switch (type)
721 {
722 case 1: __asm__ __volatile__("dsb oshld" ::: "memory"); break;
723 case 2: __asm__ __volatile__("dsb oshst" ::: "memory"); break;
724 case 3: __asm__ __volatile__("dsb osh" ::: "memory"); break;
725 case 5: __asm__ __volatile__("dsb nshld" ::: "memory"); break;
726 case 6: __asm__ __volatile__("dsb nshst" ::: "memory"); break;
727 case 7: __asm__ __volatile__("dsb nsh" ::: "memory"); break;
728 case 9: __asm__ __volatile__("dsb ishld" ::: "memory"); break;
729 case 10: __asm__ __volatile__("dsb ishst" ::: "memory"); break;
730 case 11: __asm__ __volatile__("dsb ish" ::: "memory"); break;
731 case 13: __asm__ __volatile__("dsb ld" ::: "memory"); break;
732 case 14: __asm__ __volatile__("dsb st" ::: "memory"); break;
733 default: __asm__ __volatile__("dsb sy" ::: "memory"); break;
734 }
735}

◆ __isb()

__INTRIN_INLINE void __isb ( unsigned int  type)

Definition at line 739 of file intrin_arm64.h.

740{
741 /* ISB on ARM64 only supports the 'sy' option; accept the type arg
742 for API compatibility with MS docs and ignore it. */
743 (void)type;
744 __asm__ __volatile__("isb" ::: "memory");
745}

◆ __mulh()

__INTRIN_INLINE long long __mulh ( long long  a,
long long  b 
)

Definition at line 664 of file intrin_arm64.h.

665{
666 return ((__int128)a * (__int128)b) >> 64;
667}
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204

◆ __nop()

__INTRIN_INLINE void __nop ( void  )

Definition at line 400 of file intrin_arm64.h.

401{
402 __asm__ __volatile__("nop");
403}

◆ __readx18byte()

__INTRIN_INLINE unsigned char __readx18byte ( unsigned long  offset)

Definition at line 782 of file intrin_arm64.h.

783{
784 unsigned char value;
785 __asm__ __volatile__("ldrb %w0, [x18, %1]" : "=r"(value) : "r"((unsigned long long)offset));
786 return value;
787}
GLintptr offset
Definition: glext.h:5920

◆ __readx18dword()

__INTRIN_INLINE unsigned long __readx18dword ( unsigned long  offset)

Definition at line 800 of file intrin_arm64.h.

801{
802 unsigned long value;
803 __asm__ __volatile__("ldr %w0, [x18, %1]" : "=r"(value) : "r"((unsigned long long)offset));
804 return value;
805}

◆ __readx18qword()

__INTRIN_INLINE unsigned __int64 __readx18qword ( unsigned long  offset)

Definition at line 809 of file intrin_arm64.h.

810{
811 unsigned __int64 value;
812 __asm__ __volatile__("ldr %0, [x18, %1]" : "=r"(value) : "r"((unsigned long long)offset));
813 return value;
814}

◆ __readx18word()

__INTRIN_INLINE unsigned short __readx18word ( unsigned long  offset)

Definition at line 791 of file intrin_arm64.h.

792{
793 unsigned short value;
794 __asm__ __volatile__("ldrh %w0, [x18, %1]" : "=r"(value) : "r"((unsigned long long)offset));
795 return value;
796}

◆ __umulh()

Definition at line 671 of file intrin_arm64.h.

672{
673 return ((unsigned __int128)a * (unsigned __int128)b) >> 64;
674}

◆ __writex18byte()

__INTRIN_INLINE void __writex18byte ( unsigned long  offset,
unsigned char  value 
)

Definition at line 818 of file intrin_arm64.h.

819{
820 __asm__ __volatile__("strb %w1, [x18, %0]" : : "r"((unsigned long long)offset), "r"(value) : "memory");
821}

◆ __writex18dword()

__INTRIN_INLINE void __writex18dword ( unsigned long  offset,
unsigned long  value 
)

Definition at line 832 of file intrin_arm64.h.

833{
834 __asm__ __volatile__("str %w1, [x18, %0]" : : "r"((unsigned long long)offset), "r"(value) : "memory");
835}

◆ __writex18qword()

__INTRIN_INLINE void __writex18qword ( unsigned long  offset,
unsigned __int64  value 
)

Definition at line 839 of file intrin_arm64.h.

840{
841 __asm__ __volatile__("str %1, [x18, %0]" : : "r"((unsigned long long)offset), "r"(value) : "memory");
842}

◆ __writex18word()

__INTRIN_INLINE void __writex18word ( unsigned long  offset,
unsigned short  value 
)

Definition at line 825 of file intrin_arm64.h.

826{
827 __asm__ __volatile__("strh %w1, [x18, %0]" : : "r"((unsigned long long)offset), "r"(value) : "memory");
828}

◆ __yield()

__INTRIN_INLINE void __yield ( void  )

Definition at line 687 of file intrin_arm64.h.

688{
689 __asm__ __volatile__("yield");
690}

◆ _abs64()

Definition at line 678 of file intrin_arm64.h.

679{
680 return (value >= 0) ? value : -value;
681}

◆ _BitScanForward()

__INTRIN_INLINE unsigned char _BitScanForward ( unsigned long Index,
unsigned long  Mask 
)

Definition at line 91 of file intrin_arm64.h.

92{
93 if (!Mask)
94 return 0;
95
96 *Index = __builtin_ctzl(Mask);
97 return 1;
98}
unsigned int Mask
Definition: fpcontrol.c:82
_In_ WDFCOLLECTION _In_ ULONG Index

◆ _BitScanForward64()

__INTRIN_INLINE unsigned char _BitScanForward64 ( unsigned long Index,
unsigned long long  Mask 
)

Definition at line 113 of file intrin_arm64.h.

114{
115 if (!Mask)
116 return 0;
117
118 *Index = __builtin_ctzll(Mask);
119 return 1;
120}

Referenced by uacpi_bit_scan_forward().

◆ _BitScanReverse()

__INTRIN_INLINE unsigned char _BitScanReverse ( unsigned long Index,
unsigned long  Mask 
)

Definition at line 102 of file intrin_arm64.h.

103{
104 if (!Mask)
105 return 0;
106
107 *Index = 31 - __builtin_clzl(Mask);
108 return 1;
109}

◆ _BitScanReverse64()

__INTRIN_INLINE unsigned char _BitScanReverse64 ( unsigned long Index,
unsigned long long  Mask 
)

Definition at line 124 of file intrin_arm64.h.

125{
126 if (!Mask)
127 return 0;
128
129 *Index = 63 - __builtin_clzll(Mask);
130 return 1;
131}

Referenced by uacpi_bit_scan_backward().

◆ _bittest()

__INTRIN_INLINE unsigned char _bittest ( const long a,
long  b 
)

Definition at line 408 of file intrin_arm64.h.

409{
410 return (a[b / 32] >> (b % 32)) & 1;
411}

◆ _bittest64()

__INTRIN_INLINE unsigned char _bittest64 ( const long long a,
long long  b 
)

Definition at line 448 of file intrin_arm64.h.

449{
450 return (a[b / 64] >> (b % 64)) & 1;
451}

◆ _bittestandcomplement()

__INTRIN_INLINE unsigned char _bittestandcomplement ( long a,
long  b 
)

Definition at line 437 of file intrin_arm64.h.

438{
439 long bit = 1L << (b % 32);
440 long *ptr = &a[b / 32];
441 unsigned char retval = (*ptr >> (b % 32)) & 1;
442 *ptr ^= bit;
443 return retval;
444}
static PVOID ptr
Definition: dispmode.c:27
int retval
Definition: wcstombs.cpp:91

◆ _bittestandcomplement64()

__INTRIN_INLINE unsigned char _bittestandcomplement64 ( long long a,
long long  b 
)

Definition at line 477 of file intrin_arm64.h.

478{
479 long long bit = 1LL << (b % 64);
480 long long *ptr = &a[b / 64];
481 unsigned char retval = (*ptr >> (b % 64)) & 1;
482 *ptr ^= bit;
483 return retval;
484}

◆ _bittestandreset()

__INTRIN_INLINE unsigned char _bittestandreset ( long a,
long  b 
)

Definition at line 426 of file intrin_arm64.h.

427{
428 long bit = 1L << (b % 32);
429 long *ptr = &a[b / 32];
430 unsigned char retval = (*ptr >> (b % 32)) & 1;
431 *ptr &= ~bit;
432 return retval;
433}

◆ _bittestandreset64()

__INTRIN_INLINE unsigned char _bittestandreset64 ( long long a,
long long  b 
)

Definition at line 466 of file intrin_arm64.h.

467{
468 long long bit = 1LL << (b % 64);
469 long long *ptr = &a[b / 64];
470 unsigned char retval = (*ptr >> (b % 64)) & 1;
471 *ptr &= ~bit;
472 return retval;
473}

◆ _bittestandset()

__INTRIN_INLINE unsigned char _bittestandset ( long a,
long  b 
)

Definition at line 415 of file intrin_arm64.h.

416{
417 long bit = 1L << (b % 32);
418 long *ptr = &a[b / 32];
419 unsigned char retval = (*ptr >> (b % 32)) & 1;
420 *ptr |= bit;
421 return retval;
422}

◆ _bittestandset64()

__INTRIN_INLINE unsigned char _bittestandset64 ( long long a,
long long  b 
)

Definition at line 455 of file intrin_arm64.h.

456{
457 long long bit = 1LL << (b % 64);
458 long long *ptr = &a[b / 64];
459 unsigned char retval = (*ptr >> (b % 64)) & 1;
460 *ptr |= bit;
461 return retval;
462}

◆ _byteswap_uint64()

__INTRIN_INLINE unsigned __int64 __cdecl _byteswap_uint64 ( unsigned __int64  value)

Definition at line 84 of file intrin_arm64.h.

85{
86 return __builtin_bswap64(value);
87}

Referenced by RtlUlonglongByteSwap().

◆ _byteswap_ulong()

__INTRIN_INLINE unsigned long __cdecl _byteswap_ulong ( unsigned long  value)

Definition at line 77 of file intrin_arm64.h.

78{
79 return __builtin_bswap32(value);
80}

◆ _byteswap_ushort()

__INTRIN_INLINE unsigned short _byteswap_ushort ( unsigned short  value)

Definition at line 70 of file intrin_arm64.h.

71{
72 return __builtin_bswap16(value);
73}

◆ _CountLeadingZeros()

__INTRIN_INLINE unsigned int _CountLeadingZeros ( unsigned long  value)

Definition at line 631 of file intrin_arm64.h.

632{
633 if (!value)
634 return sizeof(value) * 8;
635 return __builtin_clzl(value);
636}

◆ _CountLeadingZeros64()

__INTRIN_INLINE unsigned int _CountLeadingZeros64 ( unsigned __int64  value)

Definition at line 640 of file intrin_arm64.h.

641{
642 if (!value)
643 return 64;
644 return __builtin_clzll(value);
645}

◆ _CountOneBits()

__INTRIN_INLINE unsigned int _CountOneBits ( unsigned long  value)

Definition at line 649 of file intrin_arm64.h.

650{
651 return __builtin_popcountl(value);
652}

◆ _CountOneBits64()

__INTRIN_INLINE unsigned int _CountOneBits64 ( unsigned __int64  value)

Definition at line 656 of file intrin_arm64.h.

657{
658 return __builtin_popcountll(value);
659}

◆ _InterlockedAdd()

__INTRIN_INLINE long _InterlockedAdd ( volatile long Addend,
long  Value 
)

Definition at line 765 of file intrin_arm64.h.

766{
767 return __atomic_add_fetch(Addend, Value, __ATOMIC_SEQ_CST);
768}
IN OUT PLONG Addend
Definition: CrNtStubs.h:25
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413

◆ _InterlockedAdd64()

__INTRIN_INLINE long long _InterlockedAdd64 ( volatile long long Addend,
long long  Value 
)

Definition at line 772 of file intrin_arm64.h.

773{
774 return __atomic_add_fetch(Addend, Value, __ATOMIC_SEQ_CST);
775}

◆ _InterlockedAnd()

__INTRIN_INLINE long _InterlockedAnd ( volatile long Value,
long  Mask 
)

Definition at line 234 of file intrin_arm64.h.

235{
236 return __sync_fetch_and_and(Value, Mask);
237}

◆ _InterlockedAnd16()

__INTRIN_INLINE short _InterlockedAnd16 ( volatile short Value,
short  Mask 
)

Definition at line 241 of file intrin_arm64.h.

242{
243 return __sync_fetch_and_and(Value, Mask);
244}

◆ _InterlockedAnd64()

__INTRIN_INLINE long long _InterlockedAnd64 ( volatile long long Value,
long long  Mask 
)

Definition at line 255 of file intrin_arm64.h.

256{
257 return __sync_fetch_and_and(Value, Mask);
258}

◆ _InterlockedAnd8()

__INTRIN_INLINE char _InterlockedAnd8 ( volatile char Value,
char  Mask 
)

Definition at line 248 of file intrin_arm64.h.

249{
250 return __sync_fetch_and_and(Value, Mask);
251}

◆ _interlockedbittestandreset()

__INTRIN_INLINE unsigned char _interlockedbittestandreset ( volatile long a,
long  b 
)

Definition at line 489 of file intrin_arm64.h.

490{
491 unsigned int bit = b & 31;
492 long mask = 1L << bit;
493 long old = __sync_fetch_and_and(a, ~mask);
494 return (unsigned char)((old >> bit) & 1);
495}
GLenum GLint GLuint mask
Definition: glext.h:6028

◆ _interlockedbittestandreset64()

__INTRIN_INLINE unsigned char _interlockedbittestandreset64 ( volatile long long a,
long long  b 
)

Definition at line 509 of file intrin_arm64.h.

510{
511 unsigned int bit = b & 63;
512 long long mask = 1LL << bit;
513 long long old = __sync_fetch_and_and(a, ~mask);
514 return (unsigned char)((old >> bit) & 1);
515}

◆ _interlockedbittestandset()

__INTRIN_INLINE unsigned char _interlockedbittestandset ( volatile long a,
long  b 
)

Definition at line 499 of file intrin_arm64.h.

500{
501 unsigned int bit = b & 31;
502 long mask = 1L << bit;
503 long old = __sync_fetch_and_or(a, mask);
504 return (unsigned char)((old >> bit) & 1);
505}

◆ _interlockedbittestandset64()

__INTRIN_INLINE unsigned char _interlockedbittestandset64 ( volatile long long a,
long long  b 
)

Definition at line 519 of file intrin_arm64.h.

520{
521 unsigned int bit = b & 63;
522 long long mask = 1LL << bit;
523 long long old = __sync_fetch_and_or(a, mask);
524 return (unsigned char)((old >> bit) & 1);
525}

◆ _InterlockedCompareExchange()

__INTRIN_INLINE long _InterlockedCompareExchange ( volatile long Destination,
long  Exchange,
long  Comparand 
)

Definition at line 135 of file intrin_arm64.h.

136{
137 return __sync_val_compare_and_swap(Destination, Comparand, Exchange);
138}
_In_ PUNICODE_STRING _Inout_ PUNICODE_STRING Destination
Definition: rtlfuncs.h:3051

◆ _InterlockedCompareExchange128()

__INTRIN_INLINE unsigned char _InterlockedCompareExchange128 ( volatile __int64 Destination,
__int64  ExchangeHigh,
__int64  ExchangeLow,
__int64 ComparandResult 
)

Definition at line 362 of file intrin_arm64.h.

365{
366 /* Baseline armv8-a LL/SC; matches MS full-barrier contract. */
367 unsigned __int64 cmp_lo = (unsigned __int64)ComparandResult[0];
368 unsigned __int64 cmp_hi = (unsigned __int64)ComparandResult[1];
369 unsigned __int64 old_lo, old_hi;
370 unsigned int status;
371 __asm__ __volatile__(
372 "1: ldaxp %[ol], %[oh], %[mem] \n"
373 " cmp %[ol], %[cl] \n"
374 " ccmp %[oh], %[ch], #0, eq \n"
375 " b.ne 2f \n"
376 " stlxp %w[st], %[xl], %[xh], %[mem] \n"
377 " cbnz %w[st], 1b \n"
378 " mov %w[st], #0 \n"
379 " b 3f \n"
380 "2: clrex \n"
381 " mov %w[st], #1 \n"
382 "3: \n"
383 : [ol] "=&r"(old_lo), [oh] "=&r"(old_hi),
384 [st] "=&r"(status),
385 [mem] "+Q"(*(volatile __ms_int128_t *)Destination)
386 : [cl] "r"(cmp_lo), [ch] "r"(cmp_hi),
387 [xl] "r"((unsigned __int64)ExchangeLow),
388 [xh] "r"((unsigned __int64)ExchangeHigh)
389 : "cc", "memory");
390 __asm__ __volatile__("dmb ish" ::: "memory");
391 if (status == 0)
392 return 1;
393 ComparandResult[0] = (__int64)old_lo;
394 ComparandResult[1] = (__int64)old_hi;
395 return 0;
396}
unsigned char ch[4][2]
Definition: console.c:118
Definition: mem.c:349
Definition: ps.c:97

Referenced by RtlInterlockedPushListSList().

◆ _InterlockedCompareExchange16()

__INTRIN_INLINE short _InterlockedCompareExchange16 ( volatile short Destination,
short  Exchange,
short  Comparand 
)

Definition at line 142 of file intrin_arm64.h.

143{
144 return __sync_val_compare_and_swap(Destination, Comparand, Exchange);
145}

◆ _InterlockedCompareExchange64()

__INTRIN_INLINE long long _InterlockedCompareExchange64 ( volatile long long Destination,
long long  Exchange,
long long  Comparand 
)

Definition at line 156 of file intrin_arm64.h.

157{
158 return __sync_val_compare_and_swap(Destination, Comparand, Exchange);
159}

◆ _InterlockedCompareExchange8()

__INTRIN_INLINE char _InterlockedCompareExchange8 ( volatile char Destination,
char  Exchange,
char  Comparand 
)

Definition at line 149 of file intrin_arm64.h.

150{
151 return __sync_val_compare_and_swap(Destination, Comparand, Exchange);
152}

◆ _InterlockedCompareExchangePointer()

__INTRIN_INLINE void * _InterlockedCompareExchangePointer ( void *volatile Destination,
void Exchange,
void Comparand 
)

Definition at line 163 of file intrin_arm64.h.

164{
165 return __sync_val_compare_and_swap(Destination, Comparand, Exchange);
166}

◆ _InterlockedDecrement()

__INTRIN_INLINE long _InterlockedDecrement ( volatile long Addend)

Definition at line 339 of file intrin_arm64.h.

340{
341 return __sync_sub_and_fetch(Addend, 1);
342}

◆ _InterlockedDecrement16()

__INTRIN_INLINE short _InterlockedDecrement16 ( volatile short Addend)

Definition at line 346 of file intrin_arm64.h.

347{
348 return __sync_sub_and_fetch(Addend, 1);
349}

◆ _InterlockedDecrement64()

__INTRIN_INLINE long long _InterlockedDecrement64 ( volatile long long Addend)

Definition at line 353 of file intrin_arm64.h.

354{
355 return __sync_sub_and_fetch(Addend, 1);
356}

◆ _InterlockedExchange()

__INTRIN_INLINE long _InterlockedExchange ( volatile long Target,
long  Value 
)

Definition at line 170 of file intrin_arm64.h.

171{
172 /* MS _InterlockedExchange is a full barrier; __sync_lock_test_and_set is acquire-only. */
173 return __atomic_exchange_n(Target, Value, __ATOMIC_SEQ_CST);
174}
_In_ WDFIOTARGET Target
Definition: wdfrequest.h:306

◆ _InterlockedExchange16()

__INTRIN_INLINE short _InterlockedExchange16 ( volatile short Target,
short  Value 
)

Definition at line 178 of file intrin_arm64.h.

179{
180 return __atomic_exchange_n(Target, Value, __ATOMIC_SEQ_CST);
181}

◆ _InterlockedExchange64()

__INTRIN_INLINE long long _InterlockedExchange64 ( volatile long long Target,
long long  Value 
)

Definition at line 192 of file intrin_arm64.h.

193{
194 return __atomic_exchange_n(Target, Value, __ATOMIC_SEQ_CST);
195}

◆ _InterlockedExchange8()

__INTRIN_INLINE char _InterlockedExchange8 ( volatile char Target,
char  Value 
)

Definition at line 185 of file intrin_arm64.h.

186{
187 return __atomic_exchange_n(Target, Value, __ATOMIC_SEQ_CST);
188}

◆ _InterlockedExchangeAdd()

__INTRIN_INLINE long _InterlockedExchangeAdd ( volatile long Addend,
long  Value 
)

Definition at line 206 of file intrin_arm64.h.

207{
208 return __sync_fetch_and_add(Addend, Value);
209}

◆ _InterlockedExchangeAdd16()

__INTRIN_INLINE short _InterlockedExchangeAdd16 ( volatile short Addend,
short  Value 
)

Definition at line 213 of file intrin_arm64.h.

214{
215 return __sync_fetch_and_add(Addend, Value);
216}

◆ _InterlockedExchangeAdd64()

__INTRIN_INLINE long long _InterlockedExchangeAdd64 ( volatile long long Addend,
long long  Value 
)

Definition at line 227 of file intrin_arm64.h.

228{
229 return __sync_fetch_and_add(Addend, Value);
230}

◆ _InterlockedExchangeAdd8()

__INTRIN_INLINE char _InterlockedExchangeAdd8 ( volatile char Addend,
char  Value 
)

Definition at line 220 of file intrin_arm64.h.

221{
222 return __sync_fetch_and_add(Addend, Value);
223}

◆ _InterlockedExchangePointer()

__INTRIN_INLINE void * _InterlockedExchangePointer ( void *volatile Target,
void Value 
)

Definition at line 199 of file intrin_arm64.h.

200{
201 return __atomic_exchange_n(Target, Value, __ATOMIC_SEQ_CST);
202}

◆ _InterlockedIncrement()

__INTRIN_INLINE long _InterlockedIncrement ( volatile long Addend)

Definition at line 318 of file intrin_arm64.h.

319{
320 return __sync_add_and_fetch(Addend, 1);
321}

◆ _InterlockedIncrement16()

__INTRIN_INLINE short _InterlockedIncrement16 ( volatile short Addend)

Definition at line 325 of file intrin_arm64.h.

326{
327 return __sync_add_and_fetch(Addend, 1);
328}

◆ _InterlockedIncrement64()

__INTRIN_INLINE long long _InterlockedIncrement64 ( volatile long long Addend)

Definition at line 332 of file intrin_arm64.h.

333{
334 return __sync_add_and_fetch(Addend, 1);
335}

◆ _InterlockedOr()

__INTRIN_INLINE long _InterlockedOr ( volatile long Value,
long  Mask 
)

Definition at line 262 of file intrin_arm64.h.

263{
264 return __sync_fetch_and_or(Value, Mask);
265}

◆ _InterlockedOr16()

__INTRIN_INLINE short _InterlockedOr16 ( volatile short Value,
short  Mask 
)

Definition at line 269 of file intrin_arm64.h.

270{
271 return __sync_fetch_and_or(Value, Mask);
272}

◆ _InterlockedOr64()

__INTRIN_INLINE long long _InterlockedOr64 ( volatile long long Value,
long long  Mask 
)

Definition at line 283 of file intrin_arm64.h.

284{
285 return __sync_fetch_and_or(Value, Mask);
286}

◆ _InterlockedOr8()

__INTRIN_INLINE char _InterlockedOr8 ( volatile char Value,
char  Mask 
)

Definition at line 276 of file intrin_arm64.h.

277{
278 return __sync_fetch_and_or(Value, Mask);
279}

◆ _InterlockedXor()

__INTRIN_INLINE long _InterlockedXor ( volatile long Value,
long  Mask 
)

Definition at line 290 of file intrin_arm64.h.

291{
292 return __sync_fetch_and_xor(Value, Mask);
293}

◆ _InterlockedXor16()

__INTRIN_INLINE short _InterlockedXor16 ( volatile short Value,
short  Mask 
)

Definition at line 297 of file intrin_arm64.h.

298{
299 return __sync_fetch_and_xor(Value, Mask);
300}

◆ _InterlockedXor64()

__INTRIN_INLINE long long _InterlockedXor64 ( volatile long long Value,
long long  Mask 
)

Definition at line 311 of file intrin_arm64.h.

312{
313 return __sync_fetch_and_xor(Value, Mask);
314}

◆ _InterlockedXor8()

__INTRIN_INLINE char _InterlockedXor8 ( volatile char Value,
char  Mask 
)

Definition at line 304 of file intrin_arm64.h.

305{
306 return __sync_fetch_and_xor(Value, Mask);
307}

◆ _lrotl()

__INTRIN_INLINE unsigned long __cdecl _lrotl ( unsigned long  value,
int  shift 
)

Definition at line 610 of file intrin_arm64.h.

611{
612 shift &= 31;
613 if (!shift)
614 return value;
615 return (value << shift) | (value >> (32 - shift));
616}
#define shift
Definition: input.c:3280

◆ _lrotr()

__INTRIN_INLINE unsigned long __cdecl _lrotr ( unsigned long  value,
int  shift 
)

Definition at line 620 of file intrin_arm64.h.

621{
622 shift &= 31;
623 if (!shift)
624 return value;
625 return (value >> shift) | (value << (32 - shift));
626}

◆ _ReadWriteBarrier()

__INTRIN_INLINE void _ReadWriteBarrier ( void  )

Definition at line 60 of file intrin_arm64.h.

61{
62 __asm__ __volatile__("" : : : "memory");
63}

◆ _rotl()

__INTRIN_INLINE unsigned int __cdecl _rotl ( unsigned int  value,
int  shift 
)

Definition at line 550 of file intrin_arm64.h.

551{
552 shift &= 31;
553 if (!shift)
554 return value;
555 return (value << shift) | (value >> (32 - shift));
556}

◆ _rotl16()

__INTRIN_INLINE unsigned short __cdecl _rotl16 ( unsigned short  value,
unsigned char  shift 
)

Definition at line 540 of file intrin_arm64.h.

541{
542 shift &= 15;
543 if (!shift)
544 return value;
545 return (value << shift) | (value >> (16 - shift));
546}

◆ _rotl64()

__INTRIN_INLINE unsigned long long _rotl64 ( unsigned long long  value,
int  shift 
)

Definition at line 560 of file intrin_arm64.h.

561{
562 shift &= 63;
563 if (!shift)
564 return value;
565 return (value << shift) | (value >> (64 - shift));
566}

◆ _rotl8()

__INTRIN_INLINE unsigned char __cdecl _rotl8 ( unsigned char  value,
unsigned char  shift 
)

Definition at line 530 of file intrin_arm64.h.

531{
532 shift &= 7;
533 if (!shift)
534 return value;
535 return (value << shift) | (value >> (8 - shift));
536}

◆ _rotr()

__INTRIN_INLINE unsigned int __cdecl _rotr ( unsigned int  value,
int  shift 
)

Definition at line 590 of file intrin_arm64.h.

591{
592 shift &= 31;
593 if (!shift)
594 return value;
595 return (value >> shift) | (value << (32 - shift));
596}

◆ _rotr16()

__INTRIN_INLINE unsigned short __cdecl _rotr16 ( unsigned short  value,
unsigned char  shift 
)

Definition at line 580 of file intrin_arm64.h.

581{
582 shift &= 15;
583 if (!shift)
584 return value;
585 return (value >> shift) | (value << (16 - shift));
586}

◆ _rotr64()

__INTRIN_INLINE unsigned long long _rotr64 ( unsigned long long  value,
int  shift 
)

Definition at line 600 of file intrin_arm64.h.

601{
602 shift &= 63;
603 if (!shift)
604 return value;
605 return (value >> shift) | (value << (64 - shift));
606}

◆ _rotr8()

__INTRIN_INLINE unsigned char __cdecl _rotr8 ( unsigned char  value,
unsigned char  shift 
)

Definition at line 570 of file intrin_arm64.h.

571{
572 shift &= 7;
573 if (!shift)
574 return value;
575 return (value >> shift) | (value << (8 - shift));
576}