Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/common/lib/libc/arch/m68k/atomic Improve the code in __sync_...



details:   https://anonhg.NetBSD.org/src/rev/c0095360b3df
branches:  trunk
changeset: 809345:c0095360b3df
user:      isaki <isaki%NetBSD.org@localhost>
date:      Sat Jul 04 07:11:45 2015 +0000

description:
Improve the code in __sync_bool_compare_and_swap_{1,2,4}.
- bccs is smaller and faster than bcc(.w) in this case.
- it can be used movql in this case (assembler optimise it though).

diffstat:

 common/lib/libc/arch/m68k/atomic/atomic_cas.S |  14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diffs (48 lines):

diff -r 05ee60c51df5 -r c0095360b3df common/lib/libc/arch/m68k/atomic/atomic_cas.S
--- a/common/lib/libc/arch/m68k/atomic/atomic_cas.S     Sat Jul 04 06:56:29 2015 +0000
+++ b/common/lib/libc/arch/m68k/atomic/atomic_cas.S     Sat Jul 04 07:11:45 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atomic_cas.S,v 1.11 2015/07/04 06:56:29 isaki Exp $    */
+/*     $NetBSD: atomic_cas.S,v 1.12 2015/07/04 07:11:45 isaki Exp $    */
 
 /*-
  * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
@@ -66,10 +66,10 @@
        movl    8(%sp), %d0
        movl    12(%sp), %d1
        casl    %d0, %d1, (%a0)
-       beq     1f
+       beqs    1f
        clrl    %d0     /* return false */
        rts
-1:     movl    #1, %d0 /* return success */
+1:     movql   #1, %d0 /* return success */
        rts
 END(__sync_bool_compare_and_swap_4)
 
@@ -91,10 +91,10 @@
        movw    12+2(%sp), %d1          /* lower word */
        casw    %d0, %d1, (%a0)
        /* %d3 now contains the old value */
-       beq     1f
+       beqs    1f
        clrl    %d0     /* return failure */
        rts
-1:     movl    #1, %d0 /* return success */
+1:     movql   #1, %d0 /* return success */
        rts
 END(__sync_bool_compare_and_swap_2)
 
@@ -117,10 +117,10 @@
        movb    12+3(%sp), %d1          /* lower byte */
        casb    %d0, %d1, (%a0)
        /* %d3 now contains the old value */
-       beq     1f
+       beqs    1f
        clrl    %d0     /* return failure */
        rts
-1:     movl    #1, %d0 /* return success */
+1:     movql   #1, %d0 /* return success */
        rts
 END(__sync_bool_compare_and_swap_1)
 



Home | Main Index | Thread Index | Old Index