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 gcc 4.4 and later operat...



details:   https://anonhg.NetBSD.org/src/rev/391029286b7f
branches:  trunk
changeset: 812333:391029286b7f
user:      skrll <skrll%NetBSD.org@localhost>
date:      Fri Dec 11 12:41:10 2015 +0000

description:
Use gcc 4.4 and later operation for nand, i.e.
*ptr = ~(tmp & value) instead of *ptr = ~tmp & value

There was also another bug in sync_fetch_and_nand_8 which I've also fixed.

PR port-arm32/50513: Incorrect logic for atomic_nand_xx.S

diffstat:

 common/lib/libc/arch/arm/atomic/atomic_nand_16.S        |  10 +++++-----
 common/lib/libc/arch/arm/atomic/atomic_nand_32.S        |  10 +++++-----
 common/lib/libc/arch/arm/atomic/atomic_nand_64.S        |  10 +++++-----
 common/lib/libc/arch/arm/atomic/atomic_nand_8.S         |  10 +++++-----
 common/lib/libc/arch/arm/atomic/sync_fetch_and_nand_8.S |  10 +++++-----
 5 files changed, 25 insertions(+), 25 deletions(-)

diffs (141 lines):

diff -r 6bab7fdc964f -r 391029286b7f common/lib/libc/arch/arm/atomic/atomic_nand_16.S
--- a/common/lib/libc/arch/arm/atomic/atomic_nand_16.S  Fri Dec 11 10:05:17 2015 +0000
+++ b/common/lib/libc/arch/arm/atomic/atomic_nand_16.S  Fri Dec 11 12:41:10 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atomic_nand_16.S,v 1.2 2014/03/04 16:15:28 matt Exp $  */
+/*     $NetBSD: atomic_nand_16.S,v 1.3 2015/12/11 12:41:10 skrll Exp $ */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -36,8 +36,8 @@
 ENTRY_NP(_atomic_nand_16)
        mov     ip, r0
 1:     ldrexh  r0, [ip]                /* load old value (to be returned) */
-       mvns    r3, r0                  /* complement source */
-       ands    r3, r3, r1              /* calculate new value */
+       ands    r3, r0, r1              /* calculate new value step 1 */
+       mvns    r3, r3                  /* ... complement for new value */
        strexh  r2, r3, [ip]            /* try to store */
        cmp     r2, #0                  /*   succeed? */
        bne     1b                      /*     no, try again */
@@ -57,8 +57,8 @@
 ENTRY_NP(_atomic_nand_16_nv)
        mov     ip, r0                  /* need r0 for return value */
 1:     ldrexh  r0, [ip]                /* load old value */
-       mvns    r0, r0                  /* complement source */
-       ands    r0, r0, r1              /* calculate new value (return value) */
+       ands    r0, r0, r1              /* calculate new value step 1 */
+       mvns    r0, r0                  /* ... complement for new value */
        strexh  r2, r0, [ip]            /* try to store */
        cmp     r2, #0                  /*   succeed? */
        bne     1b                      /*     no, try again? */
diff -r 6bab7fdc964f -r 391029286b7f common/lib/libc/arch/arm/atomic/atomic_nand_32.S
--- a/common/lib/libc/arch/arm/atomic/atomic_nand_32.S  Fri Dec 11 10:05:17 2015 +0000
+++ b/common/lib/libc/arch/arm/atomic/atomic_nand_32.S  Fri Dec 11 12:41:10 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atomic_nand_32.S,v 1.2 2014/03/04 16:15:28 matt Exp $  */
+/*     $NetBSD: atomic_nand_32.S,v 1.3 2015/12/11 12:41:10 skrll Exp $ */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -36,8 +36,8 @@
 ENTRY_NP(_atomic_nand_32)
        mov     ip, r0
 1:     ldrex   r0, [ip]                /* load old value (to be returned) */
-       mvns    r3, r0                  /* complement source */
-       ands    r3, r3, r1              /* calculate new value */
+       ands    r3, r0, r1              /* calculate new value step 1 */
+       mvns    r3, r3                  /* ... complement for new value */
        strex   r2, r3, [ip]            /* try to store */
        cmp     r2, #0                  /*   succeed? */
        bne     1b                      /*     no, try again */
@@ -59,8 +59,8 @@
 ENTRY_NP(_atomic_nand_32_nv)
        mov     ip, r0                  /* need r0 for return value */
 1:     ldrex   r0, [ip]                /* load old value */
-       mvns    r0, r0                  /* complement source */
-       ands    r0, r0, r1              /* calculate new value (return value) */
+       ands    r0, r0, r1              /* calculate new value step 1 */
+       mvns    r0, r0                  /* ... complement for new value */
        strex   r2, r0, [ip]            /* try to store */
        cmp     r2, #0                  /*   succeed? */
        bne     1b                      /*     no, try again? */
