ReactOS 0.4.15-dev-8422-g6219a1a
intrin_arm.h File Reference

Go to the source code of this file.

Macros

#define _ReturnAddress()   (__builtin_return_address(0))
 
#define _ReadWriteBarrier()   __sync_synchronize()
 
#define _clz(a)
 

Functions

__INTRIN_INLINE void __yield (void)
 
__INTRIN_INLINE void __break (unsigned int value)
 
__INTRIN_INLINE unsigned short _byteswap_ushort (unsigned short value)
 
__INTRIN_INLINE unsigned _CountLeadingZeros (long Mask)
 
__INTRIN_INLINE unsigned _CountTrailingZeros (long Mask)
 
__INTRIN_INLINE unsigned char _BitScanForward (unsigned long *const Index, const unsigned long Mask)
 
__INTRIN_INLINE char _InterlockedCompareExchange8 (volatile char *const Destination, const char Exchange, const char Comperand)
 
__INTRIN_INLINE short _InterlockedCompareExchange16 (volatile short *const Destination, const short Exchange, const short Comperand)
 
__INTRIN_INLINE short _InterlockedExchangeAdd16 (volatile short *const Addend, const short Value)
 
__INTRIN_INLINE long _InterlockedCompareExchange (volatile long *const dest, const long exch, const long comp)
 
__INTRIN_INLINE long long _InterlockedCompareExchange64 (volatile long long *const dest, const long long exch, const long long comp)
 
__INTRIN_INLINE void_InterlockedCompareExchangePointer (void *volatile *const Destination, void *const Exchange, void *const Comperand)
 
__INTRIN_INLINE long _InterlockedExchangeAdd (volatile long *const dest, const long add)
 
__INTRIN_INLINE long _InterlockedExchange (volatile long *const dest, const long exch)
 
__INTRIN_INLINE void_InterlockedExchangePointer (void *volatile *const Target, void *const Value)
 
__INTRIN_INLINE unsigned char _BitScanReverse (unsigned long *const Index, const unsigned long Mask)
 
__INTRIN_INLINE char _InterlockedAnd8 (volatile char *const value, const char mask)
 
__INTRIN_INLINE short _InterlockedAnd16 (volatile short *const value, const short mask)
 
__INTRIN_INLINE long _InterlockedAnd (volatile long *const value, const long mask)
 
__INTRIN_INLINE char _InterlockedOr8 (volatile char *const value, const char mask)
 
__INTRIN_INLINE short _InterlockedOr16 (volatile short *const value, const short mask)
 
__INTRIN_INLINE long _InterlockedOr (volatile long *const value, const long mask)
 
__INTRIN_INLINE char _InterlockedXor8 (volatile char *const value, const char mask)
 
__INTRIN_INLINE short _InterlockedXor16 (volatile short *const value, const short mask)
 
__INTRIN_INLINE long _InterlockedXor (volatile long *const value, const long mask)
 
__INTRIN_INLINE long _InterlockedDecrement (volatile long *const lpAddend)
 
__INTRIN_INLINE long _InterlockedIncrement (volatile long *const lpAddend)
 
__INTRIN_INLINE long _InterlockedDecrement16 (volatile short *const lpAddend)
 
__INTRIN_INLINE long _InterlockedIncrement16 (volatile short *const lpAddend)
 
__INTRIN_INLINE long _InterlockedAddLargeStatistic (volatile long long *const Addend, const long Value)
 
__INTRIN_INLINE void _disable (void)
 
__INTRIN_INLINE void _enable (void)
 
__INTRIN_INLINE unsigned char _interlockedbittestandset (volatile long *a, const long b)
 
__INTRIN_INLINE unsigned char _interlockedbittestandreset (volatile long *a, const long b)
 
__INTRIN_INLINE unsigned int _rotl (const unsigned int value, int shift)
 

Macro Definition Documentation

◆ _clz

