Commit 10971638 authored by Vineet Gupta's avatar Vineet Gupta

ARCv2: spinlock/rwlock/atomics: reduce 1 instruction in exponential backoff

The increment of delay counter was 2 instructions:
Arithmatic Shfit Left (ASL) + set to 1 on overflow

This can be done in 1 using ROtate Left (ROL)
Suggested-by: default avatarNigel Topham <ntopham@synopsys.com>
Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
parent 87ce6280
...@@ -34,8 +34,7 @@ ...@@ -34,8 +34,7 @@
" mov %[tmp], %[delay] \n" /* tmp = delay */ \ " mov %[tmp], %[delay] \n" /* tmp = delay */ \
"2: brne.d %[tmp], 0, 2b \n" /* while (tmp != 0) */ \ "2: brne.d %[tmp], 0, 2b \n" /* while (tmp != 0) */ \
" sub %[tmp], %[tmp], 1 \n" /* tmp-- */ \ " sub %[tmp], %[tmp], 1 \n" /* tmp-- */ \
" asl.f %[delay], %[delay], 1 \n" /* delay *= 2 */ \ " rol %[delay], %[delay] \n" /* delay *= 2 */ \
" mov.z %[delay], 1 \n" /* handle overflow */ \
" b 1b \n" /* start over */ \ " b 1b \n" /* start over */ \
"4: ; --- success --- \n" \ "4: ; --- success --- \n" \
......
...@@ -260,8 +260,7 @@ static inline void arch_write_unlock(arch_rwlock_t *rw) ...@@ -260,8 +260,7 @@ static inline void arch_write_unlock(arch_rwlock_t *rw)
" mov %[tmp], %[delay] \n" /* tmp = delay */ \ " mov %[tmp], %[delay] \n" /* tmp = delay */ \
"2: brne.d %[tmp], 0, 2b \n" /* while (tmp != 0) */ \ "2: brne.d %[tmp], 0, 2b \n" /* while (tmp != 0) */ \
" sub %[tmp], %[tmp], 1 \n" /* tmp-- */ \ " sub %[tmp], %[tmp], 1 \n" /* tmp-- */ \
" asl.f %[delay], %[delay], 1 \n" /* delay *= 2 */ \ " rol %[delay], %[delay] \n" /* delay *= 2 */ \
" mov.z %[delay], 1 \n" /* handle overflow */ \
" b 1b \n" /* start over */ \ " b 1b \n" /* start over */ \
" \n" \ " \n" \
"4: ; --- done --- \n" \ "4: ; --- done --- \n" \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment