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/aarch64/atomic fix atomic_sub_*(). it w...



details:   https://anonhg.NetBSD.org/src/rev/52111e5797c4
branches:  trunk
changeset: 448621:52111e5797c4
user:      ryo <ryo%NetBSD.org@localhost>
date:      Wed Feb 06 05:33:14 2019 +0000

description:
fix atomic_sub_*(). it was (delta - *ptr), should be (*ptr - delta).
changing shared macro doesn't effect other atomic_ops because
(*ptr [+|^] delta) and (delta [+|^] *ptr) have same result.

atomic_sub_*() haven't used because non standard API?

diffstat:

 common/lib/libc/arch/aarch64/atomic/atomic_op_asm.h |  14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diffs (63 lines):

diff -r c58746d6271e -r 52111e5797c4 common/lib/libc/arch/aarch64/atomic/atomic_op_asm.h
--- a/common/lib/libc/arch/aarch64/atomic/atomic_op_asm.h       Wed Feb 06 05:04:41 2019 +0000
+++ b/common/lib/libc/arch/aarch64/atomic/atomic_op_asm.h       Wed Feb 06 05:33:14 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: atomic_op_asm.h,v 1.1 2014/08/10 05:47:35 matt Exp $ */
+/* $NetBSD: atomic_op_asm.h,v 1.2 2019/02/06 05:33:14 ryo Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 ENTRY_NP(_atomic_##OP##_8)                                             ;\
        mov     x4, x0                                                  ;\
 1:     ldxrb   w0, [x4]                /* load old value */            ;\
-       INSN    w2, w1, w0              /* calculate new value */       ;\
+       INSN    w2, w0, w1              /* calculate new value */       ;\
        stxrb   w3, w2, [x4]            /* try to store */              ;\
        cbnz    w3, 1b                  /*   succeed? no, try again */  ;\
        dmb     st                                                      ;\
@@ -49,7 +49,7 @@
 ENTRY_NP(_atomic_##OP##_8_nv)                                          ;\
        mov     x4, x0                  /* need r0 for return value */  ;\
 1:     ldxrb   w0, [x4]                /* load old value */            ;\
-       INSN    w2, w1, w0              /* calc new (return) value */   ;\
+       INSN    w2, w0, w1              /* calc new (return) value */   ;\
        stxrb   w3, w2, [x4]            /* try to store */              ;\
        cbnz    w3, 1b                  /*   succeed? no, try again */  ;\
        dmb     st                                                      ;\
@@ -60,7 +60,7 @@
 ENTRY_NP(_atomic_##OP##_16)                                            ;\
        mov     x4, x0                                                  ;\
 1:     ldxrh   w0, [x4]                /* load old value */            ;\
-       INSN    w2, w1, w0              /* calculate new value */       ;\
+       INSN    w2, w0, w1              /* calculate new value */       ;\
        stxrh   w3, w2, [x4]            /* try to store */              ;\
        cbnz    w3, 1b                  /*   succeed? no, try again */  ;\
        dmb     st                                                      ;\
@@ -71,7 +71,7 @@
 ENTRY_NP(_atomic_##OP##_16_nv)                                         ;\
        mov     x4, x0                  /* need r0 for return value */  ;\
 1:     ldxrh   w0, [x4]                /* load old value */            ;\
-       INSN    w2, w1, w0              /* calc new (return) value */   ;\
+       INSN    w2, w0, w1              /* calc new (return) value */   ;\
        stxrh   w3, w2, [x4]            /* try to store */              ;\
        cbnz    w3, 1b                  /*   succeed? no, try again */  ;\
        dmb     st                                                      ;\
@@ -82,7 +82,7 @@
 ENTRY_NP(_atomic_##OP##_32)                                            ;\
        mov     x4, x0                                                  ;\
 1:     ldxr    w0, [x4]                /* load old value */            ;\
-       INSN    w2, w1, w0              /* calculate new value */       ;\
+       INSN    w2, w0, w1              /* calculate new value */       ;\
        stxr    w3, w2, [x4]            /* try to store */              ;\
        cbnz    w3, 1b                  /*   succeed? no, try again */  ;\
        dmb     st                                                      ;\
@@ -104,7 +104,7 @@
 ENTRY_NP(_atomic_##OP##_64)                                            ;\
        mov     x4, x0                                                  ;\
 1:     ldxr    x0, [x4]                /* load old value */            ;\
-       INSN    x2, x1, x0              /* calculate new value */       ;\
+       INSN    x2, x0, x1              /* calculate new value */       ;\
        stxr    w3, x2, [x4]            /* try to store */              ;\
        cbnz    w3, 1b                  /*   succeed? no, try again */  ;\
        dmb     st                                                      ;\



Home | Main Index | Thread Index | Old Index