forked from Minki/linux
xtensa: use named assembly arguments in cmpxchg.h
Numeric assembly arguments are hard to understand and assembly code that uses them is hard to modify. Use named arguments in __cmpxchg_u32 and xchg_u32. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
This commit is contained in:
parent
13e28135d6
commit
812e708a4c
@ -27,25 +27,25 @@ __cmpxchg_u32(volatile int *p, int old, int new)
|
||||
unsigned long tmp, result;
|
||||
|
||||
__asm__ __volatile__(
|
||||
"1: l32ex %0, %3\n"
|
||||
" bne %0, %4, 2f\n"
|
||||
" mov %1, %2\n"
|
||||
" s32ex %1, %3\n"
|
||||
" getex %1\n"
|
||||
" beqz %1, 1b\n"
|
||||
"1: l32ex %[result], %[addr]\n"
|
||||
" bne %[result], %[cmp], 2f\n"
|
||||
" mov %[tmp], %[new]\n"
|
||||
" s32ex %[tmp], %[addr]\n"
|
||||
" getex %[tmp]\n"
|
||||
" beqz %[tmp], 1b\n"
|
||||
"2:\n"
|
||||
: "=&a" (result), "=&a" (tmp)
|
||||
: "a" (new), "a" (p), "a" (old)
|
||||
: [result] "=&a" (result), [tmp] "=&a" (tmp)
|
||||
: [new] "a" (new), [addr] "a" (p), [cmp] "a" (old)
|
||||
: "memory"
|
||||
);
|
||||
|
||||
return result;
|
||||
#elif XCHAL_HAVE_S32C1I
|
||||
__asm__ __volatile__(
|
||||
" wsr %2, scompare1\n"
|
||||
" s32c1i %0, %1, 0\n"
|
||||
: "+a" (new)
|
||||
: "a" (p), "a" (old)
|
||||
" wsr %[cmp], scompare1\n"
|
||||
" s32c1i %[new], %[addr], 0\n"
|
||||
: [new] "+a" (new)
|
||||
: [addr] "a" (p), [cmp] "a" (old)
|
||||
: "memory"
|
||||
);
|
||||
|
||||
@ -53,14 +53,14 @@ __cmpxchg_u32(volatile int *p, int old, int new)
|
||||
#else
|
||||
__asm__ __volatile__(
|
||||
" rsil a15, "__stringify(TOPLEVEL)"\n"
|
||||
" l32i %0, %1, 0\n"
|
||||
" bne %0, %2, 1f\n"
|
||||
" s32i %3, %1, 0\n"
|
||||
" l32i %[old], %[addr], 0\n"
|
||||
" bne %[old], %[cmp], 1f\n"
|
||||
" s32i %[new], %[addr], 0\n"
|
||||
"1:\n"
|
||||
" wsr a15, ps\n"
|
||||
" rsync\n"
|
||||
: "=&a" (old)
|
||||
: "a" (p), "a" (old), "r" (new)
|
||||
: [old] "=&a" (old)
|
||||
: [addr] "a" (p), [cmp] "a" (old), [new] "r" (new)
|
||||
: "a15", "memory");
|
||||
return old;
|
||||
#endif
|
||||
@ -129,13 +129,13 @@ static inline unsigned long xchg_u32(volatile int * m, unsigned long val)
|
||||
unsigned long tmp, result;
|
||||
|
||||
__asm__ __volatile__(
|
||||
"1: l32ex %0, %3\n"
|
||||
" mov %1, %2\n"
|
||||
" s32ex %1, %3\n"
|
||||
" getex %1\n"
|
||||
" beqz %1, 1b\n"
|
||||
: "=&a" (result), "=&a" (tmp)
|
||||
: "a" (val), "a" (m)
|
||||
"1: l32ex %[result], %[addr]\n"
|
||||
" mov %[tmp], %[val]\n"
|
||||
" s32ex %[tmp], %[addr]\n"
|
||||
" getex %[tmp]\n"
|
||||
" beqz %[tmp], 1b\n"
|
||||
: [result] "=&a" (result), [tmp] "=&a" (tmp)
|
||||
: [val] "a" (val), [addr] "a" (m)
|
||||
: "memory"
|
||||
);
|
||||
|
||||
@ -143,13 +143,13 @@ static inline unsigned long xchg_u32(volatile int * m, unsigned long val)
|
||||
#elif XCHAL_HAVE_S32C1I
|
||||
unsigned long tmp, result;
|
||||
__asm__ __volatile__(
|
||||
"1: l32i %1, %2, 0\n"
|
||||
" mov %0, %3\n"
|
||||
" wsr %1, scompare1\n"
|
||||
" s32c1i %0, %2, 0\n"
|
||||
" bne %0, %1, 1b\n"
|
||||
: "=&a" (result), "=&a" (tmp)
|
||||
: "a" (m), "a" (val)
|
||||
"1: l32i %[tmp], %[addr], 0\n"
|
||||
" mov %[result], %[val]\n"
|
||||
" wsr %[tmp], scompare1\n"
|
||||
" s32c1i %[result], %[addr], 0\n"
|
||||
" bne %[result], %[tmp], 1b\n"
|
||||
: [result] "=&a" (result), [tmp] "=&a" (tmp)
|
||||
: [addr] "a" (m), [val] "a" (val)
|
||||
: "memory"
|
||||
);
|
||||
return result;
|
||||
@ -157,12 +157,12 @@ static inline unsigned long xchg_u32(volatile int * m, unsigned long val)
|
||||
unsigned long tmp;
|
||||
__asm__ __volatile__(
|
||||
" rsil a15, "__stringify(TOPLEVEL)"\n"
|
||||
" l32i %0, %1, 0\n"
|
||||
" s32i %2, %1, 0\n"
|
||||
" l32i %[tmp], %[addr], 0\n"
|
||||
" s32i %[val], %[addr], 0\n"
|
||||
" wsr a15, ps\n"
|
||||
" rsync\n"
|
||||
: "=&a" (tmp)
|
||||
: "a" (m), "a" (val)
|
||||
: [tmp] "=&a" (tmp)
|
||||
: [addr] "a" (m), [val] "a" (val)
|
||||
: "a15", "memory");
|
||||
return tmp;
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user