summaryrefslogtreecommitdiff
path: root/libpthread/linuxthreads/sysdeps/xtensa/pt-machine.h
diff options
context:
space:
mode:
authorMax Filippov <jcmvbkbc@gmail.com>2020-08-08 23:23:11 -0700
committerWaldemar Brodkorb <wbx@openadk.org>2020-08-11 13:35:02 +0200
commitc2e5177b97825211565150b4f9a7f253e0458619 (patch)
treeb7f5d1218a5e7541959ec097f8647b3beb30d2ba /libpthread/linuxthreads/sysdeps/xtensa/pt-machine.h
parent93277314f0ec84409e15f6e2cd616d028cb53065 (diff)
xtensa: relax memory constraint in atomic assembly
Replace "a" constraints with "+m" to avoid forcing atomic variable address into a register and let the compiler use non-zero offset in load/store opcodes. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Diffstat (limited to 'libpthread/linuxthreads/sysdeps/xtensa/pt-machine.h')
-rw-r--r--libpthread/linuxthreads/sysdeps/xtensa/pt-machine.h15
1 files changed, 7 insertions, 8 deletions
diff --git a/libpthread/linuxthreads/sysdeps/xtensa/pt-machine.h b/libpthread/linuxthreads/sysdeps/xtensa/pt-machine.h
index 2c68ddfb5..82d9b540c 100644
--- a/libpthread/linuxthreads/sysdeps/xtensa/pt-machine.h
+++ b/libpthread/linuxthreads/sysdeps/xtensa/pt-machine.h
@@ -43,10 +43,9 @@ testandset (int *spinlock)
" movi %0, 0 \n"
" wsr %0, SCOMPARE1 \n"
" movi %0, 1 \n"
-" s32c1i %0, %1, 0 \n"
- : "=&a" (tmp)
- : "a" (spinlock)
- : "memory"
+" s32c1i %0, %1 \n"
+ : "=&a" (tmp), "+m" (*spinlock)
+ :: "memory"
);
return tmp;
}
@@ -57,16 +56,16 @@ __compare_and_swap (long int *p, long int oldval, long int newval)
unsigned long tmp;
unsigned long value;
__asm__ volatile (
-"1: l32i %0, %2, 0 \n"
+"1: l32i %0, %2 \n"
" bne %0, %4, 2f \n"
" wsr %0, SCOMPARE1 \n"
" mov %1, %0 \n"
" mov %0, %3 \n"
-" s32c1i %0, %2, 0 \n"
+" s32c1i %0, %2 \n"
" bne %1, %0, 1b \n"
"2: \n"
- : "=&a" (tmp), "=&a" (value)
- : "a" (p), "a" (newval), "a" (oldval)
+ : "=&a" (tmp), "=&a" (value), "+m" (*p)
+ : "a" (newval), "a" (oldval)
: "memory" );
return tmp == oldval;