From 5bf67094a3a2d99d5f96db30be286f6c41988177 Mon Sep 17 00:00:00 2001 From: Max Filippov Date: Tue, 15 Oct 2019 22:17:33 -0700 Subject: [PATCH] xtensa: use "m" constraint instead of "a" in bitops.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 --- arch/xtensa/include/asm/bitops.h | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/arch/xtensa/include/asm/bitops.h b/arch/xtensa/include/asm/bitops.h index 5a35d026c1c3..3f71d364ba90 100644 --- a/arch/xtensa/include/asm/bitops.h +++ b/arch/xtensa/include/asm/bitops.h @@ -150,13 +150,14 @@ static inline void op##_bit(unsigned int bit, volatile unsigned long *p)\ p += bit >> 5; \ \ __asm__ __volatile__( \ - "1: l32i %[value], %[addr], 0\n" \ + "1: l32i %[value], %[mem]\n" \ " wsr %[value], scompare1\n" \ " "insn" %[tmp], %[value], %[mask]\n" \ - " s32c1i %[tmp], %[addr], 0\n" \ + " s32c1i %[tmp], %[mem]\n" \ " bne %[tmp], %[value], 1b\n" \ - : [tmp] "=&a" (tmp), [value] "=&a" (value) \ - : [mask] "a" (inv mask), [addr] "a" (p) \ + : [tmp] "=&a" (tmp), [value] "=&a" (value), \ + [mem] "+m" (*p) \ + : [mask] "a" (inv mask) \ : "memory"); \ } @@ -170,13 +171,14 @@ test_and_##op##_bit(unsigned int bit, volatile unsigned long *p) \ p += bit >> 5; \ \ __asm__ __volatile__( \ - "1: l32i %[value], %[addr], 0\n" \ + "1: l32i %[value], %[mem]\n" \ " wsr %[value], scompare1\n" \ " "insn" %[tmp], %[value], %[mask]\n" \ - " s32c1i %[tmp], %[addr], 0\n" \ + " s32c1i %[tmp], %[mem]\n" \ " bne %[tmp], %[value], 1b\n" \ - : [tmp] "=&a" (tmp), [value] "=&a" (value) \ - : [mask] "a" (inv mask), [addr] "a" (p) \ + : [tmp] "=&a" (tmp), [value] "=&a" (value), \ + [mem] "+m" (*p) \ + : [mask] "a" (inv mask) \ : "memory"); \ \ return tmp & mask; \