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/arm/atomic Use foo{s} since it reduces ...



details:   https://anonhg.NetBSD.org/src/rev/aa9a7bfd055f
branches:  trunk
changeset: 789220:aa9a7bfd055f
user:      matt <matt%NetBSD.org@localhost>
date:      Sun Aug 11 04:41:17 2013 +0000

description:
Use foo{s} since it reduces the ifdefs for thumb

diffstat:

 common/lib/libc/arch/arm/atomic/atomic_add_32.S |   6 +++---
 common/lib/libc/arch/arm/atomic/atomic_add_64.S |   8 ++------
 common/lib/libc/arch/arm/atomic/atomic_and_32.S |  12 ++++++------
 common/lib/libc/arch/arm/atomic/atomic_and_64.S |   6 +++---
 common/lib/libc/arch/arm/atomic/atomic_dec_32.S |   6 +++---
 common/lib/libc/arch/arm/atomic/atomic_dec_64.S |  12 ++----------
 common/lib/libc/arch/arm/atomic/atomic_inc_32.S |   6 +++---
 common/lib/libc/arch/arm/atomic/atomic_inc_64.S |  12 ++----------
 common/lib/libc/arch/arm/atomic/atomic_or_32.S  |   6 +++---
 common/lib/libc/arch/arm/atomic/atomic_or_64.S  |  20 ++++++++++----------
 common/lib/libc/arch/arm/atomic/atomic_swap.S   |  16 +++++++++-------
 11 files changed, 46 insertions(+), 64 deletions(-)

diffs (truncated from 330 to 300 lines):

diff -r 27062f57a1c9 -r aa9a7bfd055f common/lib/libc/arch/arm/atomic/atomic_add_32.S
--- a/common/lib/libc/arch/arm/atomic/atomic_add_32.S   Sun Aug 11 04:40:58 2013 +0000
+++ b/common/lib/libc/arch/arm/atomic/atomic_add_32.S   Sun Aug 11 04:41:17 2013 +0000
@@ -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 @@
 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? */
diff -r 27062f57a1c9 -r aa9a7bfd055f common/lib/libc/arch/arm/atomic/atomic_add_64.S
--- a/common/lib/libc/arch/arm/atomic/atomic_add_64.S   Sun Aug 11 04:40:58 2013 +0000
+++ b/common/lib/libc/arch/arm/atomic/atomic_add_64.S   Sun Aug 11 04:41:17 2013 +0000
@@ -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 @@
        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? */
diff -r 27062f57a1c9 -r aa9a7bfd055f common/lib/libc/arch/arm/atomic/atomic_and_32.S
--- a/common/lib/libc/arch/arm/atomic/atomic_and_32.S   Sun Aug 11 04:40:58 2013 +0000
+++ b/common/lib/libc/arch/arm/atomic/atomic_and_32.S   Sun Aug 11 04:41:17 2013 +0000
@@ -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_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
diff -r 27062f57a1c9 -r aa9a7bfd055f common/lib/libc/arch/arm/atomic/atomic_and_64.S
--- a/common/lib/libc/arch/arm/atomic/atomic_and_64.S   Sun Aug 11 04:40:58 2013 +0000
+++ b/common/lib/libc/arch/arm/atomic/atomic_and_64.S   Sun Aug 11 04:41:17 2013 +0000
@@ -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 @@
 #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? */
diff -r 27062f57a1c9 -r aa9a7bfd055f common/lib/libc/arch/arm/atomic/atomic_dec_32.S
--- a/common/lib/libc/arch/arm/atomic/atomic_dec_32.S   Sun Aug 11 04:40:58 2013 +0000
+++ b/common/lib/libc/arch/arm/atomic/atomic_dec_32.S   Sun Aug 11 04:41:17 2013 +0000
@@ -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 @@
 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? */
diff -r 27062f57a1c9 -r aa9a7bfd055f common/lib/libc/arch/arm/atomic/atomic_dec_64.S
--- a/common/lib/libc/arch/arm/atomic/atomic_dec_64.S   Sun Aug 11 04:40:58 2013 +0000
+++ b/common/lib/libc/arch/arm/atomic/atomic_dec_64.S   Sun Aug 11 04:41:17 2013 +0000
@@ -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? */
diff -r 27062f57a1c9 -r aa9a7bfd055f common/lib/libc/arch/arm/atomic/atomic_inc_32.S
--- a/common/lib/libc/arch/arm/atomic/atomic_inc_32.S   Sun Aug 11 04:40:58 2013 +0000
+++ b/common/lib/libc/arch/arm/atomic/atomic_inc_32.S   Sun Aug 11 04:41:17 2013 +0000
@@ -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 @@
 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? */
diff -r 27062f57a1c9 -r aa9a7bfd055f common/lib/libc/arch/arm/atomic/atomic_inc_64.S
--- a/common/lib/libc/arch/arm/atomic/atomic_inc_64.S   Sun Aug 11 04:40:58 2013 +0000
+++ b/common/lib/libc/arch/arm/atomic/atomic_inc_64.S   Sun Aug 11 04:41:17 2013 +0000
@@ -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? */
diff -r 27062f57a1c9 -r aa9a7bfd055f common/lib/libc/arch/arm/atomic/atomic_or_32.S
--- a/common/lib/libc/arch/arm/atomic/atomic_or_32.S    Sun Aug 11 04:40:58 2013 +0000
+++ b/common/lib/libc/arch/arm/atomic/atomic_or_32.S    Sun Aug 11 04:41:17 2013 +0000
@@ -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 @@
 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? */
diff -r 27062f57a1c9 -r aa9a7bfd055f common/lib/libc/arch/arm/atomic/atomic_or_64.S
--- a/common/lib/libc/arch/arm/atomic/atomic_or_64.S    Sun Aug 11 04:40:58 2013 +0000
+++ b/common/lib/libc/arch/arm/atomic/atomic_or_64.S    Sun Aug 11 04:41:17 2013 +0000
@@ -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)
 
diff -r 27062f57a1c9 -r aa9a7bfd055f common/lib/libc/arch/arm/atomic/atomic_swap.S
--- a/common/lib/libc/arch/arm/atomic/atomic_swap.S     Sun Aug 11 04:40:58 2013 +0000
+++ b/common/lib/libc/arch/arm/atomic/atomic_swap.S     Sun Aug 11 04:41:17 2013 +0000
@@ -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 @@
 #endif
 99:
        RET
-       END(_atomic_swap_32)
+END(_atomic_swap_32)
+
 ATOMIC_OP_ALIAS(atomic_swap_32,_atomic_swap_32)



Home | Main Index | Thread Index | Old Index