Module Name: src Committed By: matt Date: Sun Aug 11 04:41:17 UTC 2013
Modified Files: src/common/lib/libc/arch/arm/atomic: atomic_add_32.S atomic_add_64.S atomic_and_32.S atomic_and_64.S atomic_dec_32.S atomic_dec_64.S atomic_inc_32.S atomic_inc_64.S atomic_or_32.S atomic_or_64.S atomic_swap.S Log Message: Use foo{s} since it reduces the ifdefs for thumb To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/common/lib/libc/arch/arm/atomic/atomic_add_32.S \ src/common/lib/libc/arch/arm/atomic/atomic_and_32.S \ src/common/lib/libc/arch/arm/atomic/atomic_dec_32.S \ src/common/lib/libc/arch/arm/atomic/atomic_or_32.S cvs rdiff -u -r1.6 -r1.7 src/common/lib/libc/arch/arm/atomic/atomic_add_64.S \ src/common/lib/libc/arch/arm/atomic/atomic_swap.S cvs rdiff -u -r1.5 -r1.6 src/common/lib/libc/arch/arm/atomic/atomic_and_64.S \ src/common/lib/libc/arch/arm/atomic/atomic_dec_64.S \ src/common/lib/libc/arch/arm/atomic/atomic_inc_32.S \ src/common/lib/libc/arch/arm/atomic/atomic_or_64.S cvs rdiff -u -r1.7 -r1.8 src/common/lib/libc/arch/arm/atomic/atomic_inc_64.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/arm/atomic/atomic_add_32.S diff -u src/common/lib/libc/arch/arm/atomic/atomic_add_32.S:1.4 src/common/lib/libc/arch/arm/atomic/atomic_add_32.S:1.5 --- src/common/lib/libc/arch/arm/atomic/atomic_add_32.S:1.4 Sat Aug 10 19:59:21 2013 +++ src/common/lib/libc/arch/arm/atomic/atomic_add_32.S Sun Aug 11 04:41:17 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_add_32.S,v 1.4 2013/08/10 19:59:21 matt Exp $ */ +/* $NetBSD: atomic_add_32.S,v 1.5 2013/08/11 04:41:17 matt Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ ENTRY_NP(_atomic_add_32) 1: ldrex r3, [r0] /* load old value */ - add r3, r3, r1 /* calculate new value */ + adds r3, r3, r1 /* calculate new value */ strex r2, r3, [r0] /* try to store */ cmp r2, #0 /* succeed? */ bne 1b /* no, try again */ @@ -58,7 +58,7 @@ STRONG_ALIAS(_atomic_add_ptr,_atomic_add ENTRY_NP(_atomic_add_32_nv) mov ip, r0 /* need r0 for return value */ 1: ldrex r0, [ip] /* load old value */ - add r0, r0, r1 /* calculate new value (return value) */ + adds r0, r0, r1 /* calculate new value (return value) */ strex r2, r0, [ip] /* try to store */ cmp r2, #0 /* succeed? */ bne 1b /* no, try again? */ Index: src/common/lib/libc/arch/arm/atomic/atomic_and_32.S diff -u src/common/lib/libc/arch/arm/atomic/atomic_and_32.S:1.4 src/common/lib/libc/arch/arm/atomic/atomic_and_32.S:1.5 --- src/common/lib/libc/arch/arm/atomic/atomic_and_32.S:1.4 Sat Aug 10 19:59:21 2013 +++ src/common/lib/libc/arch/arm/atomic/atomic_and_32.S Sun Aug 11 04:41:17 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_and_32.S,v 1.4 2013/08/10 19:59:21 matt Exp $ */ +/* $NetBSD: atomic_and_32.S,v 1.5 2013/08/11 04:41:17 matt Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ ENTRY_NP(_atomic_and_32) 1: ldrex r3, [r0] /* load old value (to be returned) */ - and r3, r3, r1 /* calculate new value */ + ands r3, r3, r1 /* calculate new value */ strex r2, r3, [r0] /* try to store */ cmp r2, #0 /* succeed? */ bne 1b /* no, try again */ @@ -54,10 +54,10 @@ STRONG_ALIAS(_atomic_and_uint,_atomic_an STRONG_ALIAS(_atomic_and_ulong,_atomic_and_32) ENTRY_NP(_atomic_and_32_nv) - mov r3, r0 /* need r0 for return value */ -1: ldrex r0, [r3] /* load old value */ - and r0, r0, r1 /* calculate new value (return value) */ - strex r2, r0, [r3] /* try to store */ + mov ip, r0 /* need r0 for return value */ +1: ldrex r0, [ip] /* load old value */ + ands r0, r0, r1 /* calculate new value (return value) */ + strex r2, r0, [ip] /* try to store */ cmp r2, #0 /* succeed? */ bne 1b /* no, try again? */ #ifdef _ARM_ARCH_7 Index: src/common/lib/libc/arch/arm/atomic/atomic_dec_32.S diff -u src/common/lib/libc/arch/arm/atomic/atomic_dec_32.S:1.4 src/common/lib/libc/arch/arm/atomic/atomic_dec_32.S:1.5 --- src/common/lib/libc/arch/arm/atomic/atomic_dec_32.S:1.4 Sat Aug 10 19:59:21 2013 +++ src/common/lib/libc/arch/arm/atomic/atomic_dec_32.S Sun Aug 11 04:41:17 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_dec_32.S,v 1.4 2013/08/10 19:59:21 matt Exp $ */ +/* $NetBSD: atomic_dec_32.S,v 1.5 2013/08/11 04:41:17 matt Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. * All rights reserved. @@ -34,7 +34,7 @@ ENTRY_NP(_atomic_dec_32) 1: ldrex r3, [r0] /* load old value (return value) */ - sub r3, r3, #1 /* calculate new value */ + subs r3, r3, #1 /* calculate new value */ strex r2, r3, [r0] /* try to store */ cmp r2, #0 /* succeed? */ bne 1b /* no, try again? */ @@ -57,7 +57,7 @@ STRONG_ALIAS(_atomic_dec_ptr,_atomic_dec ENTRY_NP(_atomic_dec_32_nv) mov ip, r0 /* need r0 for return value */ 1: ldrex r0, [ip] /* load old value */ - sub r0, r0, #1 /* calculate new value (return value) */ + subs r0, r0, #1 /* calculate new value (return value) */ strex r2, r0, [ip] /* try to store */ cmp r2, #0 /* succeed? */ bne 1b /* no, try again? */ Index: src/common/lib/libc/arch/arm/atomic/atomic_or_32.S diff -u src/common/lib/libc/arch/arm/atomic/atomic_or_32.S:1.4 src/common/lib/libc/arch/arm/atomic/atomic_or_32.S:1.5 --- src/common/lib/libc/arch/arm/atomic/atomic_or_32.S:1.4 Sat Aug 10 19:59:21 2013 +++ src/common/lib/libc/arch/arm/atomic/atomic_or_32.S Sun Aug 11 04:41:17 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_or_32.S,v 1.4 2013/08/10 19:59:21 matt Exp $ */ +/* $NetBSD: atomic_or_32.S,v 1.5 2013/08/11 04:41:17 matt Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. * All rights reserved. @@ -34,7 +34,7 @@ ENTRY_NP(_atomic_or_32) 1: ldrex r3, [r0] /* load old value (to be returned) */ - orr r3, r3, r1 /* calculate new value */ + orrs r3, r3, r1 /* calculate new value */ strex r2, r3, [r0] /* try to store */ cmp r2, #0 /* succeed? */ bne 1b /* no, try again */ @@ -55,7 +55,7 @@ STRONG_ALIAS(_atomic_or_ulong,_atomic_or ENTRY_NP(_atomic_or_32_nv) mov ip, r0 /* need r0 for return value */ 1: ldrex r0, [ip] /* load old value */ - orr r0, r0, r1 /* calculate new value (return value) */ + orrs r0, r0, r1 /* calculate new value (return value) */ strex r2, r0, [ip] /* try to store */ cmp r2, #0 /* succeed? */ bne 1b /* no, try again? */ Index: src/common/lib/libc/arch/arm/atomic/atomic_add_64.S diff -u src/common/lib/libc/arch/arm/atomic/atomic_add_64.S:1.6 src/common/lib/libc/arch/arm/atomic/atomic_add_64.S:1.7 --- src/common/lib/libc/arch/arm/atomic/atomic_add_64.S:1.6 Sat Aug 10 19:59:21 2013 +++ src/common/lib/libc/arch/arm/atomic/atomic_add_64.S Sun Aug 11 04:41:17 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_add_64.S,v 1.6 2013/08/10 19:59:21 matt Exp $ */ +/* $NetBSD: atomic_add_64.S,v 1.7 2013/08/11 04:41:17 matt Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. * All rights reserved. @@ -40,12 +40,8 @@ ENTRY_NP(_atomic_add_64_nv) mov r2, r1 #endif 1: ldrexd r0, [ip] /* load old value */ -#ifdef __thumb__ - add LO, LO, NLO /* calculate new value lo */ -#else adds LO, LO, NLO /* calculate new value lo */ -#endif - adc HI, HI, NHI /* calculate new value hi */ + adcs HI, HI, NHI /* calculate new value hi */ strexd r4, r0, [ip] /* try to store */ cmp r4, #0 /* succeed? */ bne 1b /* no, try again? */ Index: src/common/lib/libc/arch/arm/atomic/atomic_swap.S diff -u src/common/lib/libc/arch/arm/atomic/atomic_swap.S:1.6 src/common/lib/libc/arch/arm/atomic/atomic_swap.S:1.7 --- src/common/lib/libc/arch/arm/atomic/atomic_swap.S:1.6 Sat Aug 10 19:59:21 2013 +++ src/common/lib/libc/arch/arm/atomic/atomic_swap.S Sun Aug 11 04:41:17 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_swap.S,v 1.6 2013/08/10 19:59:21 matt Exp $ */ +/* $NetBSD: atomic_swap.S,v 1.7 2013/08/11 04:41:17 matt Exp $ */ /*- * Copyright (c) 2007,2012 The NetBSD Foundation, Inc. @@ -72,7 +72,8 @@ ENTRY_NP(_atomic_swap_32) #endif 99: RET - END(_atomic_swap_32) +END(_atomic_swap_32) + ATOMIC_OP_ALIAS(atomic_swap_32,_atomic_swap_32) ATOMIC_OP_ALIAS(atomic_swap_uint,_atomic_swap_32) ATOMIC_OP_ALIAS(atomic_swap_ulong,_atomic_swap_32) @@ -82,13 +83,13 @@ STRONG_ALIAS(_atomic_swap_ulong,_atomic_ STRONG_ALIAS(_atomic_swap_ptr,_atomic_swap_32) ENTRY_NP(_atomic_swap_8) - mov r2, r0 + mov ip, r0 1: #ifdef _ARM_ARCH_6 - ldrexb r0, [r2] - strexb r3, r1, [r2] + ldrexb r0, [ip] + strexb r3, r1, [ip] #else - swpb r0, r1, [r2] + swpb r0, r1, [ip] mov r3, #0 #endif cmp r3, #0 @@ -99,7 +100,8 @@ ENTRY_NP(_atomic_swap_8) mcr p15, 0, ip, c7, c10, 5 /* data memory barrier */ #endif RET - END(_atomic_swap_8) +END(_atomic_swap_8) + ATOMIC_OP_ALIAS(atomic_swap_8,_atomic_swap_8) ATOMIC_OP_ALIAS(atomic_swap_char,_atomic_swap_8) ATOMIC_OP_ALIAS(atomic_swap_uchar,_atomic_swap_8) Index: src/common/lib/libc/arch/arm/atomic/atomic_and_64.S diff -u src/common/lib/libc/arch/arm/atomic/atomic_and_64.S:1.5 src/common/lib/libc/arch/arm/atomic/atomic_and_64.S:1.6 --- src/common/lib/libc/arch/arm/atomic/atomic_and_64.S:1.5 Sat Aug 10 19:59:21 2013 +++ src/common/lib/libc/arch/arm/atomic/atomic_and_64.S Sun Aug 11 04:41:17 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_and_64.S,v 1.5 2013/08/10 19:59:21 matt Exp $ */ +/* $NetBSD: atomic_and_64.S,v 1.6 2013/08/11 04:41:17 matt Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. * All rights reserved. @@ -40,8 +40,8 @@ ENTRY_NP(_atomic_and_64_nv) #endif mov ip, r0 /* need r0 for return value */ 1: ldrexd r0, [ip] /* load old value */ - and r0, r0, r2 /* calculate new value */ - and r1, r1, r3 /* calculate new value */ + ands r0, r0, r2 /* calculate new value */ + ands r1, r1, r3 /* calculate new value */ strexd r4, r0, [ip] /* try to store */ cmp r4, #0 /* succeed? */ bne 1b /* no, try again? */ Index: src/common/lib/libc/arch/arm/atomic/atomic_dec_64.S diff -u src/common/lib/libc/arch/arm/atomic/atomic_dec_64.S:1.5 src/common/lib/libc/arch/arm/atomic/atomic_dec_64.S:1.6 --- src/common/lib/libc/arch/arm/atomic/atomic_dec_64.S:1.5 Sat Aug 10 19:59:21 2013 +++ src/common/lib/libc/arch/arm/atomic/atomic_dec_64.S Sun Aug 11 04:41:17 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_dec_64.S,v 1.5 2013/08/10 19:59:21 matt Exp $ */ +/* $NetBSD: atomic_dec_64.S,v 1.6 2013/08/11 04:41:17 matt Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. * All rights reserved. @@ -34,17 +34,9 @@ ENTRY_NP(_atomic_dec_64_nv) mov ip, r0 /* need r0 for return value */ -#ifdef __thumb__ - mov r2, #0 -#endif 1: ldrexd r0, [ip] /* load old value */ -#ifdef __thumb__ - sub LO, LO, #1 /* calculate new value */ - sbc HI, HI, r2 /* calculate new value */ -#else subs LO, LO, #1 /* calculate new value */ - sbc HI, HI, #0 /* calculate new value */ -#endif + sbcs HI, HI, #0 /* calculate new value */ strexd r2, r0, [ip] /* try to store */ cmp r2, #0 /* succeed? */ bne 1b /* no, try again? */ Index: src/common/lib/libc/arch/arm/atomic/atomic_inc_32.S diff -u src/common/lib/libc/arch/arm/atomic/atomic_inc_32.S:1.5 src/common/lib/libc/arch/arm/atomic/atomic_inc_32.S:1.6 --- src/common/lib/libc/arch/arm/atomic/atomic_inc_32.S:1.5 Sat Aug 10 19:59:21 2013 +++ src/common/lib/libc/arch/arm/atomic/atomic_inc_32.S Sun Aug 11 04:41:17 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_inc_32.S,v 1.5 2013/08/10 19:59:21 matt Exp $ */ +/* $NetBSD: atomic_inc_32.S,v 1.6 2013/08/11 04:41:17 matt Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. * All rights reserved. @@ -34,7 +34,7 @@ ENTRY_NP(_atomic_inc_32) 1: ldrex r3, [r0] /* load old value (return value) */ - add r3, r3, #1 /* calculate new value */ + adds r3, r3, #1 /* calculate new value */ strex r2, r3, [r0] /* try to store */ cmp r2, #0 /* succeed? */ bne 1b /* no, try again? */ @@ -56,7 +56,7 @@ STRONG_ALIAS(_atomic_inc_ptr,_atomic_inc ENTRY_NP(_atomic_inc_32_nv) mov ip, r0 /* need r0 for return value */ 1: ldrex r0, [ip] /* load old value */ - add r0, r0, #1 /* calculate new value (return value) */ + adds r0, r0, #1 /* calculate new value (return value) */ strex r2, r0, [ip] /* try to store */ cmp r2, #0 /* succeed? */ bne 1b /* no, try again? */ Index: src/common/lib/libc/arch/arm/atomic/atomic_or_64.S diff -u src/common/lib/libc/arch/arm/atomic/atomic_or_64.S:1.5 src/common/lib/libc/arch/arm/atomic/atomic_or_64.S:1.6 --- src/common/lib/libc/arch/arm/atomic/atomic_or_64.S:1.5 Sat Aug 10 19:59:21 2013 +++ src/common/lib/libc/arch/arm/atomic/atomic_or_64.S Sun Aug 11 04:41:17 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_or_64.S,v 1.5 2013/08/10 19:59:21 matt Exp $ */ +/* $NetBSD: atomic_or_64.S,v 1.6 2013/08/11 04:41:17 matt Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. * All rights reserved. @@ -33,24 +33,24 @@ #ifdef _ARM_ARCH_6 ENTRY_NP(_atomic_or_64_nv) - push {r4,r5} /* save temporary */ + push {r4} /* save temporary */ #ifndef __ARM_EABI__ mov r3, r2 mov r2, r1 #endif - mov r4, r0 /* need r0 for return value */ -1: ldrexd r0, [r4] /* load old value */ - orr r0, r0, r2 /* calculate new value (return value) */ - orr r1, r1, r3 /* calculate new value (return value) */ - strexd r5, r0, [r4] /* try to store */ - cmp r5, #0 /* succeed? */ + mov ip, r0 /* need r0 for return value */ +1: ldrexd r0, [ip] /* load old value */ + orrs r0, r0, r2 /* calculate new value (return value) */ + orrs r1, r1, r3 /* calculate new value (return value) */ + strexd r4, r0, [ip] /* try to store */ + cmp r4, #0 /* succeed? */ bne 1b /* no, try again? */ #ifdef _ARM_ARCH_7 dmb #else - mcr p15, 0, r5, c7, c10, 5 /* data memory barrier */ + mcr p15, 0, r4, c7, c10, 5 /* data memory barrier */ #endif - pop {r4,r5} /* restore temporary */ + pop {r4} /* restore temporary */ RET /* return new value */ END(_atomic_or_64_nv) Index: src/common/lib/libc/arch/arm/atomic/atomic_inc_64.S diff -u src/common/lib/libc/arch/arm/atomic/atomic_inc_64.S:1.7 src/common/lib/libc/arch/arm/atomic/atomic_inc_64.S:1.8 --- src/common/lib/libc/arch/arm/atomic/atomic_inc_64.S:1.7 Sat Aug 10 19:59:21 2013 +++ src/common/lib/libc/arch/arm/atomic/atomic_inc_64.S Sun Aug 11 04:41:17 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_inc_64.S,v 1.7 2013/08/10 19:59:21 matt Exp $ */ +/* $NetBSD: atomic_inc_64.S,v 1.8 2013/08/11 04:41:17 matt Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. * All rights reserved. @@ -34,17 +34,9 @@ ENTRY_NP(_atomic_inc_64_nv) mov ip, r0 /* need r0 for return value */ -#ifdef __thumb__ - mov r2, #0 -#endif 1: ldrexd r0, [ip] /* load old value */ -#ifdef __thumb__ - add LO, LO, #1 /* calculate new value */ - adc HI, HI, r2 /* zero means we carried */ -#else adds LO, LO, #1 /* calculate new value (return value) */ - adc HI, HI, #0 /* fold carry into high */ -#endif + adcs HI, HI, #0 /* fold carry into high */ strexd r2, r0, [ip] /* try to store */ cmp r2, #0 /* succeed? */ bne 1b /* no, try again? */