In x86_64 architecture, we could use cmpxchg16b to compare and exchange a 128bit value in one atomic operation. But how to operate a 128bit value in aarch64 architecture (arm64) machine ? The answer is __atomic_compare_exchange().
As below code:
#include
....
__int128 value = 0, value1 = 0, value2 = 1;
__int128 ptr = &value;
__int128 expected = &value1;
__int128 desired = &value2;
__atomic_compare_exchange(ptr, expected, desitre, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
....
use “gcc test.c -o test” to compile code, but it reports:
undefined reference to `__atomic_compare_exchange_16'
The reason is we have not use “libatomic.so”, so use “gcc test.c -o test -latomic” to compile and link the code agin. It works in Fedora 21 (aarch64).
Hi, I believe your website could possibly be having web browser compatibility problems.
Whenever I take a look at your website in Safari, it looks fine however when opening in I.E.,
it’s got some overlapping issues. I simply wanted to provide you
with a quick heads up! Other than that, excellent blog!