1570af302Sopenharmony_ci#define a_cas a_cas
2570af302Sopenharmony_cistatic inline int a_cas(volatile int *p, int t, int s)
3570af302Sopenharmony_ci{
4570af302Sopenharmony_ci	__asm__ __volatile__ (
5570af302Sopenharmony_ci		"cs %0, %2, %1"
6570af302Sopenharmony_ci		: "+d"(t), "+Q"(*p) : "d"(s) : "memory", "cc");
7570af302Sopenharmony_ci	return t;
8570af302Sopenharmony_ci}
9570af302Sopenharmony_ci
10570af302Sopenharmony_ci#define a_cas_p a_cas_p
11570af302Sopenharmony_cistatic inline void *a_cas_p(volatile void *p, void *t, void *s)
12570af302Sopenharmony_ci{
13570af302Sopenharmony_ci	__asm__ __volatile__ (
14570af302Sopenharmony_ci		"csg %0, %2, %1"
15570af302Sopenharmony_ci		: "+d"(t), "+Q"(*(void *volatile *)p) : "d"(s)
16570af302Sopenharmony_ci		: "memory", "cc");
17570af302Sopenharmony_ci	return t;
18570af302Sopenharmony_ci}
19570af302Sopenharmony_ci
20570af302Sopenharmony_ci#define a_barrier a_barrier
21570af302Sopenharmony_cistatic inline void a_barrier()
22570af302Sopenharmony_ci{
23570af302Sopenharmony_ci	__asm__ __volatile__ ("bcr 15,0" : : : "memory");
24570af302Sopenharmony_ci}
25570af302Sopenharmony_ci
26570af302Sopenharmony_ci#define a_crash a_crash
27570af302Sopenharmony_cistatic inline void a_crash()
28570af302Sopenharmony_ci{
29570af302Sopenharmony_ci	__asm__ __volatile__ (".insn e,0");
30570af302Sopenharmony_ci}
31