michael@0: // -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: // michael@0: // This Source Code Form is subject to the terms of the Mozilla Public michael@0: // License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: // file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: .text michael@0: michael@0: // PRInt32 _PR_ia64_AtomicIncrement(PRInt32 *val) michael@0: // michael@0: // Atomically increment the integer pointed to by 'val' and return michael@0: // the result of the increment. michael@0: // michael@0: .align 16 michael@0: .global _PR_ia64_AtomicIncrement# michael@0: .proc _PR_ia64_AtomicIncrement# michael@0: _PR_ia64_AtomicIncrement: michael@0: fetchadd4.acq r8 = [r32], 1 ;; michael@0: adds r8 = 1, r8 michael@0: br.ret.sptk.many b0 michael@0: .endp _PR_ia64_AtomicIncrement# michael@0: michael@0: // PRInt32 _PR_ia64_AtomicDecrement(PRInt32 *val) michael@0: // michael@0: // Atomically decrement the integer pointed to by 'val' and return michael@0: // the result of the decrement. michael@0: // michael@0: .align 16 michael@0: .global _PR_ia64_AtomicDecrement# michael@0: .proc _PR_ia64_AtomicDecrement# michael@0: _PR_ia64_AtomicDecrement: michael@0: fetchadd4.rel r8 = [r32], -1 ;; michael@0: adds r8 = -1, r8 michael@0: br.ret.sptk.many b0 michael@0: .endp _PR_ia64_AtomicDecrement# michael@0: michael@0: // PRInt32 _PR_ia64_AtomicAdd(PRInt32 *ptr, PRInt32 val) michael@0: // michael@0: // Atomically add 'val' to the integer pointed to by 'ptr' michael@0: // and return the result of the addition. michael@0: // michael@0: .align 16 michael@0: .global _PR_ia64_AtomicAdd# michael@0: .proc _PR_ia64_AtomicAdd# michael@0: _PR_ia64_AtomicAdd: michael@0: ld4 r15 = [r32] ;; michael@0: .L3: michael@0: mov r14 = r15 michael@0: mov ar.ccv = r15 michael@0: add r8 = r15, r33 ;; michael@0: cmpxchg4.acq r15 = [r32], r8, ar.ccv ;; michael@0: cmp4.ne p6, p7 = r15, r14 michael@0: (p6) br.cond.dptk .L3 michael@0: br.ret.sptk.many b0 michael@0: .endp _PR_ia64_AtomicAdd# michael@0: michael@0: // PRInt32 _PR_ia64_AtomicSet(PRInt32 *val, PRInt32 newval) michael@0: // michael@0: // Atomically set the integer pointed to by 'val' to the new michael@0: // value 'newval' and return the old value. michael@0: // michael@0: .align 16 michael@0: .global _PR_ia64_AtomicSet# michael@0: .proc _PR_ia64_AtomicSet# michael@0: _PR_ia64_AtomicSet: michael@0: xchg4 r8 = [r32], r33 michael@0: br.ret.sptk.many b0 michael@0: .endp _PR_ia64_AtomicSet# michael@0: michael@0: // Magic indicating no need for an executable stack michael@0: .section .note.GNU-stack, "", @progbits ; .previous