1*b6cbf720SGianluca Guida/* $NetBSD: atomic_and.S,v 1.6 2008/05/25 15:56:12 chs Exp $ */ 2*b6cbf720SGianluca Guida 3*b6cbf720SGianluca Guida/*- 4*b6cbf720SGianluca Guida * Copyright (c) 2007 The NetBSD Foundation, Inc. 5*b6cbf720SGianluca Guida * All rights reserved. 6*b6cbf720SGianluca Guida * 7*b6cbf720SGianluca Guida * This code is derived from software contributed to The NetBSD Foundation 8*b6cbf720SGianluca Guida * by Jason R. Thorpe. 9*b6cbf720SGianluca Guida * 10*b6cbf720SGianluca Guida * Redistribution and use in source and binary forms, with or without 11*b6cbf720SGianluca Guida * modification, are permitted provided that the following conditions 12*b6cbf720SGianluca Guida * are met: 13*b6cbf720SGianluca Guida * 1. Redistributions of source code must retain the above copyright 14*b6cbf720SGianluca Guida * notice, this list of conditions and the following disclaimer. 15*b6cbf720SGianluca Guida * 2. Redistributions in binary form must reproduce the above copyright 16*b6cbf720SGianluca Guida * notice, this list of conditions and the following disclaimer in the 17*b6cbf720SGianluca Guida * documentation and/or other materials provided with the distribution. 18*b6cbf720SGianluca Guida * 19*b6cbf720SGianluca Guida * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 20*b6cbf720SGianluca Guida * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21*b6cbf720SGianluca Guida * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22*b6cbf720SGianluca Guida * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23*b6cbf720SGianluca Guida * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24*b6cbf720SGianluca Guida * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25*b6cbf720SGianluca Guida * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26*b6cbf720SGianluca Guida * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27*b6cbf720SGianluca Guida * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28*b6cbf720SGianluca Guida * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29*b6cbf720SGianluca Guida * POSSIBILITY OF SUCH DAMAGE. 30*b6cbf720SGianluca Guida */ 31*b6cbf720SGianluca Guida 32*b6cbf720SGianluca Guida#include "atomic_op_asm.h" 33*b6cbf720SGianluca Guida 34*b6cbf720SGianluca Guida .text 35*b6cbf720SGianluca Guida 36*b6cbf720SGianluca GuidaENTRY(_atomic_and_32) 37*b6cbf720SGianluca Guida ld [%o0], %o2 38*b6cbf720SGianluca Guida1: and %o1, %o2, %o3 39*b6cbf720SGianluca Guida cas [%o0], %o2, %o3 40*b6cbf720SGianluca Guida cmp %o2, %o3 41*b6cbf720SGianluca Guida bne,a,pn %icc, 1b 42*b6cbf720SGianluca Guida mov %o3, %o2 43*b6cbf720SGianluca Guida retl 44*b6cbf720SGianluca Guida and %o1, %o2, %o0 45*b6cbf720SGianluca GuidaATOMIC_OP_ALIAS(atomic_and_32,_atomic_and_32) 46*b6cbf720SGianluca GuidaATOMIC_OP_ALIAS(atomic_and_uint,_atomic_and_32) 47*b6cbf720SGianluca GuidaSTRONG_ALIAS(_atomic_and_uint,_atomic_and_32) 48*b6cbf720SGianluca Guida 49*b6cbf720SGianluca GuidaATOMIC_OP_ALIAS(atomic_and_32_nv,_atomic_and_32) 50*b6cbf720SGianluca GuidaSTRONG_ALIAS(_atomic_and_32_nv,_atomic_and_32) 51*b6cbf720SGianluca GuidaATOMIC_OP_ALIAS(atomic_and_uint_nv,_atomic_and_32) 52*b6cbf720SGianluca GuidaSTRONG_ALIAS(_atomic_and_uint_nv,_atomic_and_32) 53*b6cbf720SGianluca Guida 54*b6cbf720SGianluca GuidaENTRY(_atomic_and_64) 55*b6cbf720SGianluca Guida ldx [%o0], %o2 56*b6cbf720SGianluca Guida1: and %o1, %o2, %o3 57*b6cbf720SGianluca Guida casx [%o0], %o2, %o3 58*b6cbf720SGianluca Guida cmp %o2, %o3 59*b6cbf720SGianluca Guida bne,a,pn %xcc, 1b 60*b6cbf720SGianluca Guida mov %o3, %o2 61*b6cbf720SGianluca Guida retl 62*b6cbf720SGianluca Guida and %o1, %o2, %o0 63*b6cbf720SGianluca GuidaATOMIC_OP_ALIAS(atomic_and_64,_atomic_and_64) 64*b6cbf720SGianluca Guida 65*b6cbf720SGianluca GuidaATOMIC_OP_ALIAS(atomic_and_64_nv,_atomic_and_64) 66*b6cbf720SGianluca GuidaSTRONG_ALIAS(_atomic_and_64_nv,_atomic_and_64) 67*b6cbf720SGianluca Guida 68*b6cbf720SGianluca GuidaATOMIC_OP_ALIAS_SIZE(atomic_and_ulong,_atomic_and) 69*b6cbf720SGianluca GuidaSTRONG_ALIAS_SIZE(_atomic_and_ulong,_atomic_and) 70*b6cbf720SGianluca Guida 71*b6cbf720SGianluca GuidaATOMIC_OP_ALIAS_SIZE(atomic_and_ulong_nv,_atomic_and) 72*b6cbf720SGianluca GuidaSTRONG_ALIAS_SIZE(_atomic_and_ulong_nv,_atomic_and) 73