#define _clz (   a)
Value:
({ ULONG __value, __arg = (a); \
asm ("clz\t%0, %1": "=r" (__value): "r" (__arg)); \
__value; })
#define a
Definition: ke_i.h:78
uint32_t ULONG
Definition: typedefs.h:59

Definition at line 398 of file intrin_arm.h.

◆ _ReadWriteBarrier

#define _ReadWriteBarrier (   void)    __sync_synchronize()

Definition at line 36 of file intrin_arm.h.

◆ _ReturnAddress

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

Definition at line 35 of file intrin_arm.h.

Function Documentation

◆ __break()

__INTRIN_INLINE void __break ( unsigned int  value)

Definition at line 40 of file intrin_arm.h.

40{ __asm__ __volatile__("bkpt %0": : "M" (value)); }
__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" "\tsub $32, %rsp\n" "\t.seh_stackalloc 32\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 $32, %rsp\n" "\tpop %rbp\n" "\tret\n" "\t.seh_endproc")
Definition: pdh_main.c:94

◆ __yield()

__INTRIN_INLINE void __yield ( void  )

Definition at line 38 of file intrin_arm.h.

38{ __asm__ __volatile__("yield"); }

Referenced by YieldProcessor().

◆ _BitScanForward()

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

Definition at line 57 of file intrin_arm.h.

58{
59 *Index = __builtin_ctz(Mask);
60 return Mask ? 1 : 0;
61}
unsigned int Mask
Definition: fpcontrol.c:82
_In_ WDFCOLLECTION _In_ ULONG Index

◆ _BitScanReverse()

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

Definition at line 180 of file intrin_arm.h.

181{
182 *Index = 31 - __builtin_clz(Mask);
183 return Mask ? 1 : 0;
184}

◆ _byteswap_ushort()

__INTRIN_INLINE unsigned short _byteswap_ushort ( unsigned short  value)

Definition at line 42 of file intrin_arm.h.

43{
44 return (value >> 8) | (value << 8);
45}

◆ _CountLeadingZeros()

__INTRIN_INLINE unsigned _CountLeadingZeros ( long  Mask)

Definition at line 47 of file intrin_arm.h.

48{
49 return Mask ? __builtin_clz(Mask) : 32;
50}

Referenced by __rt_div_worker().

◆ _CountTrailingZeros()

__INTRIN_INLINE unsigned _CountTrailingZeros ( long  Mask)

Definition at line 52 of file intrin_arm.h.

53{
54 return Mask ? __builtin_ctz(Mask) : 32;
55}

◆ _disable()

__INTRIN_INLINE void _disable ( void  )

Definition at line 365 of file intrin_arm.h.

366{
367 __asm__ __volatile__
368 (
369 "cpsid i @ __cli" : : : "memory", "cc"
370 );
371}

◆ _enable()

__INTRIN_INLINE void _enable ( void  )

Definition at line 373 of file intrin_arm.h.

374{
375 __asm__ __volatile__
376 (
377 "cpsie i @ __sti" : : : "memory", "cc"
378 );
379}

◆ _InterlockedAddLargeStatistic()

__INTRIN_INLINE long _InterlockedAddLargeStatistic ( volatile long long *const  Addend,
const long  Value 
)

Definition at line 359 of file intrin_arm.h.

360{
361 *Addend += Value;
362 return Value;
363}
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

◆ _InterlockedAnd()

__INTRIN_INLINE long _InterlockedAnd ( volatile long *const  value,
const long  mask 
)

Definition at line 220 of file intrin_arm.h.

221{
222 long x;
223 long y;
224
225 y = *value;
226
227 do
228 {
229 x = y;
231 }
232 while(y != x);
233
234 return y;
235}
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLenum GLint GLuint mask
Definition: glext.h:6028
__INTRIN_INLINE long _InterlockedCompareExchange(volatile long *const dest, const long exch, const long comp)
Definition: intrin_arm.h:106

