1*09ff5f3bSriastradh/* $NetBSD: atomic_and.S,v 1.5 2022/04/06 22:47:55 riastradh Exp $ */ 2fb900ec9Sad 3fb900ec9Sad/*- 4fb900ec9Sad * Copyright (c) 2007 The NetBSD Foundation, Inc. 5fb900ec9Sad * All rights reserved. 6fb900ec9Sad * 7fb900ec9Sad * This code is derived from software contributed to The NetBSD Foundation 8fb900ec9Sad * by Jason R. Thorpe. 9fb900ec9Sad * 10fb900ec9Sad * Redistribution and use in source and binary forms, with or without 11fb900ec9Sad * modification, are permitted provided that the following conditions 12fb900ec9Sad * are met: 13fb900ec9Sad * 1. Redistributions of source code must retain the above copyright 14fb900ec9Sad * notice, this list of conditions and the following disclaimer. 15fb900ec9Sad * 2. Redistributions in binary form must reproduce the above copyright 16fb900ec9Sad * notice, this list of conditions and the following disclaimer in the 17fb900ec9Sad * documentation and/or other materials provided with the distribution. 18fb900ec9Sad * 19fb900ec9Sad * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 20fb900ec9Sad * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21fb900ec9Sad * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22fb900ec9Sad * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23fb900ec9Sad * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24fb900ec9Sad * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25fb900ec9Sad * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26fb900ec9Sad * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27fb900ec9Sad * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28fb900ec9Sad * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29fb900ec9Sad * POSSIBILITY OF SUCH DAMAGE. 30fb900ec9Sad */ 31fb900ec9Sad 32fb900ec9Sad#include "atomic_op_asm.h" 33fb900ec9Sad 34fb900ec9Sad .text 35fb900ec9Sad 366740bb54SchsLEAF(_atomic_and_32, 2) 37fb900ec9Sad1: ldl_l t1, 0(a0) 38fb900ec9Sad and t1, a1, t2 39fb900ec9Sad stl_c t2, 0(a0) 40fb900ec9Sad beq t2, 2f 41fb900ec9Sad RET 42fb900ec9Sad2: br 1b 43fb900ec9Sad END(_atomic_and_32) 44fb900ec9SadATOMIC_OP_ALIAS(atomic_and_32,_atomic_and_32) 45fb900ec9SadATOMIC_OP_ALIAS(atomic_and_uint,_atomic_and_32) 46fb900ec9SadSTRONG_ALIAS(_atomic_and_uint,_atomic_and_32) 47fb900ec9Sad 486740bb54SchsLEAF(_atomic_and_32_nv, 2) 49fb900ec9Sad1: ldl_l t1, 0(a0) 50fb900ec9Sad and t1, a1, t2 51fb900ec9Sad mov t2, v0 52fb900ec9Sad stl_c t2, 0(a0) 53fb900ec9Sad beq t2, 2f 54fb900ec9Sad RET 55fb900ec9Sad2: br 1b 56fb900ec9Sad END(_atomic_and_32_nv) 57fb900ec9SadATOMIC_OP_ALIAS(atomic_and_32_nv,_atomic_and_32_nv) 58fb900ec9SadATOMIC_OP_ALIAS(atomic_and_uint_nv,_atomic_and_32_nv) 59fb900ec9SadSTRONG_ALIAS(_atomic_and_uint_nv,_atomic_and_32_nv) 60fb900ec9Sad 616740bb54SchsLEAF(_atomic_and_64, 2) 62fb900ec9Sad1: ldq_l t1, 0(a0) 63fb900ec9Sad and t1, a1, t2 64fb900ec9Sad stq_c t2, 0(a0) 65fb900ec9Sad beq t2, 2f 66fb900ec9Sad RET 67fb900ec9Sad2: br 1b 68fb900ec9Sad END(_atomic_and_64) 69fb900ec9SadATOMIC_OP_ALIAS(atomic_and_64,_atomic_and_64) 70fb900ec9SadATOMIC_OP_ALIAS(atomic_and_ulong,_atomic_and_64) 71fb900ec9SadSTRONG_ALIAS(_atomic_and_ulong,_atomic_and_64) 72fb900ec9Sad 736740bb54SchsLEAF(_atomic_and_64_nv, 2) 74fb900ec9Sad1: ldq_l t1, 0(a0) 75fb900ec9Sad and t1, a1, t2 76fb900ec9Sad mov t2, v0 77fb900ec9Sad stq_c t2, 0(a0) 78fb900ec9Sad beq t2, 2f 79fb900ec9Sad RET 80fb900ec9Sad2: br 1b 81fb900ec9Sad END(_atomic_and_64_nv) 82fb900ec9SadATOMIC_OP_ALIAS(atomic_and_64_nv,_atomic_and_64_nv) 83fb900ec9SadATOMIC_OP_ALIAS(atomic_and_ulong_nv,_atomic_and_64_nv) 84fb900ec9SadSTRONG_ALIAS(_atomic_and_ulong_nv,_atomic_and_64_nv) 85