@@ -, +, @@ -- `strexeq r4,r1,[r2]' -- `strexeq r1,r4,[r2]' -- `strexeq r1,r2,[r0]' --- lib/direct/atomic.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/lib/direct/atomic.h +++ a/lib/direct/atomic.h @@ -191,9 +191,10 @@ static inline int _D__atomic_cmpxchg(volatile int *ptr, int old, int _new) do { __asm__ __volatile__("@ atomic_cmpxchg\n" + "movs %0, #0\n" "ldrex %1, [%2]\n" - "mov %0, #0\n" - "teq %1, %3\n" + "cmp %1, %3\n" + "it eq\n" "strexeq %0, %4, [%2]\n" : "=&r" (res), "=&r" (oldval) : "r" (ptr), "Ir" (old), "r" (_new) --