1*09ff5f3bSriastradh/* $NetBSD: atomic_or.S,v 1.12 2022/04/06 22:47:56 riastradh Exp $ */ 2935eacf3Sad 3935eacf3Sad/*- 4935eacf3Sad * Copyright (c) 2007 The NetBSD Foundation, Inc. 5935eacf3Sad * All rights reserved. 6935eacf3Sad * 7935eacf3Sad * This code is derived from software contributed to The NetBSD Foundation 8935eacf3Sad * by Jason R. Thorpe. 9935eacf3Sad * 10935eacf3Sad * Redistribution and use in source and binary forms, with or without 11935eacf3Sad * modification, are permitted provided that the following conditions 12935eacf3Sad * are met: 13935eacf3Sad * 1. Redistributions of source code must retain the above copyright 14935eacf3Sad * notice, this list of conditions and the following disclaimer. 15935eacf3Sad * 2. Redistributions in binary form must reproduce the above copyright 16935eacf3Sad * notice, this list of conditions and the following disclaimer in the 17935eacf3Sad * documentation and/or other materials provided with the distribution. 18935eacf3Sad * 19935eacf3Sad * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 20935eacf3Sad * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21935eacf3Sad * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22935eacf3Sad * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23935eacf3Sad * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24935eacf3Sad * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25935eacf3Sad * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26935eacf3Sad * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27935eacf3Sad * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28935eacf3Sad * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29935eacf3Sad * POSSIBILITY OF SUCH DAMAGE. 30935eacf3Sad */ 31935eacf3Sad 32935eacf3Sad#include "atomic_op_asm.h" 33935eacf3Sad 34935eacf3Sad .text 35935eacf3Sad 366740bb54SchsENTRY(_atomic_or_32) 3707a0a325Smatt movl 4(%sp), %a0 3807a0a325Smatt movl 8(%sp), %d0 3965726debSmatt orl %d0, (%a0) 40935eacf3Sad rts 4165726debSmattEND(_atomic_or_32) 42ce6031c2Smartin 43935eacf3SadATOMIC_OP_ALIAS(atomic_or_32,_atomic_or_32) 44935eacf3SadATOMIC_OP_ALIAS(atomic_or_uint,_atomic_or_32) 45935eacf3SadSTRONG_ALIAS(_atomic_or_uint,_atomic_or_32) 46935eacf3SadATOMIC_OP_ALIAS(atomic_or_ulong,_atomic_or_32) 47935eacf3SadSTRONG_ALIAS(_atomic_or_ulong,_atomic_or_32) 4829d1edb6SadATOMIC_OP_ALIAS(atomic_or_ptr,_atomic_or_32) 4929d1edb6SadSTRONG_ALIAS(_atomic_or_ptr,_atomic_or_32) 50935eacf3Sad 516740bb54SchsENTRY(_atomic_or_32_nv) 5207a0a325Smatt movl 4(%sp), %a0 5307a0a325Smatt1: movl (%a0), %d0 54935eacf3Sad movl %d0, %d1 5507a0a325Smatt orl 8(%sp), %d0 5665726debSmatt casl %d1, %d0, (%a0) 57935eacf3Sad bne 1b 58ce6031c2Smartin movl %d0, %a0 59935eacf3Sad rts 60ce6031c2SmartinEND(_atomic_or_32_nv) 61ce6031c2Smartin 62935eacf3SadATOMIC_OP_ALIAS(atomic_or_32_nv,_atomic_or_32_nv) 63935eacf3SadATOMIC_OP_ALIAS(atomic_or_uint_nv,_atomic_or_32_nv) 64935eacf3SadSTRONG_ALIAS(_atomic_or_uint_nv,_atomic_or_32_nv) 65935eacf3SadATOMIC_OP_ALIAS(atomic_or_ulong_nv,_atomic_or_32_nv) 66935eacf3SadSTRONG_ALIAS(_atomic_or_ulong_nv,_atomic_or_32_nv) 6729d1edb6SadATOMIC_OP_ALIAS(atomic_or_ptr_nv,_atomic_or_32_nv) 6829d1edb6SadSTRONG_ALIAS(_atomic_or_ptr_nv,_atomic_or_32_nv) 69b290679aSmartinCRT_ALIAS(__sync_or_and_fetch_4, _atomic_or_32_nv) 70ce6031c2Smartin 71ce6031c2Smartin 72ce6031c2SmartinENTRY(__sync_fetch_and_or_4) 73ce6031c2Smartin movl 4(%sp), %a0 74ce6031c2Smartin1: movl (%a0), %d0 75ce6031c2Smartin movl %d0, %d1 76ce6031c2Smartin orl 8(%sp), %d1 77ce6031c2Smartin casl %d0, %d1, (%a0) 78ce6031c2Smartin bne 1b 79ce6031c2Smartin movl %d0, %a0 80ce6031c2Smartin rts 81ce6031c2SmartinEND(__sync_fetch_and_or_4) 82ce6031c2Smartin 83ce6031c2Smartin 84ce6031c2SmartinENTRY(_atomic_or_16_nv) 85ce6031c2Smartin movl 4(%sp), %a0 86ce6031c2Smartin1: movw (%a0), %d0 87ce6031c2Smartin movw %d0, %d1 88ce6031c2Smartin orw 8(%sp), %d0 89ce6031c2Smartin casw %d1, %d0, (%a0) 90ce6031c2Smartin bne 1b 91ce6031c2Smartin rts 92ce6031c2SmartinEND(_atomic_or_16_nv) 93b290679aSmartinCRT_ALIAS(__sync_or_and_fetch_2, _atomic_or_16_nv) 94ce6031c2Smartin 95ce6031c2SmartinENTRY(__sync_fetch_and_or_2) 96ce6031c2Smartin movl 4(%sp), %a0 97ce6031c2Smartin1: movw (%a0), %d0 98ce6031c2Smartin movw %d0, %d1 99ce6031c2Smartin orw 8(%sp), %d1 100ce6031c2Smartin casw %d0, %d1, (%a0) 101ce6031c2Smartin bne 1b 102ce6031c2Smartin rts 103ce6031c2SmartinEND(__sync_fetch_and_or_2) 104ce6031c2Smartin 105ce6031c2Smartin 106ce6031c2SmartinENTRY(_atomic_or_8_nv) 107ce6031c2Smartin movl 4(%sp), %a0 108ce6031c2Smartin1: movb (%a0), %d0 109ce6031c2Smartin movb %d0, %d1 110ce6031c2Smartin orb 8(%sp), %d0 111ce6031c2Smartin casb %d1, %d0, (%a0) 112ce6031c2Smartin bne 1b 113ce6031c2Smartin rts 114ce6031c2SmartinEND(_atomic_or_8_nv) 115b290679aSmartinCRT_ALIAS(__sync_or_and_fetch_1, _atomic_or_8_nv) 116ce6031c2Smartin 117ce6031c2SmartinENTRY(__sync_fetch_and_or_1) 118ce6031c2Smartin movl 4(%sp), %a0 119ce6031c2Smartin1: movb (%a0), %d0 120ce6031c2Smartin movb %d0, %d1 121ce6031c2Smartin orb 8(%sp), %d1 122ce6031c2Smartin casb %d0, %d1, (%a0) 123ce6031c2Smartin bne 1b 124ce6031c2Smartin rts 125ce6031c2SmartinEND(__sync_fetch_and_or_1) 126504e8e68Sjoerg 127504e8e68SjoergCRT_ALIAS(__atomic_fetch_or_1,__sync_fetch_and_or_1) 128504e8e68SjoergCRT_ALIAS(__atomic_fetch_or_2,__sync_fetch_and_or_2) 129504e8e68SjoergCRT_ALIAS(__atomic_fetch_or_4,__sync_fetch_and_or_4) 130