From 0c99b2643bef934cadd7188fae54e97f60396aeb Mon Sep 17 00:00:00 2001 From: martin Date: Wed, 29 Jan 2014 13:06:36 +0000 Subject: [PATCH] Provide _atomic_cas_{16,8}_up --- .../lib/libc/arch/sparc/atomic/Makefile.inc | 5 ++-- .../libc/arch/sparc/atomic/atomic_cas_up.S | 26 ++++++++++++++++++- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/common/lib/libc/arch/sparc/atomic/Makefile.inc b/common/lib/libc/arch/sparc/atomic/Makefile.inc index 345cf8bf3da2..83334d6540b0 100644 --- a/common/lib/libc/arch/sparc/atomic/Makefile.inc +++ b/common/lib/libc/arch/sparc/atomic/Makefile.inc @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.15 2012/11/28 21:39:59 martin Exp $ +# $NetBSD: Makefile.inc,v 1.16 2014/01/29 13:06:36 martin Exp $ .include @@ -29,7 +29,8 @@ SRCS+= atomic_cas.S . endif . if (${LIB} == "c" || ${LIB} == "pthread") -CPPFLAGS+= -D__HAVE_ASM_ATOMIC_CAS_UP +CPPFLAGS+= -D__HAVE_ASM_ATOMIC_CAS_UP -D__HAVE_ASM_ATOMIC_CAS_16_UP \ + -D__HAVE_ASM_ATOMIC_CAS_8_UP SRCS+= atomic_init_testset.c atomic_cas_up.S . endif diff --git a/common/lib/libc/arch/sparc/atomic/atomic_cas_up.S b/common/lib/libc/arch/sparc/atomic/atomic_cas_up.S index cb61e4bf253e..828876e2d6d5 100644 --- a/common/lib/libc/arch/sparc/atomic/atomic_cas_up.S +++ b/common/lib/libc/arch/sparc/atomic/atomic_cas_up.S @@ -1,4 +1,4 @@ -/* $NetBSD: atomic_cas_up.S,v 1.1 2012/11/28 21:39:59 martin Exp $ */ +/* $NetBSD: atomic_cas_up.S,v 1.2 2014/01/29 13:06:36 martin Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -43,3 +43,27 @@ RAS_END_ASM_HIDDEN(_atomic_cas) retl mov %o3, %o0 ! return old value +ENTRY(_atomic_cas_16_up) + .hidden _C_LABEL(_atomic_cas_16_up) +RAS_START_ASM_HIDDEN(_atomic_cas_16) + lduh [%o0], %o3 ! get old value + cmp %o1, %o3 ! old == new? + beq,a 1f ! yes, do the store + sth %o2, [%o0] ! (in the delay slot) +RAS_END_ASM_HIDDEN(_atomic_cas_16) +1: + retl + mov %o3, %o0 ! return old value + +ENTRY(_atomic_cas_8_up) + .hidden _C_LABEL(_atomic_cas_8_up) +RAS_START_ASM_HIDDEN(_atomic_cas_8) + ldub [%o0], %o3 ! get old value + cmp %o1, %o3 ! old == new? + beq,a 1f ! yes, do the store + stb %o2, [%o0] ! (in the delay slot) +RAS_END_ASM_HIDDEN(_atomic_cas_8) +1: + retl + mov %o3, %o0 ! return old value +