◆ _InterlockedAnd16()

__INTRIN_INLINE short _InterlockedAnd16 ( volatile short *const  value,
const short  mask 
)

Definition at line 203 of file intrin_arm.h.

204{
205 short x;
206 short y;
207
208 y = *value;
209
210 do
211 {
212 x = y;
214 }
215 while(y != x);
216
217 return y;
218}
__INTRIN_INLINE short _InterlockedCompareExchange16(volatile short *const Destination, const short Exchange, const short Comperand)
Definition: intrin_arm.h:68

◆ _InterlockedAnd8()

__INTRIN_INLINE char _InterlockedAnd8 ( volatile char *const  value,
const char  mask 
)

Definition at line 186 of file intrin_arm.h.

187{
188 char x;
189 char y;
190
191 y = *value;
192
193 do
194 {
195 x = y;
197 }
198 while(y != x);
199
200 return y;
201}
__INTRIN_INLINE char _InterlockedCompareExchange8(volatile char *const Destination, const char Exchange, const char Comperand)
Definition: intrin_arm.h:63

◆ _interlockedbittestandreset()

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

Definition at line 386 of file intrin_arm.h.

387{
388 return (_InterlockedAnd(a, ~(1 << b)) >> b) & 1;
389}
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
volatile char *const const char modify _InterlockedAnd
Definition: intrin_ppc.h:267

◆ _interlockedbittestandset()

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

Definition at line 381 of file intrin_arm.h.

382{
383 return (_InterlockedOr(a, 1 << b) >> b) & 1;
384}
__INTRIN_INLINE long _InterlockedOr(volatile long *const value, const long mask)
Definition: intrin_arm.h:271

◆ _InterlockedCompareExchange()

__INTRIN_INLINE long _InterlockedCompareExchange ( volatile long *const  dest,
const long  exch,
const long  comp 
)

Definition at line 106 of file intrin_arm.h.

107{
108 long a, b;
109
110 __asm__ __volatile__ ( "0:\n\t"
111 "ldr %1, [%2]\n\t"
112 "cmp %1, %4\n\t"
113 "bne 1f\n\t"
114 "swp %0, %3, [%2]\n\t"
115 "cmp %0, %1\n\t"
116 "swpne %3, %0, [%2]\n\t"
117 "bne 0b\n\t"
118 "1:"
119 : "=&r" (a), "=&r" (b)
120 : "r" (dest), "r" (exch), "r" (comp)
121 : "cc", "memory");
122
123 return a;
124}
#define b
Definition: ke_i.h:79
static char * dest
Definition: rtl.c:135

Referenced by _InterlockedAnd(), _InterlockedCompareExchangePointer(), _InterlockedOr(), and _InterlockedXor().

◆ _InterlockedCompareExchange16()

__INTRIN_INLINE short _InterlockedCompareExchange16 ( volatile short *const  Destination,
const short  Exchange,
const short  Comperand 
)

Definition at line 68 of file intrin_arm.h.

69{
70 short a, b;
71
72 __asm__ __volatile__ ( "0:\n\t"
73 "ldr %1, [%2]\n\t"
74 "cmp %1, %4\n\t"
75 "bne 1f\n\t"
76 "swp %0, %3, [%2]\n\t"
77 "cmp %0, %1\n\t"
78 "swpne %3, %0, [%2]\n\t"
79 "bne 0b\n\t"
80 "1:"
81 : "=&r" (a), "=&r" (b)
82 : "r" (Destination), "r" (Exchange), "r" (Comperand)
83 : "cc", "memory");
84
85 return a;
86}
_In_ PUNICODE_STRING _Inout_ PUNICODE_STRING Destination
Definition: rtlfuncs.h:3016

Referenced by _InterlockedAnd16(), _InterlockedOr16(), and _InterlockedXor16().

◆ _InterlockedCompareExchange64()

