mirror of
git://git.musl-libc.org/musl
synced 2025-02-20 21:06:49 +00:00
better a_sc inline asm constraint on aarch64 and arm
"Q" input constraint was used for the written object, instead of "=Q" output constraint. this should not cause problems because "memory" is on the clobber list, but "=Q" better documents the intent and more consistent with the actual asm code. this changes the generated code, because different registers are used, but other than the register names nothing should change.
This commit is contained in:
parent
65498f289b
commit
3b27725385
@ -10,7 +10,7 @@ static inline int a_ll(volatile int *p)
|
||||
static inline int a_sc(volatile int *p, int v)
|
||||
{
|
||||
int r;
|
||||
__asm__ __volatile__ ("stlxr %w0,%w1,%2" : "=&r"(r) : "r"(v), "Q"(*p) : "memory");
|
||||
__asm__ __volatile__ ("stlxr %w0,%w2,%1" : "=&r"(r), "=Q"(*p) : "r"(v) : "memory");
|
||||
return !r;
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@ static inline void *a_ll_p(volatile void *p)
|
||||
static inline int a_sc_p(volatile int *p, void *v)
|
||||
{
|
||||
int r;
|
||||
__asm__ __volatile__ ("stlxr %w0,%1,%2" : "=&r"(r) : "r"(v), "Q"(*(void *volatile *)p) : "memory");
|
||||
__asm__ __volatile__ ("stlxr %w0,%2,%1" : "=&r"(r), "=Q"(*(void *volatile *)p) : "r"(v) : "memory");
|
||||
return !r;
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@ static inline int a_ll(volatile int *p)
|
||||
static inline int a_sc(volatile int *p, int v)
|
||||
{
|
||||
int r;
|
||||
__asm__ __volatile__ ("strex %0,%1,%2" : "=&r"(r) : "r"(v), "Q"(*p) : "memory");
|
||||
__asm__ __volatile__ ("strex %0,%2,%1" : "=&r"(r), "=Q"(*p) : "r"(v) : "memory");
|
||||
return !r;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user