diff -r 6bab7fdc964f -r 391029286b7f common/lib/libc/arch/arm/atomic/atomic_nand_64.S
--- a/common/lib/libc/arch/arm/atomic/atomic_nand_64.S  Fri Dec 11 10:05:17 2015 +0000
+++ b/common/lib/libc/arch/arm/atomic/atomic_nand_64.S  Fri Dec 11 12:41:10 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atomic_nand_64.S,v 1.3 2014/03/04 16:15:28 matt Exp $  */
+/*     $NetBSD: atomic_nand_64.S,v 1.4 2015/12/11 12:41:10 skrll Exp $ */
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -40,10 +40,10 @@
 #endif
        mov     ip, r0                  /* need r0 for return value */
 1:     ldrexd  r0, r1, [ip]            /* load old value */
-       mvns    r0, r0                  /* complement old value */
-       mvns    r1, r1                  /* complement old value */
-       ands    r0, r0, r2              /* calculate new value */
-       ands    r1, r1, r3              /* calculate new value */
+       ands    r0, r0, r2              /* calculate new value step 1 */
+       ands    r1, r1, r3              /* calculate new value step 2 */
+       mvns    r0, r0                  /* ... complement for new value */
+       mvns    r1, r1                  /* ... complement for new value */
        strexd  r4, r0, r1, [ip]        /* try to store */
        cmp     r4, #0                  /*   succeed? */
        bne     1b                      /*     no, try again? */
diff -r 6bab7fdc964f -r 391029286b7f common/lib/libc/arch/arm/atomic/atomic_nand_8.S
--- a/common/lib/libc/arch/arm/atomic/atomic_nand_8.S   Fri Dec 11 10:05:17 2015 +0000
+++ b/common/lib/libc/arch/arm/atomic/atomic_nand_8.S   Fri Dec 11 12:41:10 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atomic_nand_8.S,v 1.2 2014/03/04 16:15:28 matt Exp $   */
+/*     $NetBSD: atomic_nand_8.S,v 1.3 2015/12/11 12:41:10 skrll Exp $  */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -36,8 +36,8 @@
 ENTRY_NP(_atomic_nand_8)
        mov     ip, r0
 1:     ldrexb  r0, [ip]                /* load old value (to be returned) */
-       mvns    r3, r0                  /* complement source */
-       ands    r3, r3, r1              /* calculate new value */
+       ands    r3, r0, r1              /* calculate new value step 1 */
+       mvns    r3, r3                  /* ... complement for new value */
        strexb  r2, r3, [ip]            /* try to store */
        cmp     r2, #0                  /*   succeed? */
        bne     1b                      /*     no, try again */
@@ -57,8 +57,8 @@
 ENTRY_NP(_atomic_nand_8_nv)
        mov     ip, r0                  /* need r0 for return value */
 1:     ldrexb  r0, [ip]                /* load old value */
-       mvns    r0, r0                  /* complement source */
-       ands    r0, r0, r1              /* calculate new value (return value) */
+       ands    r0, r0, r1              /* calculate new value step 1*/
+       mvns    r0, r0                  /* ... complement for new value */
        strexb  r2, r0, [ip]            /* try to store */
        cmp     r2, #0                  /*   succeed? */
        bne     1b                      /*     no, try again? */
diff -r 6bab7fdc964f -r 391029286b7f common/lib/libc/arch/arm/atomic/sync_fetch_and_nand_8.S
--- a/common/lib/libc/arch/arm/atomic/sync_fetch_and_nand_8.S   Fri Dec 11 10:05:17 2015 +0000
+++ b/common/lib/libc/arch/arm/atomic/sync_fetch_and_nand_8.S   Fri Dec 11 12:41:10 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sync_fetch_and_nand_8.S,v 1.4 2015/05/17 22:08:24 justin Exp $ */
+/*     $NetBSD: sync_fetch_and_nand_8.S,v 1.5 2015/12/11 12:41:10 skrll Exp $  */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -41,10 +41,10 @@
        mov     r2, r1
 #endif
 1:     ldrexd  r0, r1, [ip]            /* load old value */
-       mvns    r4, r0                  /* complement old value */
-       mvns    r5, r0                  /* complement old value */
-       ands    r4, r4, r2              /* calculate new value */
-       ands    r5, r5, r3              /* calculate new value */
+       ands    r4, r0, r2              /* calculate new value step 1 */
+       ands    r5, r1, r3              /* calculate new value step 1 */
+       mvns    r4, r4                  /* complement new value */
+       mvns    r5, r5                  /* complement new value */
        strexd  r6, r4, r5, [ip]        /* try to store */
        cmp     r6, #0                  /*   succeed? */
        bne     1b                      /*     no, try again */



Home | Main Index | Thread Index | Old Index