__INTRIN_INLINE long long _InterlockedCompareExchange64 ( volatile long long *const  dest,
const long long  exch,
const long long  comp 
)

Definition at line 126 of file intrin_arm.h.

127{
128 //
129 // FIXME
130 //
131 long long result;
132 result = *dest;
133 if (*dest == comp) *dest = exch;
134 return result;
135}
GLuint64EXT * result
Definition: glext.h:11304

◆ _InterlockedCompareExchange8()

__INTRIN_INLINE char _InterlockedCompareExchange8 ( volatile char *const  Destination,
const char  Exchange,
const char  Comperand 
)

Definition at line 63 of file intrin_arm.h.

64{
65 return __sync_val_compare_and_swap(Destination, Comperand, Exchange);
66}

Referenced by _InterlockedAnd8(), _InterlockedOr8(), and _InterlockedXor8().

◆ _InterlockedCompareExchangePointer()

__INTRIN_INLINE void * _InterlockedCompareExchangePointer ( void *volatile *const  Destination,
void *const  Exchange,
void *const  Comperand 
)

Definition at line 137 of file intrin_arm.h.

138{
139 return (void*)_InterlockedCompareExchange((volatile long* const)Destination, (const long)Exchange, (const long)Comperand);
140}

◆ _InterlockedDecrement()

__INTRIN_INLINE long _InterlockedDecrement ( volatile long *const  lpAddend)

Definition at line 339 of file intrin_arm.h.

340{
341 return _InterlockedExchangeAdd(lpAddend, -1) - 1;
342}
__INTRIN_INLINE long _InterlockedExchangeAdd(volatile long *const dest, const long add)
Definition: intrin_arm.h:143

◆ _InterlockedDecrement16()

__INTRIN_INLINE long _InterlockedDecrement16 ( volatile short *const  lpAddend)

Definition at line 349 of file intrin_arm.h.

350{
351 return _InterlockedExchangeAdd16(lpAddend, -1) - 1;
352}
__INTRIN_INLINE short _InterlockedExchangeAdd16(volatile short *const Addend, const short Value)
Definition: intrin_arm.h:88

◆ _InterlockedExchange()

__INTRIN_INLINE long _InterlockedExchange ( volatile long *const  dest,
const long  exch 
)

Definition at line 161 of file intrin_arm.h.

162{
163 long a;
164
165 __asm__ __volatile__ ( "swp %0, %2, [%1]"
166 : "=&r" (a)
167 : "r" (dest), "r" (exch));
168
169 return a;
170}

Referenced by _InterlockedExchangePointer().

◆ _InterlockedExchangeAdd()

__INTRIN_INLINE long _InterlockedExchangeAdd ( volatile long *const  dest,
const long  add 
)

Definition at line 143 of file intrin_arm.h.

144{
145 long a, b, c;
146
147 __asm__ __volatile__ ( "0:\n\t"
148 "ldr %0, [%3]\n\t"
149 "add %1, %0, %4\n\t"
150 "swp %2, %1, [%3]\n\t"
151 "cmp %0, %2\n\t"
152 "swpne %1, %2, [%3]\n\t"
153 "bne 0b"
154 : "=&r" (a), "=&r" (b), "=&r" (c)
155 : "r" (dest), "r" (add)
156 : "cc", "memory");
157
158 return a;
159}
const GLubyte * c
Definition: glext.h:8905
#define c
Definition: ke_i.h:80

Referenced by _InterlockedDecrement(), and _InterlockedIncrement().

◆ _InterlockedExchangeAdd16()

__INTRIN_INLINE short _InterlockedExchangeAdd16 ( volatile short *const  Addend,
const short  Value 
)

Definition at line 88 of file intrin_arm.h.

