Add atomic_cas_foo_ni().

This commit is contained in:
ad 2008-02-10 13:40:31 +00:00
parent 372461e58e
commit 646fc3baa9
7 changed files with 96 additions and 20 deletions

View File

@ -1,7 +1,7 @@
/* $NetBSD: atomic_cas.S,v 1.2 2007/11/28 17:39:07 ad Exp $ */
/* $NetBSD: atomic_cas.S,v 1.3 2008/02/10 13:40:31 ad Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
* Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@ -50,10 +50,16 @@ LEAF_NOPROFILE(_atomic_cas_32, 3)
2: RET
3: br 1b
END(_atomic_cas_32)
ATOMIC_OP_ALIAS(atomic_cas_32,_atomic_cas_32)
ATOMIC_OP_ALIAS(atomic_cas_uint,_atomic_cas_32)
STRONG_ALIAS(_atomic_cas_uint,_atomic_cas_32)
ATOMIC_OP_ALIAS(atomic_cas_32_ni,_atomic_cas_32)
STRONG_ALIAS(_atomic_cas_32_ni,_atomic_cas_32)
ATOMIC_OP_ALIAS(atomic_cas_uint_ni,_atomic_cas_32)
STRONG_ALIAS(_atomic_cas_uint_ni,_atomic_cas_32)
LEAF_NOPROFILE(_atomic_cas_64, 3)
1: mov a2, t2
ldq_l v0, 0(a0)
@ -64,8 +70,16 @@ LEAF_NOPROFILE(_atomic_cas_64, 3)
2: RET
3: br 1b
END(_atomic_cas_64)
ATOMIC_OP_ALIAS(atomic_cas_64,_atomic_cas_64)
ATOMIC_OP_ALIAS(atomic_cas_ulong,_atomic_cas_64)
STRONG_ALIAS(_atomic_cas_ulong,_atomic_cas_64)
ATOMIC_OP_ALIAS(atomic_cas_ptr,_atomic_cas_64)
STRONG_ALIAS(_atomic_cas_ptr,_atomic_cas_64)
ATOMIC_OP_ALIAS(atomic_cas_64_ni,_atomic_cas_64)
STRONG_ALIAS(_atomic_cas_64_ni,_atomic_cas_64)
ATOMIC_OP_ALIAS(atomic_cas_ulong_ni,_atomic_cas_64)
STRONG_ALIAS(_atomic_cas_ulong_ni,_atomic_cas_64)
ATOMIC_OP_ALIAS(atomic_cas_ptr_ni,_atomic_cas_64)
STRONG_ALIAS(_atomic_cas_ptr_ni,_atomic_cas_64)

View File

@ -1,7 +1,7 @@
/* $NetBSD: atomic_cas.S,v 1.2 2007/11/29 17:09:32 ad Exp $ */
/* $NetBSD: atomic_cas.S,v 1.3 2008/02/10 13:40:31 ad Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
* Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@ -48,6 +48,7 @@ ENTRY_NOPROFILE(_atomic_cas_32)
/* %d0 now contains the old value */
movl %d0, %a0 /* pointers return also in %a0 */
rts
ATOMIC_OP_ALIAS(atomic_cas_32,_atomic_cas_32)
ATOMIC_OP_ALIAS(atomic_cas_uint,_atomic_cas_32)
STRONG_ALIAS(_atomic_cas_uint,_atomic_cas_32)
@ -55,3 +56,12 @@ ATOMIC_OP_ALIAS(atomic_cas_ulong,_atomic_cas_32)
STRONG_ALIAS(_atomic_cas_ulong,_atomic_cas_32)
ATOMIC_OP_ALIAS(atomic_cas_ptr,_atomic_cas_32)
STRONG_ALIAS(_atomic_cas_ptr,_atomic_cas_32)
ATOMIC_OP_ALIAS(atomic_cas_32_ni,_atomic_cas_32)
STRONG_ALIAS(_atomic_cas_32_ni,_atomic_cas_32)
ATOMIC_OP_ALIAS(atomic_cas_uint_ni,_atomic_cas_32)
STRONG_ALIAS(_atomic_cas_uint_ni,_atomic_cas_32)
ATOMIC_OP_ALIAS(atomic_cas_ulong_ni,_atomic_cas_32)
STRONG_ALIAS(_atomic_cas_ulong_ni,_atomic_cas_32)
ATOMIC_OP_ALIAS(atomic_cas_ptr_ni,_atomic_cas_32)
STRONG_ALIAS(_atomic_cas_ptr_ni,_atomic_cas_32)

View File

