Source-Changes-HG archive

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

[src/netbsd-7]: src/common/lib/libc/arch/m68k/atomic Pull up following revisi...



details:   https://anonhg.NetBSD.org/src/rev/32c5a596f8ff
branches:  netbsd-7
changeset: 799474:32c5a596f8ff
user:      snj <snj%NetBSD.org@localhost>
date:      Thu Jul 16 21:45:52 2015 +0000

description:
Pull up following revision(s) (requested by isaki in ticket #865):
        common/lib/libc/arch/m68k/atomic/atomic_cas.S: revisions 1.11, 1.12
atomic_cas_{8,16}:
 - Correct the wrong offset in stack.
__sync_bool_compare_and_swap_{1,2,4}:
 - Correct the wrong offset in stack.
 - D3 must be preserved in subroutines.
PR/49995.
--
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 |  42 ++++++++++++--------------
 1 files changed, 19 insertions(+), 23 deletions(-)

diffs (89 lines):

diff -r c7eafa672b93 -r 32c5a596f8ff common/lib/libc/arch/m68k/atomic/atomic_cas.S
--- a/common/lib/libc/arch/m68k/atomic/atomic_cas.S     Thu Jul 16 21:43:07 2015 +0000
+++ b/common/lib/libc/arch/m68k/atomic/atomic_cas.S     Thu Jul 16 21:45:52 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atomic_cas.S,v 1.10 2014/02/22 17:08:30 martin Exp $   */
+/*     $NetBSD: atomic_cas.S,v 1.10.4.1 2015/07/16 21:45:52 snj Exp $  */
 
 /*-
  * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
@@ -63,22 +63,20 @@
 
 ENTRY(__sync_bool_compare_and_swap_4)
        movl    4(%sp), %a0
-       movl    8(%sp), %d3
-       movl    %d3, %d2
+       movl    8(%sp), %d0
        movl    12(%sp), %d1
-       casl    %d3, %d1, (%a0)
-       /* %d3 now contains the old value */
-       beq     1f
+       casl    %d0, %d1, (%a0)
+       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)
 
 ENTRY(_atomic_cas_16)
        movl    4(%sp), %a0
-       movw    8(%sp), %d0
-       movw    10(%sp), %d1
+       movw    8+2(%sp), %d0           /* lower word */
+       movw    12+2(%sp), %d1          /* lower word */
        casw    %d0, %d1, (%a0)
        /* %d0 now contains the old value */
        rts
@@ -89,22 +87,21 @@
 
 ENTRY(__sync_bool_compare_and_swap_2)
        movl    4(%sp), %a0
-       movw    8(%sp), %d3
-       movw    %d3, %d2
-       movw    10(%sp), %d1
-       casw    %d3, %d1, (%a0)
+       movw    8+2(%sp), %d0           /* lower word */
+       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)
 
 ENTRY(_atomic_cas_8)
        movl    4(%sp), %a0
-       movb    8(%sp), %d0
-       movb    9(%sp), %d1
+       movb    8+3(%sp), %d0           /* lower byte */
+       movb    12+3(%sp), %d1          /* lower byte */
        casb    %d0, %d1, (%a0)
        /* %d0 now contains the old value */
        rts
@@ -116,15 +113,14 @@
 
 ENTRY(__sync_bool_compare_and_swap_1)
        movl    4(%sp), %a0
-       movb    8(%sp), %d3
-       movb    %d3, %d2
-       movb    9(%sp), %d1
-       casb    %d3, %d1, (%a0)
+       movb    8+3(%sp), %d0           /* lower byte */
+       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