Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-9]: src/common/lib/libc/arch/aarch64/atomic Pull up following rev...
details: https://anonhg.NetBSD.org/src/rev/90d1a01d31fa
branches: netbsd-9
changeset: 984394:90d1a01d31fa
user: martin <martin%NetBSD.org@localhost>
date: Tue Jul 06 04:13:50 2021 +0000
description:
Pull up following revision(s) (requested by skrll in ticket #1314):
common/lib/libc/arch/aarch64/atomic/atomic_nand_8.S: revision 1.3
common/lib/libc/arch/aarch64/atomic/atomic_nand_8.S: revision 1.4
common/lib/libc/arch/aarch64/atomic/atomic_nand_64.S: revision 1.3
common/lib/libc/arch/aarch64/atomic/atomic_nand_64.S: revision 1.4
common/lib/libc/arch/aarch64/atomic/atomic_nand_16.S: revision 1.3
common/lib/libc/arch/aarch64/atomic/atomic_nand_32.S: revision 1.3
common/lib/libc/arch/aarch64/atomic/atomic_nand_32.S: revision 1.4
Fix the logic operation for atomic_nand_{8,16,32,64}
From the gcc docs the operations are as follows
{ tmp = *ptr; *ptr = ~(tmp & value); return tmp; } // nand
{ tmp = ~(*ptr & value); *ptr = tmp; return *ptr; } // nand
yes, this is really rather strange.
typo in comment s/pte/ptr/
diffstat:
common/lib/libc/arch/aarch64/atomic/atomic_nand_16.S | 21 +++++++++++++------
common/lib/libc/arch/aarch64/atomic/atomic_nand_32.S | 19 ++++++++++++-----
common/lib/libc/arch/aarch64/atomic/atomic_nand_64.S | 21 +++++++++++++------
common/lib/libc/arch/aarch64/atomic/atomic_nand_8.S | 20 ++++++++++++------
4 files changed, 54 insertions(+), 27 deletions(-)
diffs (182 lines):
diff -r 3f0aaa4c4f8b -r 90d1a01d31fa common/lib/libc/arch/aarch64/atomic/atomic_nand_16.S
--- a/common/lib/libc/arch/aarch64/atomic/atomic_nand_16.S Tue Jul 06 04:11:31 2021 +0000
+++ b/common/lib/libc/arch/aarch64/atomic/atomic_nand_16.S Tue Jul 06 04:13:50 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: atomic_nand_16.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */
+/* $NetBSD: atomic_nand_16.S,v 1.1.28.1 2021/07/06 04:13:50 martin Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,11 +31,14 @@
#include "atomic_op_asm.h"
+/*
+ * { tmp = *ptr; *ptr = ~(tmp & value); return tmp; } // nand
+ */
ENTRY_NP(_atomic_nand_16)
mov x4, x0
-1: ldxrh w0, [x4] /* load old value (to be returned) */
- mvn w3, w0 /* complement source */
- and w3, w3, w1 /* calculate new value */
+1: ldxrh w0, [x4] /* load old value (*ptr) */
+ and w3, w0, w1 /* w3 = (*ptr & value) */
+ mvn w3, w3 /* w3 = ~(*pte & value) */
stxrh w2, w3, [x4] /* try to store */
cbnz w2, 1b /* succeed? no, try again */
dmb st
@@ -47,11 +50,15 @@
STRONG_ALIAS(__sync_fetch_and_nand_2,_atomic_nand_16)
STRONG_ALIAS(_atomic_nand_ushort,_atomic_nand_16)
+
+/*
+ * { tmp = ~(*ptr & value); *ptr = tmp; return *ptr; } // nand
+ */
ENTRY_NP(_atomic_nand_16_nv)
mov x4, x0 /* need r0 for return value */
-1: ldxrh w0, [x4] /* load old value */
- mvn w0, w0 /* complement source */
- and w0, w0, w1 /* calculate new value (return value) */
+1: ldxrh w0, [x4] /* load old value (*ptr) */
+ and w0, w0, w1 /* w0 = (*ptr & value) */
+ mvn w0, w0 /* w0 = ~(*pte & value), return value */
stxrh w2, w0, [x4] /* try to store */
cbnz w2, 1b /* succeed? no, try again? */
dmb st
diff -r 3f0aaa4c4f8b -r 90d1a01d31fa common/lib/libc/arch/aarch64/atomic/atomic_nand_32.S
--- a/common/lib/libc/arch/aarch64/atomic/atomic_nand_32.S Tue Jul 06 04:11:31 2021 +0000
+++ b/common/lib/libc/arch/aarch64/atomic/atomic_nand_32.S Tue Jul 06 04:13:50 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: atomic_nand_32.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */
+/* $NetBSD: atomic_nand_32.S,v 1.1.28.1 2021/07/06 04:13:50 martin Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,11 +31,14 @@
#include "atomic_op_asm.h"
+/*
+ * { tmp = *ptr; *ptr = ~(tmp & value); return tmp; } // nand
+ */
ENTRY_NP(_atomic_nand_32)
mov x4, x0
1: ldxr w0, [x4] /* load old value (to be returned) */
- mvn w3, w0 /* complement source */
- and w3, w3, w1 /* calculate new value */
+ and w3, w0, w1 /* w3 = (*ptr & value) */
+ mvn w3, w3 /* x3 = ~(*ptr & value) */
stxr w2, w3, [x4] /* try to store */
cbnz w2, 1b /* succeed? no, try again */
dmb st
@@ -47,11 +50,15 @@
STRONG_ALIAS(__sync_fetch_and_nand_4,_atomic_nand_32)
STRONG_ALIAS(_atomic_nand_uint,_atomic_nand_32)
+
+/*
+ * { tmp = ~(*ptr & value); *ptr = tmp; return *ptr; } // nand
+ */
ENTRY_NP(_atomic_nand_32_nv)
mov x4, x0 /* need r0 for return value */
-1: ldxr w0, [x4] /* load old value */
- mvn w0, w0 /* complement source */
- and w0, w0, w1 /* calculate new value (return value) */
+1: ldxr w0, [x4] /* load old value (*ptr) */
+ and w0, w0, w1 /* x0 = (*ptr & value) */
+ mvn w0, w0 /* x0 = ~(*ptr & value), return value */
stxr w2, w0, [x4] /* try to store */
cbnz w2, 1b /* succeed? no, try again? */
dmb st
diff -r 3f0aaa4c4f8b -r 90d1a01d31fa common/lib/libc/arch/aarch64/atomic/atomic_nand_64.S
--- a/common/lib/libc/arch/aarch64/atomic/atomic_nand_64.S Tue Jul 06 04:11:31 2021 +0000
+++ b/common/lib/libc/arch/aarch64/atomic/atomic_nand_64.S Tue Jul 06 04:13:50 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: atomic_nand_64.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */
+/* $NetBSD: atomic_nand_64.S,v 1.1.28.1 2021/07/06 04:13:50 martin Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,11 +31,14 @@
#include "atomic_op_asm.h"
+/*
+ * { tmp = *ptr; *ptr = ~(tmp & value); return tmp; } // nand
+ */
ENTRY_NP(_atomic_nand_64)
mov x4, x0
-1: ldxr x0, [x4] /* load old value (to be returned) */
- mvn x2, x0 /* complement source */
- and x2, x2, x1 /* calculate new value */
+1: ldxr x0, [x4] /* load old value (*ptr) */
+ and x2, x0, x1 /* x2 = (*ptr & value) */
+ mvn x2, x2 /* x2 = ~(*ptr & value) */
stxr w3, x2, [x4] /* try to store */
cbnz w3, 1b /* succeed? no, try again */
dmb st
@@ -47,11 +50,15 @@
STRONG_ALIAS(__sync_fetch_and_nand_8,_atomic_nand_64)
STRONG_ALIAS(_atomic_nand_ulong,_atomic_nand_64)
+
+/*
+ * { tmp = ~(*ptr & value); *ptr = tmp; return *ptr; } // nand
+ */
ENTRY_NP(_atomic_nand_64_nv)
mov x4, x0 /* need r0 for return value */
-1: ldxr x0, [x4] /* load old value */
- mvn x0, x0 /* complement source */
- and x0, x0, x1 /* calculate new value (return value) */
+1: ldxr x0, [x4] /* load old value (*ptr) */
+ and x0, x0, x1 /* x0 = (*ptr & value) */
+ mvn x0, x0 /* x0 = ~(*ptr & value), return value */
stxr w3, x0, [x4] /* try to store */
cbnz w3, 1b /* succeed? no, try again? */
dmb st
diff -r 3f0aaa4c4f8b -r 90d1a01d31fa common/lib/libc/arch/aarch64/atomic/atomic_nand_8.S
--- a/common/lib/libc/arch/aarch64/atomic/atomic_nand_8.S Tue Jul 06 04:11:31 2021 +0000
+++ b/common/lib/libc/arch/aarch64/atomic/atomic_nand_8.S Tue Jul 06 04:13:50 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: atomic_nand_8.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */
+/* $NetBSD: atomic_nand_8.S,v 1.1.28.1 2021/07/06 04:13:50 martin Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,11 +31,14 @@
#include "atomic_op_asm.h"
+/*
+ * { tmp = *ptr; *ptr = ~(tmp & value); return tmp; } // nand
+ */
ENTRY_NP(_atomic_nand_8)
mov x4, x0
-1: ldxrb w0, [x4] /* load old value (to be returned) */
- mvn w3, w0 /* complement source */
- and w3, w3, w1 /* calculate new value */
+1: ldxrb w0, [x4] /* load old value (*ptr) */
+ and w3, w0, w1 /* w3 = (*ptr & value) */
+ mvn w3, w3 /* w3 = ~(*ptr & value) */
stxrb w2, w3, [x4] /* try to store */
cbnz w2, 1b /* succeed? no, try again */
dmb st
@@ -47,11 +50,14 @@
STRONG_ALIAS(__sync_fetch_and_nand_1,_atomic_nand_8)
STRONG_ALIAS(_atomic_nand_uchar,_atomic_nand_8)
+/*
+ * { tmp = ~(*ptr & value); *ptr = tmp; return *ptr; } // nand
+ */
ENTRY_NP(_atomic_nand_8_nv)
mov x4, x0 /* need r0 for return value */
-1: ldxrb w0, [x4] /* load old value */
- mvn w0, w0 /* complement source */
- and w0, w0, w1 /* calculate new value (return value) */
+1: ldxrb w0, [x4] /* load old value (*ptr) */
+ and w0, w0, w1 /* w0 = (*ptr & value) */
+ mvn w0, w0 /* w0 = ~(*ptr & value), return value */
stxrb w2, w0, [x4] /* try to store */
cbnz w2, 1b /* succeed? no, try again? */
dmb st
Home |
Main Index |
Thread Index |
Old Index