summaryrefslogtreecommitdiff
path: root/arch/arc
diff options
context:
space:
mode:
authorVineet Gupta <vgupta@synopsys.com>2015-08-07 13:01:39 +0530
committerVineet Gupta <vgupta@synopsys.com>2015-08-07 13:56:16 +0530
commit10971638701dedadb58c88ce4d31c9375b224ed6 (patch)
treeb210f8710277b0ae74ea5c8143c3c9f6b5dc5bd1 /arch/arc
parent87ce62802f7a3553234ebf1ae7cd52c8bf272fb9 (diff)
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: Nigel Topham <ntopham@synopsys.com> Cc: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: linux-kernel@vger.kernel.org Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Diffstat (limited to 'arch/arc')
-rw-r--r--arch/arc/include/asm/atomic.h3
-rw-r--r--arch/arc/include/asm/spinlock.h3
2 files changed, 2 insertions, 4 deletions
diff --git a/arch/arc/include/asm/atomic.h b/arch/arc/include/asm/atomic.h
index 629dfd0a0c6b..87d18ae53115 100644
--- a/arch/arc/include/asm/atomic.h
+++ b/arch/arc/include/asm/atomic.h
@@ -34,8 +34,7 @@
" mov %[tmp], %[delay] \n" /* tmp = delay */ \
"2: brne.d %[tmp], 0, 2b \n" /* while (tmp != 0) */ \
" sub %[tmp], %[tmp], 1 \n" /* tmp-- */ \
- " asl.f %[delay], %[delay], 1 \n" /* delay *= 2 */ \
- " mov.z %[delay], 1 \n" /* handle overflow */ \
+ " rol %[delay], %[delay] \n" /* delay *= 2 */ \
" b 1b \n" /* start over */ \
"4: ; --- success --- \n" \
diff --git a/arch/arc/include/asm/spinlock.h b/arch/arc/include/asm/spinlock.h
index 7071fc0da56a..db8c59d1eaeb 100644
--- a/arch/arc/include/asm/spinlock.h
+++ b/arch/arc/include/asm/spinlock.h
@@ -260,8 +260,7 @@ static inline void arch_write_unlock(arch_rwlock_t *rw)
" mov %[tmp], %[delay] \n" /* tmp = delay */ \
"2: brne.d %[tmp], 0, 2b \n" /* while (tmp != 0) */ \
" sub %[tmp], %[tmp], 1 \n" /* tmp-- */ \
- " asl.f %[delay], %[delay], 1 \n" /* delay *= 2 */ \
- " mov.z %[delay], 1 \n" /* handle overflow */ \
+ " rol %[delay], %[delay] \n" /* delay *= 2 */ \
" b 1b \n" /* start over */ \
" \n" \
"4: ; --- done --- \n" \