@ -1,7 +1,7 @@
/* $NetBSD: atomic_cas.S,v 1.2 2007/11/28 21:39:49 ad Exp $ */
/* $NetBSD: atomic_cas.S,v 1.3 2008/02/10 13:40:31 ad Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
* Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@ -48,6 +48,7 @@ ENTRY_NOPROFILE(_atomic_cas_32)
bne- 1b
2: mr r3,r10
blr
ATOMIC_OP_ALIAS(atomic_cas_32,_atomic_cas_32)
ATOMIC_OP_ALIAS(atomic_cas_uint,_atomic_cas_32)
STRONG_ALIAS(_atomic_cas_uint,_atomic_cas_32)
@ -57,3 +58,14 @@ STRONG_ALIAS(_atomic_cas_ulong,_atomic_cas_32)
ATOMIC_OP_ALIAS(atomic_cas_ptr,_atomic_cas_32)
STRONG_ALIAS(_atomic_cas_ptr,_atomic_cas_32)
#endif
ATOMIC_OP_ALIAS(atomic_cas_32_ni,_atomic_cas_32)
STRONG_ALIAS(_atomic_cas_32_ni,_atomic_cas_32)
ATOMIC_OP_ALIAS(atomic_cas_uint_ni,_atomic_cas_32)
STRONG_ALIAS(_atomic_cas_uint_ni,_atomic_cas_32)
#if !defined(_LP64)
ATOMIC_OP_ALIAS(atomic_cas_ulong_ni,_atomic_cas_32)
STRONG_ALIAS(_atomic_cas_ulong_ni,_atomic_cas_32)
ATOMIC_OP_ALIAS(atomic_cas_ptr_ni,_atomic_cas_32)
STRONG_ALIAS(_atomic_cas_ptr_ni,_atomic_cas_32)
#endif

View File

@ -1,7 +1,7 @@
/* $NetBSD: atomic_cas.S,v 1.2 2007/11/28 21:47:00 ad Exp $ */
/* $NetBSD: atomic_cas.S,v 1.3 2008/02/10 13:40:31 ad Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
* Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@ -50,8 +50,16 @@ ENTRY_NOPROFILE(_atomic_cas_64)
bne- 1b
2: mr r3,r10
blr
ATOMIC_OP_ALIAS(atomic_cas_64,_atomic_cas_64)
ATOMIC_OP_ALIAS(atomic_cas_ulong,_atomic_cas_64)
STRONG_ALIAS(_atomic_cas_ulong,_atomic_cas_64)
ATOMIC_OP_ALIAS(atomic_cas_ptr,_atomic_cas_64)
STRONG_ALIAS(_atomic_cas_ptr,_atomic_cas_64)
ATOMIC_OP_ALIAS(atomic_cas_64_ni,_atomic_cas_64)
STRONG_ALIAS(_atomic_cas_64_ni,_atomic_cas_64)
ATOMIC_OP_ALIAS(atomic_cas_ulong_ni,_atomic_cas_64)
STRONG_ALIAS(_atomic_cas_ulong_ni,_atomic_cas_64)
ATOMIC_OP_ALIAS(atomic_cas_ptr_ni,_atomic_cas_64)
STRONG_ALIAS(_atomic_cas_ptr_ni,_atomic_cas_64)

View File

@ -1,7 +1,7 @@
/* $NetBSD: atomic_cas.S,v 1.4 2007/12/08 22:53:33 ad Exp $ */
/* $NetBSD: atomic_cas.S,v 1.5 2008/02/10 13:40:31 ad Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
* Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@ -139,3 +139,12 @@ ATOMIC_OP_ALIAS(atomic_cas_ulong,_atomic_cas_32)
STRONG_ALIAS(_atomic_cas_ulong,_atomic_cas_32)
ATOMIC_OP_ALIAS(atomic_cas_ptr,_atomic_cas_32)
STRONG_ALIAS(_atomic_cas_ptr,_atomic_cas_32)
ATOMIC_OP_ALIAS(atomic_cas_32_ni,_atomic_cas_32)
STRONG_ALIAS(_atomic_cas_32_ni,_atomic_cas_32)
ATOMIC_OP_ALIAS(atomic_cas_uint_ni,_atomic_cas_32)
STRONG_ALIAS(_atomic_cas_uint_ni,_atomic_cas_32)
ATOMIC_OP_ALIAS(atomic_cas_ulong_ni,_atomic_cas_32)
STRONG_ALIAS(_atomic_cas_ulong_ni,_atomic_cas_32)
ATOMIC_OP_ALIAS(atomic_cas_ptr_ni,_atomic_cas_32)
STRONG_ALIAS(_atomic_cas_ptr_ni,_atomic_cas_32)

View File

@ -1,7 +1,7 @@
/* $NetBSD: atomic_cas.S,v 1.3 2007/12/22 23:19:40 mrg Exp $ */
/* $NetBSD: atomic_cas.S,v 1.4 2008/02/10 13:40:31 ad Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
* Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@ -44,17 +44,30 @@ ENTRY_NOPROFILE(_atomic_cas_32)
cas [%o0], %o1, %o2
retl
mov %o2, %o0
ATOMIC_OP_ALIAS(atomic_cas_32,_atomic_cas_32)
ATOMIC_OP_ALIAS(atomic_cas_uint,_atomic_cas_32)
STRONG_ALIAS(_atomic_cas_uint,_atomic_cas_32)
ATOMIC_OP_ALIAS(atomic_cas_32_ni,_atomic_cas_32)
STRONG_ALIAS(_atomic_cas_32_ni,_atomic_cas_32)
ATOMIC_OP_ALIAS(atomic_cas_uint_ni,_atomic_cas_32)
STRONG_ALIAS(_atomic_cas_uint_ni,_atomic_cas_32)
ENTRY_NOPROFILE(_atomic_cas_64)
casx [%o0], %o1, %o2
retl
mov %o2, %o0
ATOMIC_OP_ALIAS(atomic_cas_64,_atomic_cas_64)
ATOMIC_OP_ALIAS(atomic_cas_64,_atomic_cas_64)
ATOMIC_OP_ALIAS_SIZE(atomic_cas_ulong,_atomic_cas)
STRONG_ALIAS_SIZE(_atomic_cas_ulong,_atomic_cas)
ATOMIC_OP_ALIAS_SIZE(atomic_cas_ptr,_atomic_cas)
STRONG_ALIAS_SIZE(_atomic_cas_ptr,_atomic_cas)
ATOMIC_OP_ALIAS(atomic_cas_64_ni,_atomic_cas_64)
STRONG_ALIAS_SIZE(_atomic_cas_64_ni,_atomic_cas)
ATOMIC_OP_ALIAS_SIZE(atomic_cas_ulong_ni,_atomic_cas)
STRONG_ALIAS_SIZE(_atomic_cas_ulong_ni,_atomic_cas)
ATOMIC_OP_ALIAS_SIZE(atomic_cas_ptr_ni,_atomic_cas)
STRONG_ALIAS_SIZE(_atomic_cas_ptr_ni,_atomic_cas)

View File

@ -1,4 +1,4 @@
/* $NetBSD: atomic_init_testset.c,v 1.1 2008/02/09 13:30:54 ad Exp $ */
/* $NetBSD: atomic_init_testset.c,v 1.2 2008/02/10 13:40:31 ad Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: atomic_init_testset.c,v 1.1 2008/02/09 13:30:54 ad Exp $");
__RCSID("$NetBSD: atomic_init_testset.c,v 1.2 2008/02/10 13:40:31 ad Exp $");
#include "atomic_op_namespace.h"
@ -62,7 +62,7 @@ __RCSID("$NetBSD: atomic_init_testset.c,v 1.1 2008/02/09 13:30:54 ad Exp $");
static __cpu_simple_lock_t atomic_locks[128] = { I128 };
static uint32_t (*_atomic_cas_fn)(volatile uint32_t *, uint32_t, uint32_t);
void _libc_atomic_init(void) __attribute__ ((visibility("hidden")));
void __libc_atomic_init(void) __attribute__ ((visibility("hidden")));
RAS_DECL(_atomic_cas);
@ -107,7 +107,7 @@ _atomic_cas_32(volatile uint32_t *ptr, uint32_t old, uint32_t new)
}
void
_libc_atomic_init(void)
__libc_atomic_init(void)
{
int ncpu, mib[2];
size_t len;
@ -129,13 +129,23 @@ _libc_atomic_init(void)
}
#undef atomic_cas_32
atomic_op_alias(atomic_cas_32,_atomic_cas_32)
#undef atomic_cas_uint
#undef atomic_cas_ulong
#undef atomic_cas_ptr
atomic_op_alias(atomic_cas_32,_atomic_cas_32)
atomic_op_alias(atomic_cas_uint,_atomic_cas_32)
__strong_alias(_atomic_cas_uint,_atomic_cas_32)
#undef atomic_cas_ulong
atomic_op_alias(atomic_cas_ulong,_atomic_cas_32)
__strong_alias(_atomic_cas_ulong,_atomic_cas_32)
#undef atomic_cas_ptr
atomic_op_alias(atomic_cas_ptr,_atomic_cas_32)
__strong_alias(_atomic_cas_ptr,_atomic_cas_32)
atomic_op_alias(atomic_cas_32_ni,_atomic_cas_32)
__strong_alias(_atomic_cas_32_ni,_atomic_cas_32)
atomic_op_alias(atomic_cas_uint_ni,_atomic_cas_32)
__strong_alias(_atomic_cas_uint_ni,_atomic_cas_32)
atomic_op_alias(atomic_cas_ulong_ni,_atomic_cas_32)
__strong_alias(_atomic_cas_ulong_ni,_atomic_cas_32)
atomic_op_alias(atomic_cas_ptr_ni,_atomic_cas_32)
__strong_alias(_atomic_cas_ptr_ni,_atomic_cas_32)