ATOMIC64_OPS(add, add):
atomic64_addATOMIC64_OP(add, add)

 

 

 

 

 

atomic64_add_returnATOMIC64_OP_RETURN(,dmb ish,,l,“memory”,add, add)

 

#define ATOMIC64_FETCH_OP(name, mb, acq, rel, cl, op, asm_op) \

long atomic64_fetch_##op##name(long i, atomic64_t *v) \

{ \

long result, val; \

unsigned long tmp; \

\

asm volatile("// atomic64_fetch_" #op #name "\n" \

" prfm pstl1strm, %3\n" \

"1: ld" #acq "xr %0, %3\n" \

" " #asm_op " %1, %0, %4\n" \

" st" #rel "xr %w2, %1, %3\n" \

" cbnz %w2, 1b\n" \

" " #mb \

: "=&r" (result), "=&r" (val), "=&r" (tmp), "+Q" (v->counter) \

: "Ir" (i) \

: cl); \

\

return result; \

}

atomic64_add_return_relaxedATOMIC64_OP_RETURN(_relaxed,,,,,add, add)
atomic64_add_return_acquireATOMIC64_OP_RETURN(_acquire,,a,,“memory”,add, add)
atomic64_add_return_releaseATOMIC64_OP_RETURN(_release,,,l,“memory”,add, add)
atomic64_fetch_addATOMIC64_FETCH_OP(,dmb ish,,l,“memory”,add, add)
atomic64_fetch_add_relaxedATOMIC64_FETCH_OP(_relaxed,,,,,add, add)
atomic64_fetch_add_acquireATOMIC64_FETCH_OP(_acquire,,a,,“memory”,add, add)
atomic64_fetch_add_releaseATOMIC64_FETCH_OP(_release,,,l,“memory”,add, add)