89{
90 short a, b, c;
91
92 __asm__ __volatile__ ( "0:\n\t"
93 "ldr %0, [%3]\n\t"
94 "add %1, %0, %4\n\t"
95 "swp %2, %1, [%3]\n\t"
96 "cmp %0, %2\n\t"
97 "swpne %1, %2, [%3]\n\t"
98 "bne 0b"
99 : "=&r" (a), "=&r" (b), "=&r" (c)
100 : "r" (Value), "r" (Addend)
101 : "cc", "memory");
102
103 return a;
104}

Referenced by _InterlockedDecrement16(), and _InterlockedIncrement16().

◆ _InterlockedExchangePointer()

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

Definition at line 173 of file intrin_arm.h.

174{
175 return (void *)_InterlockedExchange((volatile long * const)Target, (const long)Value);
176}
__INTRIN_INLINE long _InterlockedExchange(volatile long *const dest, const long exch)
Definition: intrin_arm.h:161
_In_ WDFIOTARGET Target
Definition: wdfrequest.h:306

◆ _InterlockedIncrement()

__INTRIN_INLINE long _InterlockedIncrement ( volatile long *const  lpAddend)

Definition at line 344 of file intrin_arm.h.

345{
346 return _InterlockedExchangeAdd(lpAddend, 1) + 1;
347}

◆ _InterlockedIncrement16()

__INTRIN_INLINE long _InterlockedIncrement16 ( volatile short *const  lpAddend)

Definition at line 354 of file intrin_arm.h.

355{
356 return _InterlockedExchangeAdd16(lpAddend, 1) + 1;
357}

◆ _InterlockedOr()

__INTRIN_INLINE long _InterlockedOr ( volatile long *const  value,
const long  mask 
)

Definition at line 271 of file intrin_arm.h.

272{
273 long x;
274 long y;
275
276 y = *value;
277
278 do
279 {
280 x = y;
282 }
283 while(y != x);
284
285 return y;
286}

Referenced by _interlockedbittestandset().

◆ _InterlockedOr16()

__INTRIN_INLINE short _InterlockedOr16 ( volatile short *const  value,
const short  mask 
)

Definition at line 254 of file intrin_arm.h.

255{
256 short x;
257 short y;
258
259 y = *value;
260
261 do
262 {
263 x = y;
265 }
266 while(y != x);
267
268 return y;
269}

◆ _InterlockedOr8()

__INTRIN_INLINE char _InterlockedOr8 ( volatile char *const  value,
const char  mask 
)

Definition at line 237 of file intrin_arm.h.

238{
239 char x;
240 char y;
241
242 y = *value;
243
244 do
245 {
246 x = y;
248 }
249 while(y != x);
250
251 return y;
252}

◆ _InterlockedXor()

__INTRIN_INLINE long _InterlockedXor ( volatile long *const  value,
const long  mask 
)

Definition at line 322 of file intrin_arm.h.

323{
324 long x;
325 long y;
326
327 y = *value;
328
329 do
330 {
331 x = y;
333 }
334 while(y != x);
335
336 return y;
337}

◆ _InterlockedXor16()

__INTRIN_INLINE short _InterlockedXor16 ( volatile short *const  value,
const short  mask 
)

Definition at line 305 of file intrin_arm.h.

306{
307 short x;
308 short y;
309
310 y = *value;
311
312 do
313 {
314 x = y;
316 }
317 while(y != x);
318
319 return y;
320}

◆ _InterlockedXor8()

__INTRIN_INLINE char _InterlockedXor8 ( volatile char *const  value,
const char  mask 
)

Definition at line 288 of file intrin_arm.h.

289{
290 char x;
291 char y;
292
293 y = *value;
294
295 do
296 {
297 x = y;
299 }
300 while(y != x);
301
302 return y;
303}

◆ _rotl()

unsigned int _rotl ( const unsigned int  value,
int  shift 
)

Definition at line 392 of file intrin_arm.h.

393{
394 return (((value) << ((int)(shift))) | ((value) >> (32 - (int)(shift))));
395}
#define shift
Definition: input.c:1755