1*2d9adf0dSmatt/* $NetBSD: atomic_nand_64.S,v 1.2 2015/03/27 06:42:37 matt Exp $ */ 26cf6fe02Smatt/*- 36cf6fe02Smatt * Copyright (c) 2014 The NetBSD Foundation, Inc. 46cf6fe02Smatt * All rights reserved. 56cf6fe02Smatt * 66cf6fe02Smatt * This code is derived from software contributed to The NetBSD Foundation 76cf6fe02Smatt * by Matt Thomas <matt@3am-software.com> 86cf6fe02Smatt * 96cf6fe02Smatt * Redistribution and use in source and binary forms, with or without 106cf6fe02Smatt * modification, are permitted provided that the following conditions 116cf6fe02Smatt * are met: 126cf6fe02Smatt * 1. Redistributions of source code must retain the above copyright 136cf6fe02Smatt * notice, this list of conditions and the following disclaimer. 146cf6fe02Smatt * 2. Redistributions in binary form must reproduce the above copyright 156cf6fe02Smatt * notice, this list of conditions and the following disclaimer in the 166cf6fe02Smatt * documentation and/or other materials provided with the distribution. 176cf6fe02Smatt * 186cf6fe02Smatt * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 196cf6fe02Smatt * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 206cf6fe02Smatt * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 216cf6fe02Smatt * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 226cf6fe02Smatt * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 236cf6fe02Smatt * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 246cf6fe02Smatt * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 256cf6fe02Smatt * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 266cf6fe02Smatt * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 276cf6fe02Smatt * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 286cf6fe02Smatt * POSSIBILITY OF SUCH DAMAGE. 296cf6fe02Smatt */ 306cf6fe02Smatt 316cf6fe02Smatt#include "atomic_op_asm.h" 326cf6fe02Smatt 336cf6fe02SmattENTRY_NP(_atomic_nand_64) 34*2d9adf0dSmatt mv t0, a0 35*2d9adf0dSmatt1: lr.d a0, 0(t0) 36*2d9adf0dSmatt not t2, a0 37*2d9adf0dSmatt and t2, t2, a1 38*2d9adf0dSmatt sc.d t1, t2, 0(t0) 39*2d9adf0dSmatt bnez t1, 1b 406cf6fe02Smatt ret 416cf6fe02SmattEND(_atomic_nand_64) 426cf6fe02Smatt 436cf6fe02SmattATOMIC_OP_ALIAS(atomic_nand_64,_atomic_nand_64) 446cf6fe02SmattATOMIC_OP_ALIAS(atomic_nand_ulong,_atomic_nand_64) 456cf6fe02SmattSTRONG_ALIAS(_atomic_nand_ulong,_atomic_nand_64) 466cf6fe02SmattCRT_ALIAS(__sync_fetch_and_nand_8,_atomic_nand_64) 476cf6fe02SmattCRT_ALIAS(__atomic_fetch_nand_8,_atomic_nand_64) 486cf6fe02Smatt 496cf6fe02SmattENTRY_NP(_atomic_nand_64_nv) 50*2d9adf0dSmatt mv t0, a0 51*2d9adf0dSmatt1: lr.d a0, 0(t0) 52*2d9adf0dSmatt not a0, a0 53*2d9adf0dSmatt and a0, a0, a1 54*2d9adf0dSmatt sc.d t1, a0, 0(t0) 55*2d9adf0dSmatt bnez t1, 1b 566cf6fe02Smatt ret 576cf6fe02SmattEND(_atomic_nand_64_nv) 586cf6fe02Smatt 596cf6fe02SmattATOMIC_OP_ALIAS(atomic_nand_64_nv,_atomic_nand_64_nv) 606cf6fe02SmattATOMIC_OP_ALIAS(atomic_nand_ulong_nv,_atomic_nand_64_nv) 616cf6fe02SmattSTRONG_ALIAS(_atomic_nand_ulong_nv,_atomic_nand_64_nv) 626cf6fe02SmattCRT_ALIAS(__sync_nand_and_fetch_8,_atomic_nand_64_nv) 636cf6fe02SmattCRT_ALIAS(__atomic_nand_fetch_8,_atomic_nand_64_nv) 64