2 static inline int a_ll(volatile int *p)
5 __asm__ __volatile__ ("ldaxr %w0,%1" : "=r"(v) : "Q"(*p));
10 static inline int a_sc(volatile int *p, int v)
13 __asm__ __volatile__ ("stlxr %w0,%w2,%1" : "=&r"(r), "=Q"(*p) : "r"(v) : "memory");
17 #define a_barrier a_barrier
18 static inline void a_barrier()
20 __asm__ __volatile__ ("dmb ish" : : : "memory");
24 static inline int a_cas(volatile int *p, int t, int s)
33 } while (!a_sc(p, s));
38 static inline void *a_ll_p(volatile void *p)
41 __asm__ __volatile__ ("ldaxr %0, %1" : "=r"(v) : "Q"(*(void *volatile *)p));
46 static inline int a_sc_p(volatile int *p, void *v)
49 __asm__ __volatile__ ("stlxr %w0,%2,%1" : "=&r"(r), "=Q"(*(void *volatile *)p) : "r"(v) : "memory");
53 #define a_cas_p a_cas_p
54 static inline void *a_cas_p(volatile void *p, void *t, void *s)
63 } while (!a_sc_p(p, s));
67 #define a_ctz_64 a_ctz_64
68 static inline int a_ctz_64(uint64_t x)
77 #define a_clz_64 a_clz_64
78 static inline int a_clz_64(uint64_t x)
80 __asm__("clz %0, %1" : "=r"(x) : "r"(x));