Skip to content

Commit 5eff6ca

Browse files
committed
xtensa: use "m" constraint instead of "r" in futex.h assembly
Use "m" constraint instead of "r" for the address, as "m" allows compiler to access adjacent locations using base + offset, while "r" requires updating the base register every time. Signed-off-by: Max Filippov <[email protected]>
1 parent cf3b3ba commit 5eff6ca

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

arch/xtensa/include/asm/futex.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@
4343
#elif XCHAL_HAVE_S32C1I
4444
#define __futex_atomic_op(insn, ret, old, uaddr, arg) \
4545
__asm__ __volatile( \
46-
"1: l32i %[oldval], %[addr], 0\n" \
46+
"1: l32i %[oldval], %[mem]\n" \
4747
insn "\n" \
4848
" wsr %[oldval], scompare1\n" \
49-
"2: s32c1i %[newval], %[addr], 0\n" \
49+
"2: s32c1i %[newval], %[mem]\n" \
5050
" bne %[newval], %[oldval], 1b\n" \
5151
" movi %[newval], 0\n" \
5252
"3:\n" \
@@ -60,9 +60,9 @@
6060
" .section __ex_table,\"a\"\n" \
6161
" .long 1b, 5b, 2b, 5b\n" \
6262
" .previous\n" \
63-
: [oldval] "=&r" (old), [newval] "=&r" (ret) \
64-
: [addr] "r" (uaddr), [oparg] "r" (arg), \
65-
[fault] "I" (-EFAULT) \
63+
: [oldval] "=&r" (old), [newval] "=&r" (ret), \
64+
[mem] "+m" (*(uaddr)) \
65+
: [oparg] "r" (arg), [fault] "I" (-EFAULT) \
6666
: "memory")
6767
#endif
6868

0 commit comments

Comments
 (0)