Memory barrier in respect of the CAS isn't necessary.
This commit is contained in:
parent
efe797dc32
commit
13c86772e9
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: atomic_add_32_cas.c,v 1.2 2007/11/28 16:54:58 ad Exp $ */
|
/* $NetBSD: atomic_add_32_cas.c,v 1.3 2007/11/28 16:59:09 ad Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||||
|
@ -39,7 +39,6 @@
|
||||||
#include "atomic_op_namespace.h"
|
#include "atomic_op_namespace.h"
|
||||||
|
|
||||||
#include <sys/atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include "atomic_op_cas_impl.h"
|
|
||||||
|
|
||||||
void
|
void
|
||||||
atomic_add_32(volatile uint32_t *addr, int32_t val)
|
atomic_add_32(volatile uint32_t *addr, int32_t val)
|
||||||
|
@ -47,9 +46,7 @@ atomic_add_32(volatile uint32_t *addr, int32_t val)
|
||||||
uint32_t old, new;
|
uint32_t old, new;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
OP_READ_BARRIER;
|
|
||||||
old = *addr;
|
old = *addr;
|
||||||
|
|
||||||
new = old + val;
|
new = old + val;
|
||||||
} while (atomic_cas_32(addr, old, new) != old);
|
} while (atomic_cas_32(addr, old, new) != old);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: atomic_add_32_nv_cas.c,v 1.2 2007/11/28 16:54:58 ad Exp $ */
|
/* $NetBSD: atomic_add_32_nv_cas.c,v 1.3 2007/11/28 16:59:09 ad Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||||
|
@ -39,7 +39,6 @@
|
||||||
#include "atomic_op_namespace.h"
|
#include "atomic_op_namespace.h"
|
||||||
|
|
||||||
#include <sys/atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include "atomic_op_cas_impl.h"
|
|
||||||
|
|
||||||
uint32_t
|
uint32_t
|
||||||
atomic_add_32_nv(volatile uint32_t *addr, int32_t val)
|
atomic_add_32_nv(volatile uint32_t *addr, int32_t val)
|
||||||
|
@ -47,9 +46,7 @@ atomic_add_32_nv(volatile uint32_t *addr, int32_t val)
|
||||||
uint32_t old, new;
|
uint32_t old, new;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
OP_READ_BARRIER;
|
|
||||||
old = *addr;
|
old = *addr;
|
||||||
|
|
||||||
new = old + val;
|
new = old + val;
|
||||||
} while (atomic_cas_32(addr, old, new) != old);
|
} while (atomic_cas_32(addr, old, new) != old);
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: atomic_add_64_cas.c,v 1.2 2007/11/28 16:54:59 ad Exp $ */
|
/* $NetBSD: atomic_add_64_cas.c,v 1.3 2007/11/28 16:59:09 ad Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||||
|
@ -39,7 +39,6 @@
|
||||||
#include "atomic_op_namespace.h"
|
#include "atomic_op_namespace.h"
|
||||||
|
|
||||||
#include <sys/atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include "atomic_op_cas_impl.h"
|
|
||||||
|
|
||||||
void
|
void
|
||||||
atomic_add_64(volatile uint64_t *addr, int64_t val)
|
atomic_add_64(volatile uint64_t *addr, int64_t val)
|
||||||
|
@ -47,9 +46,7 @@ atomic_add_64(volatile uint64_t *addr, int64_t val)
|
||||||
uint64_t old, new;
|
uint64_t old, new;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
OP_READ_BARRIER;
|
|
||||||
old = *addr;
|
old = *addr;
|
||||||
|
|
||||||
new = old + val;
|
new = old + val;
|
||||||
} while (atomic_cas_64(addr, old, new) != old);
|
} while (atomic_cas_64(addr, old, new) != old);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: atomic_add_64_nv_cas.c,v 1.2 2007/11/28 16:54:59 ad Exp $ */
|
/* $NetBSD: atomic_add_64_nv_cas.c,v 1.3 2007/11/28 16:59:09 ad Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||||
|
@ -39,7 +39,6 @@
|
||||||
#include "atomic_op_namespace.h"
|
#include "atomic_op_namespace.h"
|
||||||
|
|
||||||
#include <sys/atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include "atomic_op_cas_impl.h"
|
|
||||||
|
|
||||||
uint64_t
|
uint64_t
|
||||||
atomic_add_64_nv(volatile uint64_t *addr, int64_t val)
|
atomic_add_64_nv(volatile uint64_t *addr, int64_t val)
|
||||||
|
@ -47,9 +46,7 @@ atomic_add_64_nv(volatile uint64_t *addr, int64_t val)
|
||||||
uint64_t old, new;
|
uint64_t old, new;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
OP_READ_BARRIER;
|
|
||||||
old = *addr;
|
old = *addr;
|
||||||
|
|
||||||
new = old + val;
|
new = old + val;
|
||||||
} while (atomic_cas_64(addr, old, new) != old);
|
} while (atomic_cas_64(addr, old, new) != old);
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: atomic_and_32_cas.c,v 1.2 2007/11/28 16:55:00 ad Exp $ */
|
/* $NetBSD: atomic_and_32_cas.c,v 1.3 2007/11/28 16:59:09 ad Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||||
|
@ -39,7 +39,6 @@
|
||||||
#include "atomic_op_namespace.h"
|
#include "atomic_op_namespace.h"
|
||||||
|
|
||||||
#include <sys/atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include "atomic_op_cas_impl.h"
|
|
||||||
|
|
||||||
void
|
void
|
||||||
atomic_and_32(volatile uint32_t *addr, uint32_t val)
|
atomic_and_32(volatile uint32_t *addr, uint32_t val)
|
||||||
|
@ -47,9 +46,7 @@ atomic_and_32(volatile uint32_t *addr, uint32_t val)
|
||||||
uint32_t old, new;
|
uint32_t old, new;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
OP_READ_BARRIER;
|
|
||||||
old = *addr;
|
old = *addr;
|
||||||
|
|
||||||
new = old & val;
|
new = old & val;
|
||||||
} while (atomic_cas_32(addr, old, new) != old);
|
} while (atomic_cas_32(addr, old, new) != old);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: atomic_and_32_nv_cas.c,v 1.2 2007/11/28 16:55:00 ad Exp $ */
|
/* $NetBSD: atomic_and_32_nv_cas.c,v 1.3 2007/11/28 16:59:09 ad Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||||
|
@ -39,7 +39,6 @@
|
||||||
#include "atomic_op_namespace.h"
|
#include "atomic_op_namespace.h"
|
||||||
|
|
||||||
#include <sys/atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include "atomic_op_cas_impl.h"
|
|
||||||
|
|
||||||
uint32_t
|
uint32_t
|
||||||
atomic_and_32_nv(volatile uint32_t *addr, uint32_t val)
|
atomic_and_32_nv(volatile uint32_t *addr, uint32_t val)
|
||||||
|
@ -47,9 +46,7 @@ atomic_and_32_nv(volatile uint32_t *addr, uint32_t val)
|
||||||
uint32_t old, new;
|
uint32_t old, new;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
OP_READ_BARRIER;
|
|
||||||
old = *addr;
|
old = *addr;
|
||||||
|
|
||||||
new = old & val;
|
new = old & val;
|
||||||
} while (atomic_cas_32(addr, old, new) != old);
|
} while (atomic_cas_32(addr, old, new) != old);
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: atomic_and_64_cas.c,v 1.2 2007/11/28 16:55:01 ad Exp $ */
|
/* $NetBSD: atomic_and_64_cas.c,v 1.3 2007/11/28 16:59:10 ad Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||||
|
@ -39,7 +39,6 @@
|
||||||
#include "atomic_op_namespace.h"
|
#include "atomic_op_namespace.h"
|
||||||
|
|
||||||
#include <sys/atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include "atomic_op_cas_impl.h"
|
|
||||||
|
|
||||||
void
|
void
|
||||||
atomic_and_64(volatile uint64_t *addr, uint64_t val)
|
atomic_and_64(volatile uint64_t *addr, uint64_t val)
|
||||||
|
@ -47,9 +46,7 @@ atomic_and_64(volatile uint64_t *addr, uint64_t val)
|
||||||
uint64_t old, new;
|
uint64_t old, new;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
OP_READ_BARRIER;
|
|
||||||
old = *addr;
|
old = *addr;
|
||||||
|
|
||||||
new = old & val;
|
new = old & val;
|
||||||
} while (atomic_cas_64(addr, old, new) != old);
|
} while (atomic_cas_64(addr, old, new) != old);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: atomic_and_64_nv_cas.c,v 1.2 2007/11/28 16:55:01 ad Exp $ */
|
/* $NetBSD: atomic_and_64_nv_cas.c,v 1.3 2007/11/28 16:59:10 ad Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||||
|
@ -39,7 +39,6 @@
|
||||||
#include "atomic_op_namespace.h"
|
#include "atomic_op_namespace.h"
|
||||||
|
|
||||||
#include <sys/atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include "atomic_op_cas_impl.h"
|
|
||||||
|
|
||||||
uint64_t
|
uint64_t
|
||||||
atomic_and_64_nv(volatile uint64_t *addr, uint64_t val)
|
atomic_and_64_nv(volatile uint64_t *addr, uint64_t val)
|
||||||
|
@ -47,9 +46,7 @@ atomic_and_64_nv(volatile uint64_t *addr, uint64_t val)
|
||||||
uint64_t old, new;
|
uint64_t old, new;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
OP_READ_BARRIER;
|
|
||||||
old = *addr;
|
old = *addr;
|
||||||
|
|
||||||
new = old & val;
|
new = old & val;
|
||||||
} while (atomic_cas_64(addr, old, new) != old);
|
} while (atomic_cas_64(addr, old, new) != old);
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: atomic_or_32_cas.c,v 1.2 2007/11/28 16:55:08 ad Exp $ */
|
/* $NetBSD: atomic_or_32_cas.c,v 1.3 2007/11/28 16:59:10 ad Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||||
|
@ -39,7 +39,6 @@
|
||||||
#include "atomic_op_namespace.h"
|
#include "atomic_op_namespace.h"
|
||||||
|
|
||||||
#include <sys/atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include "atomic_op_cas_impl.h"
|
|
||||||
|
|
||||||
void
|
void
|
||||||
atomic_or_32(volatile uint32_t *addr, uint32_t val)
|
atomic_or_32(volatile uint32_t *addr, uint32_t val)
|
||||||
|
@ -47,9 +46,7 @@ atomic_or_32(volatile uint32_t *addr, uint32_t val)
|
||||||
uint32_t old, new;
|
uint32_t old, new;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
OP_READ_BARRIER;
|
|
||||||
old = *addr;
|
old = *addr;
|
||||||
|
|
||||||
new = old | val;
|
new = old | val;
|
||||||
} while (atomic_cas_32(addr, old, new) != old);
|
} while (atomic_cas_32(addr, old, new) != old);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: atomic_or_32_nv_cas.c,v 1.2 2007/11/28 16:55:09 ad Exp $ */
|
/* $NetBSD: atomic_or_32_nv_cas.c,v 1.3 2007/11/28 16:59:10 ad Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||||
|
@ -39,7 +39,6 @@
|
||||||
#include "atomic_op_namespace.h"
|
#include "atomic_op_namespace.h"
|
||||||
|
|
||||||
#include <sys/atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include "atomic_op_cas_impl.h"
|
|
||||||
|
|
||||||
uint32_t
|
uint32_t
|
||||||
atomic_or_32_nv(volatile uint32_t *addr, uint32_t val)
|
atomic_or_32_nv(volatile uint32_t *addr, uint32_t val)
|
||||||
|
@ -47,9 +46,7 @@ atomic_or_32_nv(volatile uint32_t *addr, uint32_t val)
|
||||||
uint32_t old, new;
|
uint32_t old, new;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
OP_READ_BARRIER;
|
|
||||||
old = *addr;
|
old = *addr;
|
||||||
|
|
||||||
new = old | val;
|
new = old | val;
|
||||||
} while (atomic_cas_32(addr, old, new) != old);
|
} while (atomic_cas_32(addr, old, new) != old);
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: atomic_or_64_cas.c,v 1.2 2007/11/28 16:55:09 ad Exp $ */
|
/* $NetBSD: atomic_or_64_cas.c,v 1.3 2007/11/28 16:59:10 ad Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||||
|
@ -39,7 +39,6 @@
|
||||||
#include "atomic_op_namespace.h"
|
#include "atomic_op_namespace.h"
|
||||||
|
|
||||||
#include <sys/atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include "atomic_op_cas_impl.h"
|
|
||||||
|
|
||||||
void
|
void
|
||||||
atomic_or_64(volatile uint64_t *addr, uint64_t val)
|
atomic_or_64(volatile uint64_t *addr, uint64_t val)
|
||||||
|
@ -47,9 +46,7 @@ atomic_or_64(volatile uint64_t *addr, uint64_t val)
|
||||||
uint64_t old, new;
|
uint64_t old, new;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
OP_READ_BARRIER;
|
|
||||||
old = *addr;
|
old = *addr;
|
||||||
|
|
||||||
new = old | val;
|
new = old | val;
|
||||||
} while (atomic_cas_64(addr, old, new) != old);
|
} while (atomic_cas_64(addr, old, new) != old);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: atomic_or_64_nv_cas.c,v 1.2 2007/11/28 16:55:10 ad Exp $ */
|
/* $NetBSD: atomic_or_64_nv_cas.c,v 1.3 2007/11/28 16:59:11 ad Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||||
|
@ -39,7 +39,6 @@
|
||||||
#include "atomic_op_namespace.h"
|
#include "atomic_op_namespace.h"
|
||||||
|
|
||||||
#include <sys/atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include "atomic_op_cas_impl.h"
|
|
||||||
|
|
||||||
uint64_t
|
uint64_t
|
||||||
atomic_or_64_nv(volatile uint64_t *addr, uint64_t val)
|
atomic_or_64_nv(volatile uint64_t *addr, uint64_t val)
|
||||||
|
@ -47,9 +46,7 @@ atomic_or_64_nv(volatile uint64_t *addr, uint64_t val)
|
||||||
uint64_t old, new;
|
uint64_t old, new;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
OP_READ_BARRIER;
|
|
||||||
old = *addr;
|
old = *addr;
|
||||||
|
|
||||||
new = old | val;
|
new = old | val;
|
||||||
} while (atomic_cas_64(addr, old, new) != old);
|
} while (atomic_cas_64(addr, old, new) != old);
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: atomic_swap_32_cas.c,v 1.2 2007/11/28 16:55:11 ad Exp $ */
|
/* $NetBSD: atomic_swap_32_cas.c,v 1.3 2007/11/28 16:59:11 ad Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||||
|
@ -39,7 +39,6 @@
|
||||||
#include "atomic_op_namespace.h"
|
#include "atomic_op_namespace.h"
|
||||||
|
|
||||||
#include <sys/atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include "atomic_op_cas_impl.h"
|
|
||||||
|
|
||||||
uint32_t
|
uint32_t
|
||||||
atomic_swap_32(volatile uint32_t *addr, uint32_t new)
|
atomic_swap_32(volatile uint32_t *addr, uint32_t new)
|
||||||
|
@ -47,7 +46,6 @@ atomic_swap_32(volatile uint32_t *addr, uint32_t new)
|
||||||
uint32_t old;
|
uint32_t old;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
OP_READ_BARRIER;
|
|
||||||
old = *addr;
|
old = *addr;
|
||||||
} while (atomic_cas_32(addr, old, new) != old);
|
} while (atomic_cas_32(addr, old, new) != old);
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: atomic_swap_64_cas.c,v 1.2 2007/11/28 16:55:11 ad Exp $ */
|
/* $NetBSD: atomic_swap_64_cas.c,v 1.3 2007/11/28 16:59:11 ad Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||||
|
@ -39,7 +39,6 @@
|
||||||
#include "atomic_op_namespace.h"
|
#include "atomic_op_namespace.h"
|
||||||
|
|
||||||
#include <sys/atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include "atomic_op_cas_impl.h"
|
|
||||||
|
|
||||||
uint64_t
|
uint64_t
|
||||||
atomic_swap_64(volatile uint64_t *addr, uint64_t new)
|
atomic_swap_64(volatile uint64_t *addr, uint64_t new)
|
||||||
|
@ -47,7 +46,6 @@ atomic_swap_64(volatile uint64_t *addr, uint64_t new)
|
||||||
uint64_t old;
|
uint64_t old;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
OP_READ_BARRIER;
|
|
||||||
old = *addr;
|
old = *addr;
|
||||||
} while (atomic_cas_64(addr, old, new) != old);
|
} while (atomic_cas_64(addr, old, new) != old);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue