for example:
asm volatile { ".arch_extension lse\ncasl\t$1, $4, [$3]\ncmp\t\t$1, $2\ncset\t\t${0:w}, eq\n.arch_extension nolse\n"
: "=r" dassign %res_231_2 0,
"+&r" dassign %tmp_132_1 0
: "r" (dread u64 %_cmpval_132_1),
"r" (dread ptr %p),
"r" (dread u64 %newval)
: "cc", "memory"
: }
the "cc" is not supported.
c code
ATOMIC_CMPSET(rel, ,l)
#define _ATOMIC_CMPSET(bar, a, l)
_ATOMIC_CMPSET_IMPL(8, w, b, bar, a, l)
_ATOMIC_CMPSET_IMPL(16, w, h, bar, a, l)
_ATOMIC_CMPSET_IMPL(32, w, , bar, a, l)
_ATOMIC_CMPSET_IMPL(64, , , bar, a, l)
#define _ATOMIC_CMPSET_IMPL(t, w, s, bar, a, l)
_ATOMIC_CMPSET_PROTO(t, bar, _llsc)
{
uint##t##_t tmp;
int res;
__asm __volatile(
"1: mov %w1, #1:编译报错: ninja: error: manifest 'build.ninja' still dirty after 100 tries\n"
" ld"#a"xr"#s" %"#w"0, [%2]\n"
" cmp %"#w"0, %"#w"3\n"
" b.ne 2f\n"
" st"#l"xr"#s" %w1, %"#w"4, [%2]\n"
" cbnz %w1, 1b\n"
"2:"
: "=&r"(tmp), "=&r"(res)
: "r" (p), "r" (cmpval), "r" (newval)
: "cc", "memory"
);
return (!res);
} \