提交 6ec27475 编写于 作者: M Mikulas Patocka 提交者: David S. Miller

sparc64: simple microoptimizations for atomic functions

Simple microoptimizations for sparc64 atomic functions:
Save one instruction by using a delay slot.
Use %g1 instead of %g7, because %g1 is written earlier.
Signed-off-by: NMikulas Patocka <mpatocka@redhat.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 9b3bb86a
...@@ -52,10 +52,9 @@ atomic_add_ret: /* %o0 = increment, %o1 = atomic_ptr */ ...@@ -52,10 +52,9 @@ atomic_add_ret: /* %o0 = increment, %o1 = atomic_ptr */
cas [%o1], %g1, %g7 cas [%o1], %g1, %g7
cmp %g1, %g7 cmp %g1, %g7
bne,pn %icc, 2f bne,pn %icc, 2f
add %g7, %o0, %g7 add %g1, %o0, %g1
sra %g7, 0, %o0
retl retl
nop sra %g1, 0, %o0
2: BACKOFF_SPIN(%o2, %o3, 1b) 2: BACKOFF_SPIN(%o2, %o3, 1b)
.size atomic_add_ret, .-atomic_add_ret .size atomic_add_ret, .-atomic_add_ret
...@@ -68,10 +67,9 @@ atomic_sub_ret: /* %o0 = decrement, %o1 = atomic_ptr */ ...@@ -68,10 +67,9 @@ atomic_sub_ret: /* %o0 = decrement, %o1 = atomic_ptr */
cas [%o1], %g1, %g7 cas [%o1], %g1, %g7
cmp %g1, %g7 cmp %g1, %g7
bne,pn %icc, 2f bne,pn %icc, 2f
sub %g7, %o0, %g7 sub %g1, %o0, %g1
sra %g7, 0, %o0
retl retl
nop sra %g1, 0, %o0
2: BACKOFF_SPIN(%o2, %o3, 1b) 2: BACKOFF_SPIN(%o2, %o3, 1b)
.size atomic_sub_ret, .-atomic_sub_ret .size atomic_sub_ret, .-atomic_sub_ret
...@@ -114,10 +112,9 @@ atomic64_add_ret: /* %o0 = increment, %o1 = atomic_ptr */ ...@@ -114,10 +112,9 @@ atomic64_add_ret: /* %o0 = increment, %o1 = atomic_ptr */
casx [%o1], %g1, %g7 casx [%o1], %g1, %g7
cmp %g1, %g7 cmp %g1, %g7
bne,pn %xcc, 2f bne,pn %xcc, 2f
add %g7, %o0, %g7
mov %g7, %o0
retl
nop nop
retl
add %g1, %o0, %o0
2: BACKOFF_SPIN(%o2, %o3, 1b) 2: BACKOFF_SPIN(%o2, %o3, 1b)
.size atomic64_add_ret, .-atomic64_add_ret .size atomic64_add_ret, .-atomic64_add_ret
...@@ -130,9 +127,8 @@ atomic64_sub_ret: /* %o0 = decrement, %o1 = atomic_ptr */ ...@@ -130,9 +127,8 @@ atomic64_sub_ret: /* %o0 = decrement, %o1 = atomic_ptr */
casx [%o1], %g1, %g7 casx [%o1], %g1, %g7
cmp %g1, %g7 cmp %g1, %g7
bne,pn %xcc, 2f bne,pn %xcc, 2f
sub %g7, %o0, %g7
mov %g7, %o0
retl
nop nop
retl
sub %g1, %o0, %o0
2: BACKOFF_SPIN(%o2, %o3, 1b) 2: BACKOFF_SPIN(%o2, %o3, 1b)
.size atomic64_sub_ret, .-atomic64_sub_ret .size atomic64_sub_ret, .-atomic64_sub_ret
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册