Module Name: src Committed By: snj Date: Thu Jul 16 21:45:52 UTC 2015
Modified Files: src/common/lib/libc/arch/m68k/atomic [netbsd-7]: atomic_cas.S Log Message: 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). To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.10.4.1 \ src/common/lib/libc/arch/m68k/atomic/atomic_cas.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/common/lib/libc/arch/m68k/atomic/atomic_cas.S diff -u src/common/lib/libc/arch/m68k/atomic/atomic_cas.S:1.10 src/common/lib/libc/arch/m68k/atomic/atomic_cas.S:1.10.4.1 --- src/common/lib/libc/arch/m68k/atomic/atomic_cas.S:1.10 Sat Feb 22 17:08:30 2014 +++ src/common/lib/libc/arch/m68k/atomic/atomic_cas.S Thu Jul 16 21:45:52 2015 @@ -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 @@ STRONG_ALIAS(_atomic_cas_ptr_ni,_atomic_ 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 @@ CRT_ALIAS(__sync_val_compare_and_swap_2, 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 @@ CRT_ALIAS(__sync_val_compare_and_swap_1, 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)