Created
August 26, 2016 12:46
-
-
Save Alcaro/362082e3e8b3edb42a43c8d4c7aa2a3d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Compiled with https://gcc.godbolt.org/ ARM gcc 4.8.2, flags -Os | |
void g(volatile int* p, volatile int* q) | |
{ | |
*p=0; | |
*q=0; | |
} | |
void h(int* p, int* q) | |
{ | |
*p=0; | |
*q=0; | |
} | |
void i(int* p, int* q) | |
{ | |
__atomic_store_n(p, 0, __ATOMIC_RELEASE); | |
__atomic_store_n(q, 0, __ATOMIC_RELEASE); | |
} | |
g(int volatile*, int volatile*): | |
movs r3, #0 | |
str r3, [r0] | |
str r3, [r1] | |
bx lr | |
h(int*, int*): | |
movs r3, #0 | |
str r3, [r0] | |
str r3, [r1] | |
bx lr | |
i(int*, int*): | |
dmb ish | |
movs r3, #0 | |
str r3, [r0] | |
dmb ish | |
str r3, [r1] | |
bx lr |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment